Bug#775704: bash: $PATH ending in colon puts working directory in PATH

2015-01-18 Thread Bob Proulx
Sebastian Rose wrote:
> if the value of $PATH ends in a colon (':'), skripts in the current directory
> are executed without requiring the './' path-prefix.

Thank you for your report.  However what you are seeing is not a bug.
It is required behavior.  An empty path is the same as saying '.'.
That is the way it is supposed to work.  Here is the documentation
from the manual.

  PATH   The search path for commands.  It is a colon-separated list of
 directories in which the shell looks for commands (see
 COMMAND EXECUTION below).  A zero-length (null) directory
 name in the value of PATH indicates the current directory.  A
 null directory name may appear as two adjacent colons, or as
 an initial or trailing colon.  The default path is
 system-dependent, and is set by the administrator who
 installs bash.  A common value is
 ``/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin''.

Bob


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#775704: bash: $PATH ending in colon puts working directory in PATH

2015-01-18 Thread Sebastian Rose
Package: bash
Version: 4.3-11+b1
Severity: important
Tags: upstream

Dear Maintainer,


if the value of $PATH ends in a colon (':'), skripts in the current directory
are executed without requiring the './' path-prefix.
The current directory is the last one taken into account though.

Here is, how I triggerd the bug:

8<--- SNIP 8<

sh# /bin/bash
sh# cd /tmp
sh# echo '#!/usr/bin/env perl' > test.pl
sh# echo 'print "In PATH...\n"' >> test.pl
sh# chmod u+x test.pl

# Now set $PATH to a sensible value:
sh# export PATH=~/bin:/bin:/usr/bin:/usr/local/bin
sh# test.pl
bash: test.pl: Command not found.

# Now set $PATH to the same value, colon appended:
sh# export PATH=~/bin:/bin:/usr/bin:/usr/local/bin:
sh# test.pl
In PATH...

>8--- SNIP >8


I'd expected the last line of output to be:

bash: test.pl: Command not found.


# bash --version
GNU bash, Version 4.3.30(1)-release (x86_64-pc-linux-gnu)

Debian testing.



-- System Information:
Debian Release: 8.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bash depends on:
ii  base-files   8
ii  dash 0.5.7-4+b1
ii  debianutils  4.4+b1
ii  libc62.19-13
ii  libncurses5  5.9+20140913-1
ii  libtinfo55.9+20140913-1

Versions of packages bash recommends:
ii  bash-completion  1:2.1-4

Versions of packages bash suggests:
ii  bash-doc  4.3-11

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org