PATH contains dot when PATH is unset before running bash

Bug #1614080 reported by Philippe Vaucher
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash (Debian)
New
Unknown
bash (Ubuntu)
Fix Released
Medium
Unassigned
Precise
Fix Released
Undecided
Unassigned
Trusty
Won't Fix
Undecided
Unassigned
Xenial
Fix Released
Undecided
Unassigned
Bionic
Fix Released
Undecided
Unassigned
Cosmic
Fix Released
Undecided
Unassigned
Disco
Fix Released
Undecided
Unassigned
Eoan
Fix Released
Medium
Unassigned

Bug Description

[Impact]

 * The fallback path built into bash contains '.' which leads to unexpected addition of the current working directory. It should not be there, just like it isnt' in pre-precise and cosmic+.

[Test Case]

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

Should not have '.' as any component. Nor should there be any empty components, i.e. '::'.

[Regression Potential]

 * Normally PATH is always set by either init, systemd, or any other hypervisor. Thus this only affects executions under bash, when it was started without any environment - e.g. booting with 'init=/bin/bash'.

[Other Info]

 * Original bug report.

On ubuntu 16.04 (but also 14.04), running bash with PATH unset always adds '.' to PATH:

philippe@pv-desktop:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
philippe@pv-desktop:~$ unset PATH
philippe@pv-desktop:~$ /bin/bash
philippe@pv-desktop:~$ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.

Even when testing in a virtual machine / docker, and erasing /root/.profile /root/.bashrc /etc/profile /etc/bash.bashrc the problem still happens.

summary: - bash PATH contains dot when PATH is unset
+ PATH contains dot when PATH is unset before running bash
Revision history for this message
Philippe Vaucher (philippe-vaucher) wrote :

The problem seems to have been introduced in 14.04

philippe@pv-desktop:~$ 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:.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1614080/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
affects: ubuntu → bash (Ubuntu)
tags: added: trusyt xenial
Changed in bash (Ubuntu):
importance: Undecided → Medium
tags: added: trusty
removed: trusyt
Revision history for this message
Philippe Vaucher (philippe-vaucher) wrote :

For information this bug does not happen on Fedora/CentOS

philippe@pv-desktop:~$ docker run -it --rm fedora:latest bash -c "unset PATH; /bin/bash -c 'echo \$PATH'"
/usr/local/bin:/usr/bin

Revision history for this message
Philippe Vaucher (philippe-vaucher) wrote :
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

@philippe-vaucher
I'm not quite concerned about what other distros do. Imho, it is buggy to not have `sbin` in the default built-in bash path - so i'd call fedora's bash built-in path still buggy ;-)

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
Changed in bash (Ubuntu Eoan):
status: Fix Released → In Progress
Changed in bash (Ubuntu Cosmic):
status: New → Fix Released
Changed in bash (Ubuntu Disco):
status: New → In Progress
Changed in bash (Ubuntu Eoan):
status: In Progress → Fix Committed
Changed in bash (Ubuntu Bionic):
status: New → In Progress
Changed in bash (Ubuntu Xenial):
status: New → In Progress
Changed in bash (Ubuntu Trusty):
status: New → In Progress
Changed in bash (Ubuntu Precise):
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bash - 5.0-3ubuntu2

---------------
bash (5.0-3ubuntu2) eoan; 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 Eoan):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Philippe, 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: In Progress → Fix Committed
tags: added: verification-needed verification-needed-disco
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Trusty is closed for SRUs, here is the diff that may be suitable for ESM.

Revision history for this message
Adam Conrad (adconrad) wrote :

Hello Philippe, 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: In Progress → Fix Committed
tags: added: verification-needed-bionic
Changed in bash (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed-xenial
Revision history for this message
Adam Conrad (adconrad) wrote :

Hello Philippe, 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
Changed in bash (Ubuntu Trusty):
status: In Progress → Won't Fix
Changed in bash (Debian):
status: Unknown → New
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
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.