Discussion:
[ast-developers] ksh does not fail properly when 'cd' to directory without execute bit
Michal Hlavinka
2014-06-26 10:05:19 UTC
Permalink
Hi,

we found a bug in ksh that it does not print any error when 'cd' to
directory without execute bit. It does not print any error, it looks
like it succeeded despite it did not.

reproducer:
$ mkdir -p a/b/c
$ chmod -x a/b
$ cd a
$ cd b
$ echo $?
0 # should be nonzero
$ pwd
/tmp/a/b
$ ls
b # which means ls was executed from /tmp/a not /tmp/a/b

oneliner version:

ksh -c 'T=$(mktemp -d); chmod -x $T; cd $T; r=$?; cd; rm -rf $T; [ "$r"
!= 0 ] || { echo FAIL; exit $r; }; echo pass;'

This was caused by changes around 2012-10-10

Fix is attached

Michal

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ksh-20120801-cdfix3.patch
Type: text/x-patch
Size: 831 bytes
Desc: not available
URL: <http://lists.research.att.com/pipermail/ast-developers/attachments/20140626/a1c7287b/attachment.bin>
Loading...