Specs failing when run as superuser #13217
Labels
kind:bug
A bug in the code. Does not apply to documentation, specs, etc.
topic:infrastructure
topic:stdlib:specs
Some specs in the
std_spec
fail when running as superuser. They expect some operations to be forbidden, which only applies unprivileged users.This is problematic because in some environments (for example our docker images), the default user is root.
For example, running
make std_spec
in acrystallang/crystal
docker container results in two specs failing:These specs should either be disabled when run as superuser, or ideally modified to work regardless of the superuser status.
process_spec.cr:428
tests thatProcess.chmod
fails with the correct error message when the executing user is not root. It runs a new process, so it could theoretically execute that process as a non-root user. This requires the existence of a non-root user, though.file_spec.cr:871
tests that a file with file mode 0 is unreadable. Apparently this isn't true for the superuser. I don't see any other solution to run this test except for dropping root.It seems like both these specs require the existence of a non-root user, which isn't necessarily the case and would just be another reliance on the execution environment as being run as unprivileged user.
So maybe the best solution would be to skip these tests when the executing user is root.
The text was updated successfully, but these errors were encountered: