cdesktopenv/src/lib/libcmd
Johnothan King 61fa1b68bf The `chown` builtin should fail with the same error consistently (#378)
This bug was first reported at <https://www.illumos.org/issues/3782>.
The chown builtin when used on illumos can fail with different error
messages after running the same command twice:

  $ touch /tmp/x
  $ /opt/ast/bin/chown -h 433:434 /tmp/px
  chown: /tmp/x: cannot change owner and group [Not owner]
  $ /opt/ast/bin/chown -h 433:434 /tmp/px
  chown: /tmp/x: cannot change owner and group [Invalid argument]

The error messages differ because the libast struid and strgid
functions will return -2 if the same nonexistent ID is used twice.

The fix for this bug has been ported from here:
https://github.com/illumos/illumos-gate/commit/4162633a7c5961f388fd

src/lib/libcmd/chgrp.c:
- Remove NOID macro and check for a < 0 error status instead.
  This is different from the Illumos fix at
  <https://github.com/illumos/illumos-gate/commit/4162633a7c59>
  which added another macro.

src/lib/libast/man/{strgid,struid}.3:
- Correct errors in the strgid and struid documentation.
- Document that the strgid and struid functions will return -2 if
  the same invalid name is used twice.

Co-authored-by: Martijn Dekker <martijn@inlv.org>
2021-12-14 10:37:44 +01:00
..
features Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
Mamfile Get rid of overcomplicated AT&T copyright/license maintenance code 2021-12-14 03:15:16 +01:00
RELEASE Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00
basename.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
cat.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
chgrp.c The `chown` builtin should fail with the same error consistently (#378) 2021-12-14 10:37:44 +01:00
chmod.c libcmd: rm old fts_fix workaround 2021-11-07 22:41:48 +00:00
chown.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
cksum.c Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00
cmd.h Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
cmdinit.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
cmp.c Fix various compiler warnings and minor issues (#362) 2021-12-09 06:42:59 +01:00
comm.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
cp.c Fix various compiler warnings and minor issues (#362) 2021-12-09 06:42:59 +01:00
cut.c Fix various compiler warnings and minor issues (#362) 2021-12-09 06:42:59 +01:00
date.c Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00
dirname.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
expr.c Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00
fds.c Use dynamic maximum configuration values when necessary (#370) 2021-12-13 07:53:14 +01:00
fmt.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
fold.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
getconf.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
head.c Fix handling of files without newlines in the `head` and `tail` builtins (#365) 2021-12-09 06:43:10 +01:00
id.c Use dynamic maximum configuration values when necessary (#370) 2021-12-13 07:53:14 +01:00
join.c Fix various compiler warnings and minor issues (#362) 2021-12-09 06:42:59 +01:00
lib.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
ln.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
logname.c Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00
md5sum.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
mkdir.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
mkfifo.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
mktemp.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
mv.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
paste.c Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00
pathchk.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
pids.c Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00
rev.c Fix various compiler warnings and minor issues (#362) 2021-12-09 06:42:59 +01:00
rev.h Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
revlib.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
rm.c Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00
rmdir.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
stty.c Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00
sum.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
sync.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
tail.c Fix handling of files without newlines in the `head` and `tail` builtins (#365) 2021-12-09 06:43:10 +01:00
tee.c Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00
tty.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
uname.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
uniq.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
vmstate.c Disable vmalloc by default; fix build on Cygwin 2021-12-05 19:28:45 +01:00
wc.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
wc.h Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
wclib.c Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00