clear_console should be moved to ncurses-bin

Bug #39068 reported by Sebastian Kapfer
18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
Triaged
Low
Unassigned

Bug Description

clear_console does not work on a pty (xterm, ssh) without being root.

sk@nexus(~)> clear_console
clear_console: terminal is not a console
sk@nexus(~)> strace clear_console 2>&1 | grep open\(
open("/etc/ld.so.cache", O_RDONLY) = 3
open("/lib/libncurses.so.5", O_RDONLY) = 3
open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
open("/lib/tls/i686/cmov/libdl.so.2", O_RDONLY) = 3
open("/dev/tty", O_RDWR) = 3
open("/dev/tty0", O_RDWR) = -1 EACCES (Permission denied)
open("/dev/tty0", O_RDONLY) = -1 EACCES (Permission denied)
open("/dev/tty0", O_WRONLY) = -1 EACCES (Permission denied)
open("/dev/console", O_RDWR) = -1 EACCES (Permission denied)
open("/dev/console", O_RDONLY) = -1 EACCES (Permission denied)
open("/dev/console", O_WRONLY) = -1 EACCES (Permission denied)
sk@nexus(~)> ll /dev/tty0 /dev/console
crw------- 1 root root 5, 1 2006-04-11 01:09 /dev/console
crw-rw---- 1 root root 4, 0 2006-04-11 01:09 /dev/tty0
sk@nexus(~)> tty
/dev/pts/2
sk@nexus(~)> ll /dev/pts/2
crw--w---- 1 sk tty 136, 2 2006-04-11 02:06 /dev/pts/2

Is clear_console supposed to be working in a pty? If yes, then it fails at that. If no, I'm still a little puzzled why this hack was added to the shell package and not /sbin/getty (or /usr/bin/clear?).

Revision history for this message
Matthias Klose (doko) wrote : Re: [Bug 39068] clear_console does not work on a pty without superuser permissions

Sebastian Kapfer schrieb:
> Is clear_console supposed to be working in a pty?

no.

> If yes, then it fails at that. If no, I'm still a little puzzled why
this hack was added to the shell package and not /sbin/getty (or
/usr/bin/clear?).

yes, it could be added to the ncurses-bin package.

Revision history for this message
Matthias Klose (doko) wrote :

should be coordinated with Debian

Changed in bash:
status: Unconfirmed → Confirmed
Mika Fischer (zoop)
Changed in bash:
status: Confirmed → Triaged
Revision history for this message
Rolf Leggewie (r0lf) wrote :

There hasn't been any activity in this ticket for a while. Is this still a problem in Jaunty or Karmic?

Changed in bash (Ubuntu):
status: Triaged → Incomplete
Revision history for this message
Matthias Klose (doko) wrote : Re: [Bug 39068] clear_console should be moved to ncurses-bin

Rolf, please stop doing this! This bug report has a status `triaged'. So
somebody did look at it. If nothing did change, then why do you set it to
`incomplete'? Is it just to collect some karma? If you take this serious, then
it shouldn't it a problem at all to verify the status yourself. So please revert
all these status changes from a status of `triaged' to `incomplete' unless you
did check them yourself.

Not very amused.

On 04.08.2009 14:43, Rolf Leggewie wrote:
> There hasn't been any activity in this ticket for a while. Is this
> still a problem in Jaunty or Karmic?
>
> ** Changed in: bash (Ubuntu)
> Status: Triaged => Incomplete
>

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Matthias Klose wrote:
> Rolf, please stop doing this!

Stop doing what? Helping out?

Bugs do get forgotten, so revisiting them doesn't make sense to you?
Even after three-and-a-half years? It makes more sense to alienate
supporters with ridiculous speculations? Interesting, interesting indeed.

I do regularly and in a timely manner look after bugs I set to
incomplete, check my record and take a pill. If they're still current,
I'll set them back to the state they were in before, so WTH are you
whining about here?

> Not very amused.
>

Dito.

Revision history for this message
Sebastian Kapfer (caci) wrote :

Well, the inconsistency is _trivial_ to reproduce, it doesn't make any sense to set it to incomplete. Just compare clear_console vs. sudo clear_console in a pty.

Revision history for this message
Sebastian Kapfer (caci) wrote :

BTW, I'm still convinced that this inconistency should be fixed, one way or the other. The best probably is to make "clear" do everything "clear_console" does.

Kees Cook (kees)
Changed in bash (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
Brian Murray (brian-murray) wrote :

I've taken the time to recreate the bug as described in the test case in Karmic Koala, what will be the 9.10 release of Ubuntu, and one does still need to be root to use clear_console on a pty. Subsequently, I am changing the bug's state back to it's original one of Triaged.

Sebastian - it might be worthwhile to forward this bug report to Debian.

Revision history for this message
Andrew Cranwell (andrew-cranwell) wrote :

This probably relates to the group that owns /dev/tty0 and /dev/console - I noticed that some of the servers I administer would exhibit this behaviour and others wouldn't. On my 9.04 desktop they're owned by root, but on an 8.04 server they're owned by dialout, and I was a member of the dialout group on the servers that clear_console is working on (because I installed those servers).

What I can't work out is why there needs to be a difference between clear ("clear the terminal screen", which always works) and clear_console ("clear the console", which attempts to switch virtual terminals and fails) - is there a difference on a serial console?

Revision history for this message
Sebastian Kapfer (caci) wrote :

No. The only difference between clear and clear_console ist that clear_console gets rid of the scrollback buffer of Linux VTs. For Xterms, serial consoles etc. there is no difference as far as I know.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.