1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

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:
4162633a7c

src/lib/libcmd/chgrp.c:
- Remove NOID macro and check for a < 0 error status instead.
  This is different from the Illumos fix at
  <4162633a7c>
  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>
This commit is contained in:
Johnothan King 2021-12-14 01:22:30 -08:00 committed by Martijn Dekker
parent c0354a869f
commit 61fa1b68bf
4 changed files with 38 additions and 25 deletions

5
NEWS
View file

@ -8,6 +8,11 @@ Any uppercase BUG_* names are modernish shell bug IDs.
- Fixed a bug introduced on 2020-08-09 that prevented '.' and '..' from
being completed when using file name tab completion.
- Fixed a bug on illumos that caused the chown builtin to fail with 'Invalid
argument' after failing to change the ownership of a file twice using an ID
that doesn't exist in /etc/passwd. (Note that the chown builtin is not
enabled by default.)
2021-12-11:
- Fixed two more crashing bugs that occurred if ksh received a signal (such