Bug #3779
ksh93's builtin chown handling is busted
0%
Description
I discovered some surprising things lately.
builtin chown in ksh fails when chown -h if the link target is missing. /usr/bin/chown is fine with it.
garrett@openindiana:/tmp/usr/bin$ pfexec ksh
garrett@openindiana:/tmp/usr/bin$ id
uid=0(root) gid=0(root)
garrett@openindiana:/tmp/usr/bin$ ls -la /tmp/file
lrwxrwxrwx 1 garrett staff 11 May 20 08:34 /tmp/file -> /nosuchfile
garrett@openindiana:/tmp/usr/bin$ cat /tmp/file
cat: /tmp/file: cannot open [No such file or directory]
garrett@openindiana:/tmp/usr/bin$ whence -v chown
chown is a shell builtin version of /usr/bin/chown
garrett@openindiana:/tmp/usr/bin$ chown -h root /tmp/file
chown: /tmp/file: cannot change owner [No such file or directory]
garrett@openindiana:/tmp/usr/bin$ /bin/chown -h root /tmp/file
garrett@openindiana:/tmp/usr/bin$ ls -la /tmp/file
lrwxrwxrwx 1 root staff 11 May 20 08:34 /tmp/file -> /nosuchfile
Updated by Irek Szczesniak over 7 years ago
Bug passed to upstream. May take a week or two to get feedback because the AST and UWIN projects are currently under lockdown to merge several project branches into the mainline.
Updated by Irek Szczesniak over 7 years ago
Glenn Fowler asked:
my first attempt to reproduce (albeit not as root) worked
maybe its an older version
what does this show
chown --?-version
Updated by Garrett D'Amore over 7 years ago
version chgrp (AT&T Research) 2009-07-02
This is from illumos (current). It is known that illumos ksh93 is pretty far behind the latest... when Roland vanished nobody really picked up the ball to integrate any updates.
(I recall that the problem with his original work was that there was such a huge delta that nobody could meaningfully review the changes, and they weren't presented as separate reviewable items. It may be impossible to do that now anyway.)