logo       

`pushd DIR' fails when DIR starts with "-": msg#00193

shells.bash.bugs

Subject: `pushd DIR' fails when DIR starts with "-"

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/scratch/gmorris/software/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-I/scratch/gmorris/software/include -g -O2
uname output: Linux xpc14.ast.cam.ac.uk 2.6.8-1.521 #1 Mon Aug 16 09:01:18 EDT
2004 i686 athlon i386 GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 3.0
Patch Level: 13
Release Status: release

Description:

`pushd DIR' fails to work if DIR starts with a hyphen.
Using `pushd -- DIR' does not help.


Repeat-By:

mkdir -- -foo
builtin pushd -- -foo
bash: pushd: -foo: invalid number
pushd: usage: pushd [dir | +N | -N] [-n]


Fix:

pushd_builtin checks for a "--" option twice. Removing the first check
fixes this problem, but might cause another one (I don't know
if the first "--" check was doing something useful).


*** bash-3.0/builtins/pushd.def.ORIG 2004-10-14 19:38:36.251195925 +0100
--- bash-3.0/builtins/pushd.def 2004-10-14 19:38:43.092934416 +0100
***************
*** 156,164 ****
intmax_t num;
char direction;

- if (list && list->word && ISOPTION (list->word->word, '-'))
- list = list->next;
-
/* If there is no argument list then switch current and
top of list. */
if (list == 0)
--- 156,161 ----


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise