public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
To: "Michał Górny" <mgorny@gentoo.org>
Cc: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH] acct-user.eclass: include exit status in death message
Date: Sun, 25 Jun 2023 15:15:12 -0500	[thread overview]
Message-ID: <ZJigUHO-FpfHSdPK@dj3ntoo> (raw)
In-Reply-To: <4a863d6015c54ecbe9f098999158ed6c1be1511c.camel@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 1186 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-06-25 20:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-25 17:51 [gentoo-dev] [PATCH] acct-user.eclass: include exit status in death message Mike Gilbert
2023-06-25 18:52 ` Michał Górny
2023-06-25 20:15   ` Oskari Pirhonen [this message]
2023-06-25 22:15   ` Mike Gilbert
2023-06-26  2:00     ` Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZJigUHO-FpfHSdPK@dj3ntoo \
    --to=xxc3ncoredxx@gmail.com \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=mgorny@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox