#8993 closed bug (fixed)
garbled ls -l output when piped with less
Reported by: | Prasad | Owned by: | leavengood |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | Applications/Terminal | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
Running "ls -l | less" shows lot of garbled output.
Attaching screenshot.
Attachments (2)
Change History (12)
by , 12 years ago
Attachment: | garbled-ls-outut.jpeg added |
---|
comment:1 by , 12 years ago
Component: | Preferences → Applications/Terminal |
---|---|
Owner: | changed from | to
comment:2 by , 12 years ago
by , 12 years ago
Attachment: | 0001-bash_profile-set-ls-color-alias-to-auto.patch added |
---|
comment:3 by , 12 years ago
patch: | 0 → 1 |
---|
comment:5 by , 12 years ago
Version: | R1/alpha3 → R1/Development |
---|
comment:6 by , 12 years ago
Also semi-related to this, is track ticket #4494 which has a possible fix for poor default colors for ls --color
comment:8 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | in-progress → closed |
Patch applied in hrev44676. Thanks!
comment:10 by , 12 years ago
As explained in #9044 this kind of customization should go in a specific /etc/profile.d/ script.
Note:
See TracTickets
for help on using tickets.
in the list of default aliases "ls" is aliased as
In the source file of ls "src/bin/coreutils/src/ls.c"
Therefore, when ls is used with --color argument, it is always treated as ls --color="always", thus it ignores the isatty(STDOUT_FILENO) call and sets print_with_color = 1
As a result, even though "ls" output is redirected to a file, all the coloring scheme is still applied, resulting garbled characters added into the file.
So the fix is