command "cat /etc/localtime" breaks output on tty-terminal

2019-06-23 Thread bitfreak25
OS: Arch Linux 5.1.12-arch1-1-ARCH (tty1)
Bash-Version: 5.0.7(1)-release
localization: de_DE.UTF-8 UTF-8
keymap: de-latin1-nodeadkeys

Description:
The command "cat /etc/localtime" was called in a tty-terminal. After that some 
characters will be printed incorrectly (mostly "cyrillic" chars instead of the 
correct ones). The typed chars seems to be handled correctly (e.g. calling 
"exit") but the output is broken at this point. This behaviour is reproducible 
on my other PC with Debian Stable (Bash-Version in Debian: 4.4-5), so it seems 
to be a old bug. Changing to another tty or rebooting the OS will fix this 
behaviour until the command is called again.

Kind regards,
bitfreak



Re: command "cat /etc/localtime" breaks output on tty-terminal

2019-06-23 Thread Dennis Williamson
On Sun, Jun 23, 2019, 5:31 AM bitfreak25  wrote:

> OS: Arch Linux 5.1.12-arch1-1-ARCH (tty1)
> Bash-Version: 5.0.7(1)-release
> localization: de_DE.UTF-8 UTF-8
> keymap: de-latin1-nodeadkeys
>
> Description:
> The command "cat /etc/localtime" was called in a tty-terminal. After that
> some characters will be printed incorrectly (mostly "cyrillic" chars
> instead of the correct ones). The typed chars seems to be handled correctly
> (e.g. calling "exit") but the output is broken at this point. This
> behaviour is reproducible on my other PC with Debian Stable (Bash-Version
> in Debian: 4.4-5), so it seems to be a old bug. Changing to another tty or
> rebooting the OS will fix this behaviour until the command is called again.
>
> Kind regards,
> bitfreak
>
>


/etc/localtime is symlinked to a file that contains time zone data. If you
enter the command

file -L /etc/localtime

you'll see that that's the case. It contains data that's not meant to be
displayed including control characters which cause the effect you observed.
If you cat any so-called binary file such as this you are likely to see the
same kind of thing happen. Entering the

reset

command in the affected terminal will correct the problem after it occurs.


Re: command "cat /etc/localtime" breaks output on tty-terminal

2019-06-23 Thread bitfreak25
On Sun, 23 Jun 2019 06:04:29 -0500
Dennis Williamson  wrote:

> On Sun, Jun 23, 2019, 5:31 AM bitfreak25  wrote:
>
> > OS: Arch Linux 5.1.12-arch1-1-ARCH (tty1)
> > Bash-Version: 5.0.7(1)-release
> > localization: de_DE.UTF-8 UTF-8
> > keymap: de-latin1-nodeadkeys
> >
> > Description:
> > The command "cat /etc/localtime" was called in a tty-terminal. After that
> > some characters will be printed incorrectly (mostly "cyrillic" chars
> > instead of the correct ones). The typed chars seems to be handled correctly
> > (e.g. calling "exit") but the output is broken at this point. This
> > behaviour is reproducible on my other PC with Debian Stable (Bash-Version
> > in Debian: 4.4-5), so it seems to be a old bug. Changing to another tty or
> > rebooting the OS will fix this behaviour until the command is called again.
> >
> > Kind regards,
> > bitfreak
> >
> >
>
>
> /etc/localtime is symlinked to a file that contains time zone data. If you
> enter the command
>
> file -L /etc/localtime
>
> you'll see that that's the case. It contains data that's not meant to be
> displayed including control characters which cause the effect you observed.
> If you cat any so-called binary file such as this you are likely to see the
> same kind of thing happen. Entering the
>
> reset
>
> command in the affected terminal will correct the problem after it occurs.

I kind of thought that this could be the reason. It also happens with
"cat /dev/urandom" which is stopped by [STRG] + [C].

It seems to be a very small bug thats only breaks the output with an
unusual command and there are already 3 workarounds. But in my opinion
it should be fixed some time as it isn't the correct behaviour like
doing it with a gui-terminal e.g. xfce4-terminal.

Kind regards,
bitfreak



Re: command "cat /etc/localtime" breaks output on tty-terminal

2019-06-23 Thread Dennis Williamson
On Sun, Jun 23, 2019, 7:18 AM bitfreak25  wrote:

> On Sun, 23 Jun 2019 06:04:29 -0500
> Dennis Williamson  wrote:
>
> > On Sun, Jun 23, 2019, 5:31 AM bitfreak25  wrote:
> >
> > > OS: Arch Linux 5.1.12-arch1-1-ARCH (tty1)
> > > Bash-Version: 5.0.7(1)-release
> > > localization: de_DE.UTF-8 UTF-8
> > > keymap: de-latin1-nodeadkeys
> > >
> > > Description:
> > > The command "cat /etc/localtime" was called in a tty-terminal. After
> that
> > > some characters will be printed incorrectly (mostly "cyrillic" chars
> > > instead of the correct ones). The typed chars seems to be handled
> correctly
> > > (e.g. calling "exit") but the output is broken at this point. This
> > > behaviour is reproducible on my other PC with Debian Stable
> (Bash-Version
> > > in Debian: 4.4-5), so it seems to be a old bug. Changing to another
> tty or
> > > rebooting the OS will fix this behaviour until the command is called
> again.
> > >
> > > Kind regards,
> > > bitfreak
> > >
> > >
> >
> >
> > /etc/localtime is symlinked to a file that contains time zone data. If
> you
> > enter the command
> >
> > file -L /etc/localtime
> >
> > you'll see that that's the case. It contains data that's not meant to be
> > displayed including control characters which cause the effect you
> observed.
> > If you cat any so-called binary file such as this you are likely to see
> the
> > same kind of thing happen. Entering the
> >
> > reset
> >
> > command in the affected terminal will correct the problem after it
> occurs.
>
> I kind of thought that this could be the reason. It also happens with
> "cat /dev/urandom" which is stopped by [STRG] + [C].
>
> It seems to be a very small bug thats only breaks the output with an
> unusual command and there are already 3 workarounds. But in my opinion
> it should be fixed some time as it isn't the correct behaviour like
> doing it with a gui-terminal e.g. xfce4-terminal.
>
> Kind regards,
> bitfreak
>


It's not a bug. It's expected behavior. If a useful sequence of control
characters is output - useful things happen. If you take that away then
lots of stuff doesn't work.

Solution? Don't cat non-text files to the terminal.

>


Re: command "cat /etc/localtime" breaks output on tty-terminal

2019-06-23 Thread Eli Schwartz
On 6/23/19 8:18 AM, bitfreak25 wrote:
> On Sun, 23 Jun 2019 06:04:29 -0500
> Dennis Williamson  wrote:
> 
>> On Sun, Jun 23, 2019, 5:31 AM bitfreak25  wrote:
>>
>>> OS: Arch Linux 5.1.12-arch1-1-ARCH (tty1)
>>> Bash-Version: 5.0.7(1)-release
>>> localization: de_DE.UTF-8 UTF-8
>>> keymap: de-latin1-nodeadkeys
>>>
>>> Description:
>>> The command "cat /etc/localtime" was called in a tty-terminal. After that
>>> some characters will be printed incorrectly (mostly "cyrillic" chars
>>> instead of the correct ones). The typed chars seems to be handled correctly
>>> (e.g. calling "exit") but the output is broken at this point. This
>>> behaviour is reproducible on my other PC with Debian Stable (Bash-Version
>>> in Debian: 4.4-5), so it seems to be a old bug. Changing to another tty or
>>> rebooting the OS will fix this behaviour until the command is called again.
>>>
>>> Kind regards,
>>> bitfreak
>>>
>>>
>>
>>
>> /etc/localtime is symlinked to a file that contains time zone data. If you
>> enter the command
>>
>> file -L /etc/localtime
>>
>> you'll see that that's the case. It contains data that's not meant to be
>> displayed including control characters which cause the effect you observed.
>> If you cat any so-called binary file such as this you are likely to see the
>> same kind of thing happen. Entering the
>>
>> reset
>>
>> command in the affected terminal will correct the problem after it occurs.
> 
> I kind of thought that this could be the reason. It also happens with
> "cat /dev/urandom" which is stopped by [STRG] + [C].
> 
> It seems to be a very small bug thats only breaks the output with an
> unusual command and there are already 3 workarounds. But in my opinion
> it should be fixed some time as it isn't the correct behaviour like
> doing it with a gui-terminal e.g. xfce4-terminal.

All GUI terminals in my experience display the correct behavior. The
correct behavior is to:
- faithfully emit the output you requested
- thereby emit control characters which the terminal cannot properly
  parse
- break terminal output in some cases, depending on the control
  characters in question

Some programs, unlike cat, try to protect you from this effect. See for
example,

$ curl file:///etc/localtime
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: " to save to a file.

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature