bug-bash
[Top][All Lists]
Advanced

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

quoting paths in environment variables could be improved


From: Mark Stosberg
Subject: quoting paths in environment variables could be improved
Date: Sat, 3 Nov 2001 16:05:23 -0500

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: freebsd4.4
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='freebsd4.4' -DCONF_MACHTYPE='i386--freebsd4.4' 
-DCONF_VENDOR='' -DSHELL  -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib 
-I/usr/local/include -O -pipe
uname output: FreeBSD asana.dhis.org 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Tue 
Sep 18 11:57:08 PDT
2001     murray@builder.FreeBSD.org:/usr/src/sys/compile/GENERIC  i386
Machine Type: i386--freebsd4.4
 
Bash Version: 2.05
Patch Level: 0
Release Status: release
 
Description:
        Paths held in standard environment variables that contain special
characters could be handled more gracefully.
 
Repeat-By:
        mkdir "foo bar"
        cd "foo bar"
        cd $PWD
        cd: /home/mark/tmp/foo: No such file or directory
 
Fix:
        To avoid this, path names could be stored quoted in the environment by
default, like this:
        PWD="/home/mark/tmp/foo bar"
 
Scripts that were already working around this issue may end up double quoting
paths, but that shouldn't cause any problems.
 
I ran into this when using Bash on Darwin (Mac OS X), where it's fairly
common for directory names to have spaces in them. If this issue could be
addressed at the shell level that would be ideal. Otherwise it would seem that
every shell script that dealt with one of the path environment variables would
have to be careful about quoting it correctly.
 
Thanks for your work on Bash-- I use it everyday.
 
  -mark
http://mark.stosberg.com/



reply via email to

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