LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-20-2013, 10:07 AM   #1
digitalyuki
LQ Newbie
 
Registered: Jun 2013
Location: New York City, NY
Distribution: Slackware
Posts: 2

Rep: Reputation: Disabled
Bug - All fonts in console become garbled after using cat on a gzip-compressed file?


Hi all,

I've dabbled with Linux in the past, but recently I'm undertaking a more comprehensive-like Linux education, and decided to install Slackware (14) on a 2008-era eee PC (1000HE to be exact, retrofitted with a 60GB OCZ SSD and 2GB RAM).

While doing a few n00b linux tutorials, I ran into a weird bug.... when I gzip compressed a text file (ex: "gzip text.txt"), and then subsequently ran a 'cat' command on that compressed file (ex. "cat text.txt.gz"), the resulting output was, understandably, garbage, but thereafter the terminal font also became garbled in a similar fashion, and while all commands ran the best I could tell, I could never get the original terminal fonts back (to readable English) until I restarted the machine...

Anyone else know about this behavior / can replicate this? Is this a weird bug, or specific to my machine, or what? This is for the most recent (as of 6/19/2013) Slackware 14, from a 32-bit DVD ISO with full installation (downloaded from the slackware site). This is while in the console, before any windows X environments / GUI.

Thanks! Just sharing.
 
Old 06-20-2013, 10:11 AM   #2
roreilly
Member
 
Registered: Aug 2006
Location: Canada
Distribution: Debian, Slackware
Posts: 106

Rep: Reputation: 28
This is not a bug, this is expected behaviour.

Read this: http://www.cyberciti.biz/tips/bash-fix-the-display.html

The article offers some solutions on resetting your tty.
 
1 members found this post helpful.
Old 06-20-2013, 10:38 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
This is not a bug. The cat command writes the file to stdout as is, which causes the shell to interpret some of output as control characters that can indeed do weird things.
To get the normal behavior back just use the command
Code:
reset
If necessary just type it in blindly.
 
1 members found this post helpful.
Old 06-20-2013, 11:21 AM   #4
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Like said above, it is not a bug.

Use 'most' or 'less' instead to view binary files on the command line.
 
1 members found this post helpful.
Old 06-20-2013, 02:55 PM   #5
digitalyuki
LQ Newbie
 
Registered: Jun 2013
Location: New York City, NY
Distribution: Slackware
Posts: 2

Original Poster
Rep: Reputation: Disabled
Very helpful!

Thanks for the answers folks, that was quick and helpful, ever post contributed something useful and informative.

Most interesting that the binary characters are interpreted as commands in cat. I wonder what it actually does...

Thanks!
 
Old 06-20-2013, 04:41 PM   #6
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
Quote:
Originally Posted by digitalyuki View Post
Thanks for the answers folks, that was quick and helpful, ever post contributed something useful and informative.

Most interesting that the binary characters are interpreted as commands in cat. I wonder what it actually does...

Thanks!
technically not as commands, but rather 'escape sequences'
http://en.wikipedia.org/wiki/Escape_sequence
in short, an escape sequences are control codes that direct how the terminal displays, and errant data in binary files can be mis-interpreted as escape sequences, jazzing things up,
it gets even WORSE if you try an PRINT a binary file, trust me on this, just don't, it's ugly
 
Old 06-20-2013, 06:56 PM   #7
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,548

Rep: Reputation: 8557Reputation: 8557Reputation: 8557Reputation: 8557Reputation: 8557Reputation: 8557Reputation: 8557Reputation: 8557Reputation: 8557Reputation: 8557Reputation: 8557
Quote:
Originally Posted by frieza View Post
technically not as commands, but rather 'escape sequences'
http://en.wikipedia.org/wiki/Escape_sequence
in short, an escape sequences are control codes that direct how the terminal displays, and errant data in binary files can be mis-interpreted as escape sequences, jazzing things up,
it gets even WORSE if you try an PRINT a binary file, trust me on this, just don't, it's ugly
However, escape sequences can cause something else in the file to be interpreted as a command entered at the command line. It's easy to make a file that when catted will execute any command(s) as the user that catted the file.
 
2 members found this post helpful.
Old 06-23-2013, 03:52 PM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by volkerdi View Post
However, escape sequences can cause something else in the file to be interpreted as a command entered at the command line. It's easy to make a file that when catted will execute any command(s) as the user that catted the file.
I think that depends on the terminal emulator. In the past it was to load an indent string into the terminal, then followed by requesting an ident by escape sequences.

I don't believe all terminal emulators support setting the identification string.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gzip: stdin: invalid compressed data--format violated ftp ascii transfer sridhar_dct3 Linux - Software 10 07-28-2012 02:25 PM
gzip: stdin: invalid compressed data--format violated; tar: Unexpected EOF in archive mcgao07 Linux - Newbie 1 05-25-2012 01:44 PM
cat /path/to/openMosix-2.4.16-3.gz | gzip -d | patch -p1 -l what does it mean? Niceman2005 Linux - Newbie 2 02-24-2005 08:34 PM
gzip compressed files jamaso Linux - Newbie 4 01-13-2002 04:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration