mainThe GNU Bourne-Again SHell - Support: sr #109360, pushd into current directory cause...

 
 

sr #109360: pushd into current directory cause popd to fail

Submitter:  None
Submitted:  Mon 24 Jul 2017 06:15:18 AM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Works For Me
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 03 Aug 2017 02:09:24 AM UTC, comment #1: 

I don't get these results with bash-4.3 or bash-4.4.

Chet Ramey <chet>
Group administrator
Mon 24 Jul 2017 06:15:18 AM UTC, original submission:  

If you pushd into the current directory, the command will exit successfully but without putting the current directory into the stack, causing the subsequent popd to fail either because a stack mismatch, or because the stack is empty.

Test case 1:

Open new terminal.
Run pushd ~/
Run popd
failed with popd: directory stack empty
Test case 2:

Open new terminal.
Run cd /
Run pushd ~/
Run pushd ~/
Run popd, this should cd to ~/ and pop the stack to /, but it cd to / instead and stack is now empty.
Run popd again, stack is empty so command failed with popd: directory stack empty

Tested on bash 4.3.48(1) on ubuntu 16.04 x86_64

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-03 chet StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code