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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25692 in the body.
You can then email your comments to 25692 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-sed <at> gnu.org:
bug#25692; Package sed. (Sat, 11 Feb 2017 17:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kent Fredric <kentnl <at> gentoo.org>:
New bug report received and forwarded. Copy sent to bug-sed <at> gnu.org. (Sat, 11 Feb 2017 17:25:02 GMT) Full text and rfc822 format available.

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)]

Information forwarded to bug-sed <at> gnu.org:
bug#25692; Package sed. (Sat, 11 Feb 2017 21:23:02 GMT) Full text and rfc822 format available.

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

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Kent Fredric <kentnl <at> gentoo.org>
Cc: 25692 <at> debbugs.gnu.org
Subject: Re: bug#25692: [PATCH] sed fails testsuite/panic-tests when tty is
 not owned by current user
Date: Sat, 11 Feb 2017 21:22:19 +0000
Hello Kent,

On Sun, Feb 12, 2017 at 01:45:27AM +1300, Kent Fredric wrote:

>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:
[...]
>FAIL: testsuite/panic-tests

Thank you for the report.

I'll look into it soon.


But before that:
>Downstream Bug: https://bugs.gentoo.org/show_bug.cgi?id=604798

sed-4.3 contained a bug which could lead to segfault,
and we've released sed-4.4 shortly after.

If you are involved in packaging sed for gentoo,
I highly recommend to upgrade.

Please see more details in a similar bugreport
we've submitted for debian:
https://bugs.debian.org/853864


regards,
- assaf




Information forwarded to bug-sed <at> gnu.org:
bug#25692; Package sed. (Wed, 22 Mar 2017 01:05:02 GMT) Full text and rfc822 format available.

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

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Kent Fredric <kentnl <at> gentoo.org>
Cc: 25692 <at> debbugs.gnu.org
Subject: Re: bug#25692: [PATCH] sed fails testsuite/panic-tests when tty is
 not owned by current user
Date: Wed, 22 Mar 2017 01:03:58 +0000
tag 25692 fixed
close 25692
stop


Hello,

On Sat, Feb 11, 2017 at 09:22:19PM +0000, Assaf Gordon wrote:
>Hello Kent,
>
>On Sun, Feb 12, 2017 at 01:45:27AM +1300, Kent Fredric wrote:
>
>>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:

Pushed here:
https://git.savannah.gnu.org/cgit/sed.git/commit/?id=b092d4a6c07b

Thanks,
- assaf




Added tag(s) fixed. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 22 Mar 2017 01:05:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 25692 <at> debbugs.gnu.org and Kent Fredric <kentnl <at> gentoo.org> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 22 Mar 2017 01:05:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 19 Apr 2017 11:24:05 GMT) Full text and rfc822 format available.

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.