GNU bug report logs - #25692
[PATCH] sed fails testsuite/panic-tests when tty is not owned by current user

Previous Next

Package: sed;

Reported by: Kent Fredric <kentnl <at> gentoo.org>

Date: Sat, 11 Feb 2017 17:25:02 UTC

Severity: normal

Tags: fixed, patch

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kent Fredric <kentnl <at> gentoo.org>
To: bug-sed <at> gnu.org
Subject: [PATCH] sed fails testsuite/panic-tests when tty is not owned by
 current user
Date: Sun, 12 Feb 2017 01:45:27 +1300
[Message part 1 (text/plain, inline)]
If the tty is owned by a privileged user, and that privileged user is building
sed after changing UID, the state of the tty's may look as follows:

> tty
/dev/pts/9

> ls -la $(tty)
crw--w---- 1 root tty 136, 9 Feb 12 01:27 /dev/pts/9

> whoami
builder

> if [[ -r $(tty) ]]; then echo "readable"; else echo "not readable"; fi
not readable

This leads to the test producing the following diff:

FAIL: testsuite/panic-tests
===========================

--- exp-err-tty 2017-01-06 15:42:36.073141748 +1300
+++ err-tty     2017-01-06 15:42:36.086141949 +1300
@@ -1 +1 @@
-sed: couldn't edit X: is a terminal
+sed: can't read /dev/pts/3: Permission denied
FAIL testsuite/panic-tests.sh (exit status: 1)


And failing.

This failure makes sense however, and there's no sane way I know of to
make the terminal readable, other than demanding sed run the test
inside a pty it created.

So an effective workaround is just guard the test with a -r check
like it presently has for -w , because the tty dev can't be read for
sed to decide "its a tty" in this condition.

Tested patch that adds this trivial check attached.

Thanks.


---
Downstream Bug: https://bugs.gentoo.org/show_bug.cgi?id=604798
[sed-4.3-test-pty-readable.patch (text/x-patch, attachment)]
[Message part 3 (application/pgp-signature, inline)]

This bug report was last modified 8 years and 68 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.