[Bug 85552] Re: bash returns wrong error code when changing to nonexisting directory

neelima parakala 85552 at bugs.launchpad.net
Sun Jan 22 08:46:45 UTC 2012


** Changed in: bash (Ubuntu)
     Assignee: (unassigned) => neelima parakala (lissomlilyneelu)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/85552

Title:
  bash returns wrong error code when changing to nonexisting directory

Status in “bash” package in Ubuntu:
  Triaged

Bug description:
  Binary package hint: bash

  When removing current directory and then doing a cd . bash reports
  sucess when invoked as /bin/bash but reports failure when invoked as
  /bin/sh. IMO it should report failure in both cases.

  ankpelle[~]$ /bin/bash
  ankpelle[~]$ mkdir /scratch/kalle
  ankpelle[~]$ cd /scratch/kalle/
  ankpelle[kalle]$ rmdir /scratch/kalle
  ankpelle[kalle]$ cd .
  cd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
  ankpelle[.]$ echo $?
  0
  ankpelle[.]$ pwd
  /scratch/kalle/.
  ankpelle[.]$ exit
  exit
  sh-3.2$ mkdir /scratch/kalle
  sh-3.2$ cd /scratch/kalle/
  sh-3.2$ rmdir /scratch/kalle
  sh-3.2$ cd .
  sh: cd: .: No such file or directory
  sh-3.2$ echo $?
  1
  sh-3.2$ pwd
  pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
  sh-3.2$ ls -l /bin/sh
  lrwxrwxrwx 1 root root 4 2007-02-16 13:33 /bin/sh -> bash
  sh-3.2$ exit

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/85552/+subscriptions




More information about the foundations-bugs mailing list