Project

General

Profile

Actions

Bug #3779

closed

ksh93's builtin chown handling is busted

Added by Garrett D'Amore about 10 years ago. Updated about 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
cmd - userland programs
Start date:
2013-05-22
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
External Bug:

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

Actions #1

Updated by Irek Szczesniak about 10 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.

Actions #2

Updated by Irek Szczesniak about 10 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

Actions #3

Updated by Garrett D'Amore about 10 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.)

Actions #4

Updated by Andy Fiddaman about 2 years ago

  • Status changed from New to Resolved

I cannot reproduce this with the current ksh93 in gate, and nor could it be reproduced 8 years ago with the upstream version of chgrp. I'm closing this as resolved, please re-open if it's still an issue.

bloody% pfexec ksh
af@bloody:~/ksh$ id
uid=0(root) gid=0(root)
af@bloody:~/ksh$ ln -s /nosuchfile /tmp/file
af@bloody:~/ksh$ ls -la /tmp/file
lrwxrwxrwx   1 root     root          11 Mar  8 16:44 /tmp/file -> /nosuchfile
af@bloody:~/ksh$ cat /tmp/file
cat: /tmp/file: cannot open [No such file or directory]
af@bloody:~/ksh$ whence -v chown
chown is a tracked alias for /usr/bin/chown
af@bloody:~/ksh$ builtin chown
af@bloody:~/ksh$ whence -v chown
chown is a shell builtin
af@bloody:~/ksh$ chown -h root /tmp/file
af@bloody:~/ksh$ ls -la /tmp/file
lrwxrwxrwx   1 root     root          11 Mar  8 16:44 /tmp/file -> /nosuchfile
af@bloody:~/ksh$ chown -h af /tmp/file
af@bloody:~/ksh$ ls -la /tmp/file
lrwxrwxrwx   1 af       root          11 Mar  8 16:44 /tmp/file -> /nosuchfile

af@bloody:~/ksh$ echo ${.sh.version}
Version jM 93u+ 2012-08-01

af@bloody:~/ksh$ chown --version
  version         chgrp (AT&T Research) 2012-04-20
Actions

Also available in: Atom PDF