bug-bash
[Top][All Lists]
Advanced

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

popd always has return status 0


From: james . cuzella
Subject: popd always has return status 0
Date: Thu, 1 Dec 2011 17:01:50 -0700 (MST)

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-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2 -Wall
uname output: Linux cirrus 3.0.0-13-generic #22-Ubuntu SMP Wed Nov 2 13:27:26 
UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.2
Patch Level: 10
Release Status: release

Description:
        popd does not appear to return a nonzero exit status when the directory 
stack is empty anymore.  The bash manual says the following for popd:

        "If the popd command is successful, a dirs is performed as well, and 
the return status is 0.  popd returns false if an invalid option is 
encountered, the directory stack is
                      empty, a non-existent directory stack entry is specified, 
or the directory change fails."
                                  
        I am seeing this problem on: Ubuntu 11.10 oneiric
               bash package version: 4.2-0ubuntu4

Repeat-By:
        Put some directories on the stack with pushd, then call popd and check 
the return status.  It is expected to be nonzero when the stack is empty or an 
error occurs.
        The following function should pop all dirs off the stack and then stop, 
however the while loop continues infinitely:

        popall () 
        { 
                local not_done=0;
                while [ $not_done -eq 0 ]; do
                        popd;
                        not_done=$?;
                done
        }



reply via email to

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