bug-bash
[Top][All Lists]
Advanced

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

Noisy CDPATH breaks variable construction


From: Dams
Subject: Noisy CDPATH breaks variable construction
Date: Mon, 11 Jan 2010 18:30:26 +0100

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS  
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic
uname output: Linux dnade.bureau 2.6.31.9-174.fc12.x86_64 #1 SMP Mon Dec 21 
05:33:33 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.0
Patch Level: 35
Release Status: release

Description:

        CDPATH makes the `cd' primitive quite verbose enough to break
        some scripts, and it's also breaking the bourne compatibility.

Repeat-By:

        This is an example of cd new verbosity : 
user@host:~$ echo $CDPATH
.:/home/user:/:/mnt/
user@host:~$ cd /
user@host:/$ cd dev
/dev

        I've found a /bin/sh script in openswan tarball which has this
        kind of code :

FOO=$(cd $SOMEVAR && pwd)

        Since CDPATH is exported to openswan build script, FOO
        variable contains *twice* the absolute path and the rest of
        the script just breaks. Basically any variable constructed
        with a backquote-style subshell containing a cd can break

Fix:
        I see more than one way to fix this issue: 
        1. Disable CDPATH feature by default in bourne mode.
        2. Disable CDPATH feature by default in non-interactive mode.
        3. Make `cd' primitive silent (like zsh does) when resolving
           path using CDPATH.
        4. All of the above.

-- 
         Dams Nadé
Anvil/Anvilou on irc.freenode.net : #Fedora
"Dona Nobis Pacem E Dona Eis Requiem". Noir.





reply via email to

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