bug-bash
[Top][All Lists]
Advanced

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

pushd needs '--' twice to mark end of flags.


From: jess
Subject: pushd needs '--' twice to mark end of flags.
Date: Wed, 27 Oct 2004 23:57:19 +0200

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='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib   -g -O2
uname output: Linux syrinx 2.6.8-1-686 #1 Thu Oct 7 03:15:25 EDT 2004 i686 
GNU/Linux
Machine Type: i686-pc-linux-gnu

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

Description:
pushd needs '--' twice to mark end of flags. 

Repeat-By:

$ pushd -- ++revision-lock/
bash: pushd: ++revision-lock/: invalid number
pushd: usage: pushd [dir | +N | -N] [-n]


Fix:

--- builtins/pushd.def  2003-12-20 00:05:04.000000000 +0100
+++ ../bash-3.0.pushd/builtins/pushd.def        2004-10-27 22:30:47.000000000 
+0200
@@ -152,12 +152,18 @@
      WORD_LIST *list;
 {
   char *temp, *current_directory, *top;
-  int j, flags;
+  int j;
   intmax_t num;
   char direction;
 
+  int flags = 0;
+  int end_of_flags = 0;
+
   if (list && list->word && ISOPTION (list->word->word, '-'))
-    list = list->next;
+    {
+      list = list->next;
+      end_of_flags = 1;
+    }
 
   /* If there is no argument list then switch current and
      top of list. */
@@ -181,7 +187,7 @@
       return j;
     }
 
-  for (flags = 0; list; list = list->next)
+  for ( ; !end_of_flags && list; list = list->next)
     {
       if (ISOPTION (list->word->word, 'n'))
        {
@@ -190,6 +196,7 @@
       else if (ISOPTION (list->word->word, '-'))
        {
          list = list->next;
+          end_of_flags = 1;
          break;
        }
       else if (list->word->word[0] == '-' && list->word->word[1] == '\0')






reply via email to

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