FS#55482 - [filesystem] Default PATH orders sbin before bin

Attached to Project: Arch Linux
Opened by Pierre Schmitz (Pierre) - Sunday, 03 September 2017, 03:26 GMT
Last edited by Sébastien Luttringer (seblu) - Sunday, 10 December 2017, 16:04 GMT
Task Type Bug Report
Category Packages: Testing
Status Closed
Assigned To Sébastien Luttringer (seblu)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The filesystem package in [testing] sets the following PATH by default:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

The version in [core] used to set:

/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

As /usr/sbin is now set before /usr/bin some programms pick up sbin by default even though this one is just a symlink to bin and should be considered deprecated. An example would be PHP which now compiles to /usr/sbin/sendmail instead of /usr/bin/sendmail by default.
This task depends upon

Closed by  Sébastien Luttringer (seblu)
Sunday, 10 December 2017, 16:04 GMT
Reason for closing:  Fixed
Additional comments about closing:  filesystem 2017.10-2
Comment by Eli Schwartz (eschwartz) - Sunday, 03 September 2017, 04:30 GMT
This is because /etc/profile merely appends to your PATH now, instead of hardcoding a PATH. Which means that whatever the PATH used to be before /etc/profile is loaded, is still lingering around... The default Arch install does not add those at all. At least mine does not.

Also why do you have the /etc/profile.d/perlbin.sh paths appearing three times?

Though I do note that before /etc/profile is loaded, my PATH=/usr/bin which produces unexpected results of a different nature.
My new PATH is "/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl".
Comment by Pierre Schmitz (Pierre) - Sunday, 03 September 2017, 04:40 GMT
These results are from a devtools build chroot. So these are unmodified defaults.
Comment by Eli Schwartz (eschwartz) - Sunday, 03 September 2017, 05:27 GMT
uhh... I get that in devtools too, apparently.

And apparently for my logged in system this is derived from /etc/login.defs:
ENV_PATH PATH=/usr/bin

Our bash PKGBUILD has the following CFLAGS: -DDEFAULT_PATH_VALUE='"/usr/local/sbin:/usr/local/bin:/usr/bin"'

Does systemd-nspawn *also* try to set this somehow?
Comment by Sébastien Luttringer (seblu) - Sunday, 03 September 2017, 23:04 GMT
My guess is that values (and orders) are defined in the systemd variable DEFAULT_PATH_SPLIT_USR in src/basic/path-util.h and added by systemd-nspawn, called by arch-nspawn, called by makechrootpkg.
The PATH is not the same between a «booted» system (.service units) and a «spawned» system.

Side discovery, all our daemons PATH environment are also defined by a value in this file, which make our default PATH to be /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin.
I added an environment generator to define our arch default path in systemd in 2017.09-1.

With the previous version of filesystem, the PATH variable was reset when the shell loads /etc/profile. See  FS#47884 .
Our build system is several bash scripts, and the PATH in the chrooted environment was defined by /etc/profile.

We have a several options:
- We restore the previous behaviour in filesystem;
- We fix systemd-nspawn to use DEFAULT_PATH instead of DEFAULT_PATH_SPLIT_USR;
- We fix arch-nspawn to set the arch default path
Comment by Sébastien Luttringer (seblu) - Wednesday, 06 September 2017, 21:41 GMT
I sent a patch to arch-project which define the Arch default PATH when calling systemd-nspawn.
Comment by Sébastien Luttringer (seblu) - Monday, 11 September 2017, 19:44 GMT
I pushed a new version of devtools in testing with a patched arch default environment. Looks good so far.

Loading...