mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #5873] Logging macros and improving error/warning messages #3116
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#3116
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 @kmk3 on GitHub (Jun 28, 2023).
Original GitHub issue: https://github.com/netblue30/firejail/issues/5873
Background
This PR was opened to improve
errExit()messages:However,
errExitis mostly only used when basic libc calls fail (as it usesperror(3p)to print the errno message); most warning/error messages areprinted manually and do not contain the file path. Example:
Proposal
So how about adding more logging macros?
Examples:
Main differences between functions:
log_infodoes not include the file path (for readability)log_errorandlog_fatalexit the programlog_fatalusesperror(3p)to print the reason (likeerrExit)I'm not sure about the format of info and below, so the first steps would be to
replace manual warning/error messages (
fprintfcalls) with the log functionsso that they include the file path and function in the message; how the
functions operate internally (format, destination, etc) could be improved
later.
Also add
--loglevel=to control which messages get printed:--loglevel=[trace|debug|info|warning|error|fatal]--quietwould map to--loglevel=error--debugwould map to--loglevel=debugor--loglevel=traceThe default would be
info.As for the last item, considering the amount of things that
--debugprints(such as the assembly dumps of seccomp filters), it seems more like a trace
option, so maybe it would make sense to change the messages that are currently
inside
if (arg_debug)to uselog_trace()and then deprecate--debug.Relates to:
@kmk3 commented on GitHub (Aug 15, 2025):
As mentioned in #3325, it may be unclear that some error/warning messages come
from firejail, which could be resolved by adding a prefix with the program name
(and maybe PID).
Example:
This could go in
errExit/fwarning.Note: Something similar is already used in preproc.c:
Which was added in the following PR:
Also, something like
errExitxandfwarningx(similarly toerr(3)/errx(3)) could be added, in the cases wherestrerror(errno)is not intendedto be printed.