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


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

Submitted by:  None
Submitted on:  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

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


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>
Project 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



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

Attach Files:

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)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    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.3