built-in PATH seems to have sbin and bin out of order; and inconsistent

Bug #1792004 reported by Dimitri John Ledkov
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Undecided
Unassigned
bash (Ubuntu)
Undecided
Unassigned
Xenial
Undecided
Unassigned
Bionic
Undecided
Unassigned
Cosmic
Undecided
Unassigned
Disco
Undecided
Unassigned
busybox (Ubuntu)
Undecided
Unassigned
dash (Ubuntu)
Undecided
Unassigned
dpkg (Ubuntu)
Undecided
Unassigned
pam (Ubuntu)
Undecided
Unassigned
systemd (Ubuntu)
Undecided
Unassigned

Bug Description

[Impact]

 * For consistency reasons sbin should be ordered before bin in PATH.

[Test Case]

 * $ env -u PATH /bin/bash -c 'echo $PATH'

And check that matching pairs in PATH, have /sbin variant leading /bin variant.

[Regression Potential]

 * Ubuntu does not ship duplicate binries, with different behaviour between /sbin and /bin, thus all binaries will continue to be found in all locations. Also PATH is normally already set in the environment, and this change only affects the fallback path when bash is executed without any environment, i.e. booting with 'init=/bin/bash'

[Other Info]

 * Original bug report detailing inconsistent paths between various shells.

---

$ env -u PATH /bin/sh -c 'echo $PATH'
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

$ env -u PATH /bin/dash -c 'echo $PATH'
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

$ systemd-run --unit test-env env # ... and check journal for PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

$ env -u PATH /bin/bash -c 'echo $PATH'
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.

$ env -u PATH /bin/busybox sh -c 'echo $PATH'
/sbin:/usr/sbin:/bin:/usr/bin

$ grep 'export PATH=' -r initramfs-tools-0.131ubuntu10/
initramfs-tools-0.131ubuntu10/mkinitramfs:export PATH='/usr/bin:/sbin:/bin'
initramfs-tools-0.131ubuntu10/init:export PATH=/sbin:/usr/sbin:/bin:/usr/bin

dracut.sh has DRACUT_PATH=${DRACUT_PATH:-/sbin /bin /usr/sbin /usr/bin} exported as PATH
dracut-047+31/modules.d/99shutdown/shutdown.sh:export PATH=/usr/sbin:/usr/bin:/sbin:/bin

$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

apt & dpkg => should probably initiate /usr/local-less PATH

Imho the rest should probably be harmonised to:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

===

From a duplicate https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1614080 :

$ for i in 12.04 12.10 13.04 13.10 14.04 14.10 15.04 15.10 16.04; do echo $i; docker run -it --rm ubuntu:$i bash -c "unset PATH; /bin/bash -c 'echo \$PATH'"; done
12.04
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
12.10
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
13.04
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
13.10
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
14.04
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
14.10
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
15.04
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
15.10
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
16.04
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.

I believe later releases of bash, do too include CWD in the built-in PATH.

summary: - built-in PATH seems to have sbin and bin out of order
+ built-in PATH seems to have sbin and bin out of order; and inconsistent
description: updated
description: updated
description: updated
description: updated
description: updated
description: updated
Changed in bash (Debian):
status: Unknown → New
Revision history for this message
Dimitri John Ledkov (xnox) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bash - 4.4.18-2ubuntu3

---------------
bash (4.4.18-2ubuntu3) cosmic; urgency=medium

  * Resurrect "Set the default path to comply with Debian policy" in
    deb-bash-config.diff which went missing since 4.2+dfsg-1 or so.
    LP: #1792004 LP: #1614080 Closes: #781367
  * Add autopkgtest for the built-in path.

 -- Dimitri John Ledkov <email address hidden> Wed, 12 Sep 2018 15:22:11 +0100

Changed in bash (Ubuntu):
status: New → Fix Released
description: updated
Revision history for this message
Julian Andres Klode (juliank) wrote :

APT sets "/usr/sbin:/usr/bin:/sbin:/bin" as its PATH since disco. We explicitly do not add /snap/bin to the path as discussed internally, because we do not want deb maintainer scripts to be affected implicitly by snaps (they can still specify /snap/bin/<name>).

Changed in apt (Ubuntu):
status: New → Fix Released
Revision history for this message
Julian Andres Klode (juliank) wrote :

We don't want to change dpkg's default path, the change in apt should be sufficient, as dpkg should not really be used on its own.

Changed in dpkg (Ubuntu):
status: New → Won't Fix
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Dimitri, or anyone else affected,

Accepted bash into disco-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/bash/5.0-3ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-disco to verification-done-disco. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-disco. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in bash (Ubuntu Disco):
status: New → Fix Committed
tags: added: verification-needed verification-needed-disco
Revision history for this message
Adam Conrad (adconrad) wrote :

Hello Dimitri, or anyone else affected,

Accepted bash into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/bash/4.4.18-2ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in bash (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed-bionic
Changed in bash (Ubuntu Xenial):
status: New → Fix Committed
tags: added: verification-needed-xenial
Revision history for this message
Adam Conrad (adconrad) wrote :

Hello Dimitri, or anyone else affected,

Accepted bash into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/bash/4.3-14ubuntu1.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

(disco-amd64)root@ottawa:~# env -u PATH /bin/bash -c 'echo $PATH'
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
(disco-amd64)root@ottawa:~# dpkg-query -W bash
bash 5.0-3ubuntu1.1

Disco looks good.

tags: added: verification-done-disco
removed: verification-needed-disco
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

(bionic-amd64)root@ottawa:~# env -u PATH /bin/bash -c 'echo $PATH'
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
(bionic-amd64)root@ottawa:~# dpkg-query -W bash
bash 4.4.18-2ubuntu1.1

Bionic looks good.

tags: added: verification-done-bionic
removed: verification-needed-bionic
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

(xenial-amd64)root@ottawa:~# env -u PATH /bin/bash -c 'echo $PATH'
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
(xenial-amd64)root@ottawa:~# dpkg-query -W bash
bash 4.3-14ubuntu1.3

Xenial looks good.

tags: added: verification-done verification-done-xenial
removed: verification-needed verification-needed-xenial
Mathew Hodson (mhodson)
Changed in bash (Debian):
importance: Unknown → Undecided
affects: bash (Debian) → ubuntu-translations
no longer affects: ubuntu-translations
no longer affects: apt (Ubuntu Cosmic)
no longer affects: busybox (Ubuntu Cosmic)
no longer affects: dash (Ubuntu Cosmic)
Mathew Hodson (mhodson)
no longer affects: dpkg (Ubuntu Cosmic)
no longer affects: pam (Ubuntu Cosmic)
no longer affects: systemd (Ubuntu Cosmic)
Changed in bash (Ubuntu Cosmic):
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bash - 5.0-3ubuntu1.1

---------------
bash (5.0-3ubuntu1.1) disco; urgency=medium

  * Resurrect "Set the default path to comply with Debian policy" in
    deb-bash-config.diff which went missing since 4.2+dfsg-1 or so.
    LP: #1792004 LP: #1614080 Closes: #781367
  * Add autopkgtest for the built-in path.

 -- Dimitri John Ledkov <email address hidden> Fri, 03 May 2019 14:31:24 +0100

Changed in bash (Ubuntu Disco):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for bash has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bash - 4.4.18-2ubuntu1.1

---------------
bash (4.4.18-2ubuntu1.1) bionic; urgency=medium

  * Resurrect "Set the default path to comply with Debian policy" in
    deb-bash-config.diff which went missing since 4.2+dfsg-1 or so.
    LP: #1792004 LP: #1614080 Closes: #781367
  * Add autopkgtest for the built-in path.

 -- Dimitri John Ledkov <email address hidden> Fri, 03 May 2019 14:50:32 +0100

Changed in bash (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bash - 4.3-14ubuntu1.3

---------------
bash (4.3-14ubuntu1.3) xenial; urgency=medium

  * Resurrect "Set the default path to comply with Debian policy" in
    deb-bash-config.diff which went missing since 4.2+dfsg-1 or so.
    LP: #1792004 LP: #1614080 Closes: #781367
  * Add autopkgtest for the built-in path.

 -- Dimitri John Ledkov <email address hidden> Fri, 03 May 2019 14:57:15 +0100

Changed in bash (Ubuntu Xenial):
status: Fix Committed → Fix Released
information type: Public Security → Public
Revision history for this message
Dan Streetman (ddstreet) wrote :

please reopen if this is still an issue

Changed in systemd (Ubuntu):
status: New → Invalid
Revision history for this message
Ubfan (ubfan1) wrote :

Since 20.04, there are no /bin and /sbin directories, they are just links to /usr/sbin and /usr/bin -- perhaps they should be eliminated from the default PATH.

Revision history for this message
Seth Arnold (seth-arnold) wrote : Re: [Bug 1792004] Re: built-in PATH seems to have sbin and bin out of order; and inconsistent

On Tue, Aug 31, 2021 at 12:45:38AM -0000, Ubfan wrote:
> Since 20.04, there are no /bin and /sbin directories, they are just
> links to /usr/sbin and /usr/bin -- perhaps they should be eliminated
> from the default PATH.

Does it matter if you upgraded from 18.04 or 19.10 vs a fresh install?

Thanks

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers