On Sun, Jun 25, 2023 at 20:52:53 +0200, Michał Górny wrote:
> I think a better approach would be to always include $? in die messages
> in Portage.
> 

I'm not sure the exit code is useful in the general case. Something like
rm(1) seems to give the same exit code despite failing for different
reasons:

    $ rm /tmp/root_owned 
    rm: remove write-protected regular empty file '/tmp/root_owned'? y
    rm: cannot remove '/tmp/root_owned': Operation not permitted
    $ echo $?
    1
    $ rm /tmp/nonexistent
    rm: cannot remove '/tmp/nonexistent': No such file or directory
    $ echo $?
    1

On the other hand, groupadd(8) (at least) seems to have useful exit
codes. From the man page:

    EXIT VALUES
           The groupadd command exits with the following values:
    
           0
               success
    
           2
               invalid command syntax
    
           3
               invalid argument to option
    
           4
               GID is already used (when called without -o)
    
           9
               group name is already used
    
           10
               can't update group file

- Oskari

Attachment: signature.asc
Description: PGP signature

Reply via email to