Skip to content

Remove /sbin from paths if split-bin is false - #8324

Merged
poettering merged 1 commit into
systemd:masterfrom
keszybz:optionally-drop-sbin-use
Mar 1, 2018
Merged

poettering merged 1 commit into
systemd:masterfrom
keszybz:optionally-drop-sbin-use

Conversation

@keszybz

@keszybz keszybz commented Mar 1, 2018

Copy link
Copy Markdown
Member

Follow-up for 157baa8.

@poettering poettering added tree-wide good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed labels Mar 1, 2018
Comment thread src/basic/path-util.h
#define DEFAULT_PATH_NORMAL "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":/sbin:/bin"
#if HAVE_SPLIT_BIN
# define PATH_SBIN_BIN(x) x "sbin:" x "bin"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: I dislike requiring trailing slash on paths at the caller...

So maybe instead use:

#define PATH_SBIN_BIN(basedir) basedir "/sbin:" basedir "/bin"

(Also: something like basedir is more clear than just simply x here... If you want something short, perhaps d?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: I dislike requiring trailing slash on paths at the caller...

I started that way, but then there's the root directory, which would look like PATH_SBIN_BIN(""), so I think it's nicer to require the trailing slash and have PATH_SBIN_BIN("/"). It was a conscious decision ;)

Also: something like basedir

The name of the argument to a macro is only used in that one line, where the definition is visible anyway, so I don't think it matters.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha, great minds think alike... when i reviewed this earlier i had the exact same though as @filbranden but then saw the effect on the root dir and cancel my comment again... ;-)

@poettering
poettering merged commit 671f0f8 into systemd:master Mar 1, 2018
@keszybz
keszybz deleted the optionally-drop-sbin-use branch March 5, 2018 16:23
poettering added a commit to poettering/systemd that referenced this pull request Apr 18, 2018
… default

We don't know what the container payload needs, hence default to a PATH
with both bin and sbin included, as well as / and /usr.

Follow-up for systemd#8324

Fixes: systemd#8698
keszybz pushed a commit that referenced this pull request Apr 20, 2018
… default (#8756)

We don't know what the container payload needs, hence default to a PATH
with both bin and sbin included, as well as / and /usr.

Follow-up for #8324

Fixes: #8698
@keszybz keszybz removed the good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed label Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants