cd flibbleflob/.. works when it shouldn't

Bug #1194800 reported by David Jones
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
dash (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Consider the script:

    cd flibbleflob/.. 2> /dev/null || echo splat

(Assuming that the flibbleflob directory does not exist) the 'cd' should fail and so "splat" should be sent to stdout. And on bash it is:

    bash -c 'cd flibbleflob/.. 2> /dev/null || echo splat'
    splat

But with dash, no output:

    dash -c 'cd flibbleflob/.. 2> /dev/null || echo splat'

disappoint.

drj$ lsb_release -rd
Description: Ubuntu 13.04
Release: 13.04

drj$ apt-cache policy dash
dash:
  Installed: 0.5.7-3ubuntu1
  Candidate: 0.5.7-3ubuntu1
  Version table:
 *** 0.5.7-3ubuntu1 0
        500 http://gb.archive.ubuntu.com/ubuntu/ raring/main amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in dash (Ubuntu):
status: New → Confirmed
Revision history for this message
Richard Hansen (rhansen) wrote :
Revision history for this message
David Jones (drj) wrote :

#2 I read 8.b.ii. Right after I read 8.b.i which says:

"""
If the preceding component does not refer (in the context of pathname resolution with symbolic links followed) to a directory, then the cd utility shall display an appropriate error message and no further steps shall be taken.
"""

So my interpretation is that POSIX mandates an error in this case.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.