Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test-history: Skip test if we cannot read from the Journal #4764

Merged
merged 1 commit into from
Feb 21, 2022

Conversation

smcv
Copy link
Collaborator

@smcv smcv commented Feb 19, 2022

In some OS configurations, unprivileged users cannot read back messages
that they have written to the system log. This test cannot succeed if that
happens, so skip it.

In particular, if the Journal is only in-memory rather than persisted
to disk (as it was by default in Debian 10), then there are no per-user
Journal files, only a single system-wide Journal which requires privileges
to read.

@smcv smcv force-pushed the skip-test-history branch from 835abac to d43cd0e Compare February 19, 2022 17:30
@smcv
Copy link
Collaborator Author

smcv commented Feb 19, 2022

This fixes 8b05f6b "Add a unit test for the history command", so should be cherry-picked to 1.12.x and 1.10.x.

tests/test-history.sh Outdated Show resolved Hide resolved
@mwleeds
Copy link
Collaborator

mwleeds commented Feb 20, 2022

Looks good other than the comment above, and shellcheck doesn't find anything new to complain about. It's a little strange that journalctl needs --user but the logger command doesn't have a corresponding option, but I take your word for it that it's correct.

@smcv
Copy link
Collaborator Author

smcv commented Feb 20, 2022

It's a little strange that journalctl needs --user but the logger command doesn't have a corresponding option

journalctl doesn't technically need --user, but there seems no point in retrieving other uids' log messages even if we have permission to do so (in Debian that would mean membership in the systemd-journal or adm group, other distros will vary).

logger doesn't need a --user option, because what other uid would I be writing to the log as, if not my own?

@smcv smcv force-pushed the skip-test-history branch from d43cd0e to 876d38d Compare February 20, 2022 23:45
@smcv smcv requested a review from mwleeds February 20, 2022 23:46
@smcv smcv marked this pull request as draft February 21, 2022 00:27
In some OS configurations, unprivileged users cannot read back messages
that they have written to the system log. This test cannot succeed if that
happens, so skip it.

In particular, if the Journal is only in-memory rather than persisted
to disk (as it was by default in Debian 10), then there are no per-user
Journal files, only a single system-wide Journal which requires privileges
to read.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Fixes: 8b05f6b "Add a unit test for the history command"
@smcv smcv force-pushed the skip-test-history branch from 876d38d to 077dad2 Compare February 21, 2022 00:28
@smcv smcv marked this pull request as ready for review February 21, 2022 00:28
@mwleeds mwleeds merged commit 0deb80e into flatpak:main Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants