mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #1677] Make firejail print to stderr by default (instead of stdout) #1133
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#1133
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 @vn971 on GitHub (Dec 13, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1677
Steps to reproduce:
firejail --noprofile true 1>stdout 2>stderrExpected: file "stdout" is empty, file "stderr" contains firejail information (
Parent pid 4688, child pid 4689etc)Actually: file "stdout" contains the info, "stderr" is empty.
Printing additional non-necessary information to stderr by default is a common nice thing in many Linux programs, I suggest to embrace it.
Thoughts?
@Hocuri commented on GitHub (Dec 13, 2017):
Do you want to separate Firejail's information (Parent pid 4688, child pid 4689 etc) from the sandboxed process' stdout? Maybe there could be an option to toggle this extra information off and just print errors and warnings to stderr.
The disadvantage of stderr is: As far as I know it is assumed that the message is urgent and it is printed without buffering, although I do not know how bad this is on modern computers.
@vn971 commented on GitHub (Dec 13, 2017):
@Hocceruser what would be the problem to print 2 lines without buffering?
Currently, firejail has the
--quietoption, which will remove such info. (Example use case for--quietis when firejail-ed program output is fed to another tool.) Writing to stderr would fix most usages of--quietas a bonus.@Hocuri commented on GitHub (Dec 14, 2017):
Ah yes, I did not see this, sorry.
When I run firejai firefox it is about 10 lines output (6
Reading profile... lines plus 4 lines of other info) but I still do not know if this is a problem.Would there be any advantage of stderr over stdout apart from not having to write
--quiet?@vn971 commented on GitHub (Dec 14, 2017):
@Hocceruser yes, as I wrote in the issue description.. It's the standard approach to logging/printing on Linux. It allows firejail-ed program output to be used by other tools, while still not discarging the information.
Just see how all other programs print their "logs" as well as their "primary output".
@reinerh commented on GitHub (Dec 14, 2017):
Isn't stderr supposed to be used for errors? And stdout for normal informational output?
@Ferroin commented on GitHub (Dec 14, 2017):
@reinerh It really depends on what you are talking about. If you're designing a program that's supposed to only be used interactively and will never be involved in a shell pipeline, then yes that's the standard practice. The moment you start talking about non-interactive or pipeline usage though, the standard becomes printing everything except actual program output on stderr (note that in this case, logged messages are not actual program output), and once you're talking about a wrapper program like
firejail(or more concretely looking at existing examples, likeparallel,socksify,datefudge,fakeroot, and similar), everything that isn't from the wrapped program has to go to stderr so that you don't interfere with the output of the wrapped program.@Hocceruser I'm pretty sure there's no such 'rule' about having no buffering on stderr (at least, if there is, it's not part of the ANSI C standard, and I'm pretty sure it's not part of C89 or C99 either). The only practical difference lies in handling of redirection in the shell (you can more easily redirect stdout than stderr, and stdout is what gets captured to be sent to the next stage in a pipeline). The whole original point was to segregate output being sent to another program with informational output, but back then informational output only meant errors, thus the usage of the name 'stderr'.
@startx2017 commented on GitHub (Dec 15, 2017):
I've replaced all related printf calls with a fmessage() function call (implemented in util.c) and from there we can send all of them to stdout or stderr. I would go for stderr, @Ferroin makes a good point.
commit:
c59a19848d@netblue30 commented on GitHub (Dec 18, 2017):
Let's keep it as stderr, thanks @startx2017