From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: Sami Kerola <kerolasa@iki.fi>
Subject: [PATCH 00/12] pull: write(1) improvements
Date: Mon, 9 May 2016 22:27:16 +0100 [thread overview]
Message-ID: <1462829248-6935-1-git-send-email-kerolasa@iki.fi> (raw)
Hello,
Recent write(1) regression inspired me to have a look what is going on with
this source file. Here are the results of the inspection. I am pretty
confident most of the changes are quick and easy to review, with exception
of one - the last change. Let me explain a little bit closer.
Current messaging is fine assuming group ownership and setgid bit are set,
but if they are not then one will get misleading message about oneself not
having mesg(1) enabled (even if they would be). The difficult bit is how
should be fixed. I can think of three different options:
1) Match process effective gid with tty device file gid, and complain when
not matching. This is what I propose.
2) Use faccessat(3) to determine whether run time has effivice access to
tty path.
3) Perform the check at the time of stdout freopen(2), and fail with
permission denied when necessary.
Second option feels a bit pointless as the third option does exactly the
same, and one only has to delete code to make that to work. Main reason why
I like first option is that it gives hint how one ought to fix an issue.
Simple 'permission denied' is less obvious. Unfortunately the option 1 can
cause failure when write would have been possible due ownership of the tty
file - so in that sense option 2 is better. So where I'm getting at is that
there's good and bad sides in each of these options and it would be nice to
hear what others think is the best thing to do.
----------------------------------------------------------------
The following changes since commit 94af67f2aaaafce58f495b2415e534a0c2508332:
Merge branch 'no-fork' of https://github.com/terryburton/util-linux (2016-05-09 13:28:52 +0200)
are available in the git repository at:
git://github.com/kerolasa/lelux-utiliteetit.git write-improvements
for you to fetch changes up to 354f2ee527fe9d6f5d6dcd111af49b47469eaad6:
write: tell when effective gid and tty path group mismatch (2016-05-09 22:03:14 +0100)
----------------------------------------------------------------
Sami Kerola (12):
write: remove unused variable
write: get rid of function prototypes
write: remove pointless fileno(3) calls
write: set atime value in term_chk() only if needed
write: use xstrncpy() from strutils.h
write: run atexit() checks at the end of execution
write: add control structure to clarify what is going on
write: improve variable names
write: remove unnecessary utmp variables
write: make timestamp to be obviously just a clock time
write: improve coding style
write: tell when effective gid and tty path group mismatch
term-utils/write.c | 395 +++++++++++++++++++++++++++--------------------------
1 file changed, 199 insertions(+), 196 deletions(-)
--
2.8.2
next reply other threads:[~2016-05-09 21:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-09 21:27 Sami Kerola [this message]
2016-05-09 21:27 ` [PATCH 01/12] write: remove unused variable Sami Kerola
2016-05-09 21:27 ` [PATCH 02/12] write: get rid of function prototypes Sami Kerola
2016-05-09 21:27 ` [PATCH 03/12] write: remove pointless fileno(3) calls Sami Kerola
2016-05-09 21:27 ` [PATCH 04/12] write: set atime value in term_chk() only if needed Sami Kerola
2016-05-09 21:27 ` [PATCH 05/12] write: use xstrncpy() from strutils.h Sami Kerola
2016-05-09 21:27 ` [PATCH 06/12] write: run atexit() checks at the end of execution Sami Kerola
2016-05-09 21:27 ` [PATCH 07/12] write: add control structure to clarify what is going on Sami Kerola
2016-05-11 8:38 ` Karel Zak
2016-05-15 17:00 ` Sami Kerola
2016-05-09 21:27 ` [PATCH 08/12] write: improve variable names Sami Kerola
2016-05-09 21:27 ` [PATCH 09/12] write: remove unnecessary utmp variables Sami Kerola
2016-05-09 21:27 ` [PATCH 10/12] write: make timestamp to be obviously just a clock time Sami Kerola
2016-05-09 21:27 ` [PATCH 11/12] write: improve coding style Sami Kerola
2016-05-11 8:54 ` Karel Zak
2016-05-15 17:03 ` Sami Kerola
2016-05-09 21:27 ` [PATCH 12/12] write: tell when effective gid and tty path group mismatch Sami Kerola
2016-05-10 14:24 ` Benno Schulenberg
2016-05-10 19:37 ` Sami Kerola
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=1462829248-6935-1-git-send-email-kerolasa@iki.fi \
--to=kerolasa@iki.fi \
--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