Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15070

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

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Eli Schwartz <eschwartz@archlinux.org>
Newsgroups gnu.bash.bug
Subject Re: command "cat /etc/localtime" breaks output on tty-terminal
Date Sun, 23 Jun 2019 13:00:28 -0400
Lines 137
Approved bug-bash@gnu.org
Message-ID <mailman.810.1561309255.10840.bug-bash@gnu.org> (permalink)
References <20190623123102.fa9221e067faed8874ea7fc2@gmx.de> <CANaoh6++Y25Ug+TKww3+WvbvOer8=jpGLLZohwWUyjvoBRFUrQ@mail.gmail.com> <20190623141810.d3ba78fb13821008b401f45f@gmx.de> <f9de320d-caee-1544-abf4-ac1bdaff515a@archlinux.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="EVGWKhwlT32FovmpTOAEnpKsnfrDvvh4g"
X-Trace usenet.stanford.edu 1561309255 19301 209.51.188.17 (23 Jun 2019 17:00:55 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1561309233; bh=FtzUpEwLr+HBffk8GX5yLQ0NUrzbuNviG4KAI1tjn0M=; h=Subject:To:References:From:Date:In-Reply-To; b=gCm0rCy0sc0d9njD1/saul8zS4zoioNFhFJz8Cd0jIQtCNKR7YhUvLUoC/ds8xA2P Rx+z6mNIETFsYBgz9OWshg6dF5C0SppZ5y5J0jweNl0DqcgpCMyYad2OCG534x8Xqh NWS6iMs5mhTzxPghdrke61LoiJXsDJ5pvL7SdAz+rspa0xspproahkfUwzJKzGve4d HX3g63dM7FoxVoG7CG54fSQdyhGENLlKcyCggFG5abYuxyi2ed8OtImkz8rhPBFL1d 2acmjxcBGQMSgh1C3BLzdFE8bfNx8//kelKQwdJgUWlLoyoqqO7rb0eS1LCBV2pfFs jkR0C19/nKOJlx3DV/Qn04MLcJ8UJwLZsulCXDrfyFWEJl6cZ0pn1ZUz3PH2tBsUb7 FkXP/5yF81SvIlQpxGb8oRj1yyYmbZaqfBpGotPweKm/rIw6NLFEWpr3xNUg7gvEWk VnoMNH357YTbCMsbhbND6Nbjk34m5mV+IAkl47HVs/a9z7CBaQCpP7forfCInWEmPe VEzcDdAlx0+M/yzwAGkZQ/AnQU9cxsf3DmYaqsJUYmZge0wgysxdPjVR6kT/lVin2e wKs09hCcZaE31+0faH0+aGGvCHccSy2z5k+J+zROAP8e5m5/eAdEAtAXzjf2ZU6GkI n2PmCPHZ6ea25khSWzHsIA+k=
Openpgp preference=signencrypt
X-Clacks-Overhead GNU Terry Pratchett
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1
In-Reply-To <20190623141810.d3ba78fb13821008b401f45f@gmx.de>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 88.198.91.70
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <f9de320d-caee-1544-abf4-ac1bdaff515a@archlinux.org>
X-Mailman-Original-References <20190623123102.fa9221e067faed8874ea7fc2@gmx.de> <CANaoh6++Y25Ug+TKww3+WvbvOer8=jpGLLZohwWUyjvoBRFUrQ@mail.gmail.com> <20190623141810.d3ba78fb13821008b401f45f@gmx.de>
Xref csiph.com gnu.bash.bug:15070

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 6/23/19 8:18 AM, bitfreak25 wrote:
> On Sun, 23 Jun 2019 06:04:29 -0500
> Dennis Williamson <dennistwilliamson@gmail.com> wrote:
> 
>> On Sun, Jun 23, 2019, 5:31 AM bitfreak25 <bitfreak25@gmx.de> 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: <FILE>" to save to a file.

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: command "cat /etc/localtime" breaks output on tty-terminal Eli Schwartz <eschwartz@archlinux.org> - 2019-06-23 13:00 -0400

csiph-web