mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3356] Terminal control codes in progress messages should be optional #2107
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2107
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rdiez on GitHub (Apr 15, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3356
Firejail outputs some terminal control codes when printing information:
------8<------8<------8<------
$ firejail --noprofile sh -c "echo a"
^[]0;firejail sh -c echo a ^Ga
Parent pid 21368, child pid 21369
Parent is shutting down, bye...
------8<------8<------8<------
Note the "^[]0;" at the beginning: Those are escape characters for some terminal. And the same with "^Ga" at the end.
I do not know what the codes are for. They do not seem to colourise the ouput, which is what applications usually do with such control codes.
Such "garbage" shows up in log files and is unsightly. The first reaction is suspicion of data corruption.
Firejail should at least check whether STDOUT is a terminal before outputting such colour or terminal codes.
Other tools like Git offer more control, see for example:
git -c color.ui=always status
I suggest implementing an option like command "ls" does:
------8<------8<------8<------
--color[=WHEN]
colorize the output; WHEN can be 'always' (default if omitted), 'auto', or 'never'; more info below
Using color to distinguish file types is disabled both by default and with --color=never. With --color=auto, ls emits color codes only when standard output is connected to a
terminal. The LS_COLORS environment variable can change the settings. Use the dircolors command to set it.
------8<------8<------8<------
This issue was mentioned first in bug #3354.
I have tested this with the latest Firejail release version 0.9.62.
@smitsohu commented on GitHub (Aug 28, 2020):
For some reason I cannot reproduce, but it has been reported before.
Suspect:
5014a434e5/src/firejail/env.c (L160-L162)@rusty-snake commented on GitHub (Aug 28, 2020):
@smitsohu If they are printed to the terminal your can't see they, try to
firejail --noprofile true | lessorfirejail --noprofile true > foo && vim foo.@smitsohu commented on GitHub (Aug 28, 2020):
@rusty-snake Thanks, now I have it!
That code in env.c is indeed the reason for this artifact. As it doesn't make sense to inject escape sequences if stdout is not a terminal, I agree that a minimal fix should check this first.
@smitsohu commented on GitHub (Aug 29, 2020):
Thanks for reporting the bug!