[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash interprets ~ in PATH - not compatible with exec*()

From: egmont
Subject: bash interprets ~ in PATH - not compatible with exec*()
Date: Sun, 24 Nov 2002 13:55:03 +0100 (CET)

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu' 
-I/home/doko/packages/bash/bash-2.05a/lib -g -O2
uname output: Linux sziami 2.4.18 #1 SMP Mon Nov 18 17:04:42 CET 2002 i686 
Machine Type: i386-pc-linux-gnu

Bash Version: 2.05a
Patch Level: 0
Release Status: release

Bash interpretes ~ and ~username in PATH. This is incompatible with the
behaviour of exec*p() library calls, which - obviously - do not do so.
This can cause a lot of trouble to the user who sets PATH to e.g.
"~/bin:otherdirectories", as s/he will believe his/her PATH is okay, bash
finds executables under his/her home slash bin, but applications different
from bash executing other applications won't see this component of PATH.

Tested on two systems:
 Debian GNU/Linux 3.0 (bash 2.05a, glibc 2.2.5, gcc 2.95.4)
 UHU Linux 1.0-rc2    (bash 2.05b, glibc 2.3.1, gcc 3.2.1)

strace clearly shows on both systems that if PATH contains '~/bin' then an
execlp() call tries to execve() '~/bin/executablename', without expanding '~'.
However, on both systems, bash finds the executables under your home slash bin.

<should be trivial to repeat>

bash should not expand ~ characters in PATH, to be compatible with exec*p(),
and not to make the user believe s/he has a correct PATH when s/he doesn't

reply via email to

[Prev in Thread] Current Thread [Next in Thread]