Util-Linux package development
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Santiago Vila <sanvila@unex.es>
Cc: kerolasa@gmail.com, Reuti <reuti@staff.uni-marburg.de>,
	util-linux <util-linux@vger.kernel.org>,
	ah-util-linux@debian.org, 794727@bugs.debian.org
Subject: Re: "mesg n" exits with error, even if the command is successful
Date: Tue, 11 Aug 2015 12:32:22 +0200	[thread overview]
Message-ID: <20150811103222.GA13425@ws.net.home> (raw)
In-Reply-To: <20150809191119.GA29884@cantor.unex.es>

On Sun, Aug 09, 2015 at 09:11:19PM +0200, Santiago Vila wrote:
> On Sun, Aug 09, 2015 at 06:58:15PM +0100, Sami Kerola wrote:
> > On 9 August 2015 at 18:19, Santiago Vila <sanvila@unex.es> wrote:
> > > On Sun, Aug 09, 2015 at 07:14:30PM +0200, Reuti wrote:
> > >> The profile is usually sourced. How does the error show up at the login prompt on Debian?
> > >
> > > The problem only happens in Debian testing and unstable, which I am not using yet.
> > > This is the original report which I received against base-files:
> > >
> > > https://bugs.debian.org/794727
> > 
> > Please notice the mesg(1) exit behavior is defined in POSIX
> > 
> > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/mesg.html
> > 
> > Unfortunately the standard does not appear to be explicit whether the
> > exit value should be set only when requesting write permissions
> > (running without arguments), or if also when setting the permissions.
> 
> So if the standard is not explicit about this, there is some room for
> interpretation. Would not be possible to interpret the standard in a
> sensible way?

I think Posix standard is pretty explicit:

EXIT STATUS
The following exit values shall be returned:
    0 Receiving messages is allowed.
    1 Receiving messages is not allowed.
    >1 An error occurred.


but you're asking for 0 also when 'n' or 'y' operants are specified.
For me it seems like complicated return code semantic...

> Hmm, but who does really need message *setting* to report exit codes?
> They make more harm than help.
> 
> As explained before, if I do "mesg y" I can reasonably think that
> messages will be enabled after that, and if I do "mesg n" I can
> reasonably think that messages will be disabled after that.
> 
> I don't need an exit code for that, unless I don't trust the program
> to do its job, and this is why I think there is no need to interpret
> the standard so strictly.

I think standard wants to keep the things simple and stupid without
any extra exceptions (another exit codes when executed with operants).

BTW, you can use "mesg $SOMETHING_FROM_USER" and then return code
maybe an elegant way how to interpret user's input without parsing
$SOMETHING_FROM_USER.  (The current mesg implementation supporst
rpmatch().)

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  parent reply	other threads:[~2015-08-11 10:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-09 15:04 "mesg n" exits with error, even if the command is successful Santiago Vila
2015-08-09 17:14 ` Reuti
2015-08-09 17:19   ` Santiago Vila
2015-08-09 17:58     ` Sami Kerola
2015-08-09 19:11       ` Santiago Vila
2015-08-09 20:56         ` Reuti
2015-08-11 10:32         ` Karel Zak [this message]
2015-08-11 11:57           ` Santiago Vila

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=20150811103222.GA13425@ws.net.home \
    --to=kzak@redhat.com \
    --cc=794727@bugs.debian.org \
    --cc=ah-util-linux@debian.org \
    --cc=kerolasa@gmail.com \
    --cc=reuti@staff.uni-marburg.de \
    --cc=sanvila@unex.es \
    --cc=util-linux@vger.kernel.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