Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Supervisor's PATH setting & two other treats #421

Merged
merged 3 commits into from
Apr 21, 2016

Conversation

fnichol
Copy link
Collaborator

@fnichol fnichol commented Apr 21, 2016

This changeset has three parts:

[sup] Update how Supervisor sets PATH on start.

This change uses a more robust strategy for setting the PATH
environment variable before a supervised process is start via the
start subcommand.

Prior to this change, an install of the supervisor package was required
in order for the Supervisor to start any service, which included
running the Supervisor in the source tree for purposes of development.
This change makes it more explict what we are after in the supervisor's
PATH entry: a minmal BusyBox userland.

There is a series of fallback strategies used here in order to find a
usable BusyBox installation. The general strategy is the following:

  • Are we (the Supervisor) running inside a package?
    • Yes: use the BusyBox release describes in our DEPS metafile
      & return its PATH entries
    • No
      • Can we find any installed BusyBox pacakge?
        • Yes: use the latest installed BusyBox release
          & return its PATH entries
        • No
          • Is the busybox binary present on $PATH?
            • Yes: return the parent directory which holds
              the busybox binary
            • No: out of ideas, so return an error after warning
              the user we're done

The end result is that an installation of the Supervisor package is no
longer required in a development environment--only an installation of
the core/busybox-static package. Additionally, the precise release of
the core/busybox-static dependency will be used when running the
Supervisor out of a pacakge (its natural home).

[formatting] Code formating updates due to rustfmt.

Without this change there will be mega code churn in the core::crypto module.

[core] Add env::var & env::var_os functions to check for empty vars.

The standard library will consider an empty-but-set environment
variable a legit result. After inspecting the codebase, it turns out
that is not the expectation in most of our code. Indeed, a set-but-empty
HAB_DEPOT_URL is not valid and should be ignored.

This change introduces 2 functions which shadow their standard library
cousins providing this additional check.

fnichol and others added 3 commits April 21, 2016 16:56
This change uses a more robust strategy for setting the `PATH`
environment variable before a supervised process is start via the
`start` subcommand.

Prior to this change, an install of the supervisor package was required
in order for the Supervisor to start any service, which included
running the Supervisor in the source tree for purposes of development.
This change makes it more explict what we are after in the supervisor's
`PATH` entry: a minmal BusyBox userland.

There is a series of fallback strategies used here in order to find a
usable BusyBox installation. The general strategy is the following:

* Are we (the Supervisor) running inside a package?
    * Yes: use the BusyBox release describes in our `DEPS` metafile
           & return its `PATH` entries
    * No
        * Can we find any installed BusyBox pacakge?
            * Yes: use the latest installed BusyBox release
              & return its `PATH` entries
            * No
                * Is the `busybox` binary present on `$PATH`?
                    * Yes: return the parent directory which holds
                           the `busybox` binary
                    * No: out of ideas, so return an error after warning
                          the user we're done

The end result is that an installation of the Supervisor package is no
longer required in a development environment--only an installation of
the `core/busybox-static` package. Additionally, the precise release of
the `core/busybox-static` dependency will be used when running the
Supervisor out of a pacakge (its natural home).
The standard library will consider an empty-but-set environment
variable a legit result. After inspecting the codebase, it turns out
that is not the expectation in most of our code. Indeed, a set-but-empty
`HAB_DEPOT_URL` is not valid and should be ignored.

This change introduces 2 functions which shadow their standard library
cousins providing this additional check.
@thesentinels
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @metadave, @reset and @adamhjk to be potential reviewers

@fnichol
Copy link
Collaborator Author

fnichol commented Apr 21, 2016

It turns out that having an offline Depot is uncovering several of these issues which are a bit easier to fix. Don't ask me why…

gif-keyboard-10403519858208573370

@reset
Copy link
Collaborator

reset commented Apr 21, 2016

gif-keyboard-6119715001959801035

@reset reset merged commit ef84858 into master Apr 21, 2016
@reset reset deleted the fnichol/sup-setting-path-update branch April 21, 2016 23:37
@fnichol
Copy link
Collaborator Author

fnichol commented Apr 21, 2016

@reset You have won the day for Gif That Makes Me Blush

gif-keyboard-183585921985331661

@reset
Copy link
Collaborator

reset commented Apr 21, 2016

@fnichol I was very proud of that gif find

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants