Skip to content

openrc-init: use sbindir instead of hard-coded /sbin for PATH#1011

Open
roman-kiselevich wants to merge 2 commits into
OpenRC:masterfrom
roman-kiselevich:fix-openrc-init-path
Open

openrc-init: use sbindir instead of hard-coded /sbin for PATH#1011
roman-kiselevich wants to merge 2 commits into
OpenRC:masterfrom
roman-kiselevich:fix-openrc-init-path

Conversation

@roman-kiselevich
Copy link
Copy Markdown
Contributor

This PR fixes the hard-coded part of /sbin default path. Moved the path_default var to rc.h.in macro as was suggested in the comment below. This issue was hard to find so I added one more log that can be useful because you just see this do_exec: No such file or directory without any context

Also, the issue was addressed here #205 (comment)

Comment thread src/librc/rc.h.in Outdated
#define RC_PLUGINDIR "@RC_PLUGINDIR@"

#define RC_INIT_FIFO RC_SVCDIR"/init.ctl"
#define RC_INIT_DEFAULT_PATH "@SBINDIR@:/usr/sbin:/bin:/usr/bin"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should we also put @BINDIR@ instead of /bin ?

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.

that would give it two /bin entries in the default setup

but we do need our tools to be in PATH

so ideally we'd add @bindir@ if it's not already /bin

or, for a better way to do that, remove /bin from the header, and on meson, set @bindir@ to either /bin or custom/path:/bin, depending on the configured value

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@navi-desu thx for your review. Is my understanding correct?

/bin still has to be on default path for backward compatibility even in case of custom bindir

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.

not for backwards compatibility, but for just, normal compatibility

the path isn't used just for openrc, but for the init scripts too, and any command they call (e.g. coreutils)

a user may want to install openrc binaries to a custom directory such as /opt/openrc. Before, the default PATH was hardcoded and openrc-init failed on startup in case of non-standard bindir, sbindir config. Now, for better debugging, PATH variable is logged before it is set, and the directories for PATH are set in rc.h.

/bin still has to be on default path for backward compatibility even in case of custom bindir
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.

2 participants