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

chroot: handle the error when invalid user #7015

Merged
merged 1 commit into from
Dec 31, 2024

Conversation

sylvestre
Copy link
Contributor

Currently fails with:

2024-12-28T14:55:18.9330231Z thread 'main' panicked at src/uu/chroot/src/chroot.rs:284:46:
2024-12-28T14:55:18.9330718Z called `Result::unwrap()` on an `Err` value: Custom { kind: NotFound, error: "Not found: nobody:+65535" }
2024-12-28T14:55:18.9331305Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Currently fails with:
```
2024-12-28T14:55:18.9330231Z thread 'main' panicked at src/uu/chroot/src/chroot.rs:284:46:
2024-12-28T14:55:18.9330718Z called `Result::unwrap()` on an `Err` value: Custom { kind: NotFound, error: "Not found: nobody:+65535" }
2024-12-28T14:55:18.9331305Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@sylvestre
Copy link
Contributor Author

Does not fix the issue but not a rust panic anymore:


2024-12-28T21:54:58.5869925Z FAIL: tests/id/setgid
2024-12-28T21:54:58.5870108Z =====================
2024-12-28T21:54:58.5870214Z 
2024-12-28T21:54:58.5870379Z chroot --skip-chdir --user=$NON_ROOT_USERNAME:+$gp1 --groups='' / \
2024-12-28T21:54:58.5870824Z chroot --skip-chdir --user=$NON_ROOT_USERNAME:+$gp1 --groups='' / \
2024-12-28T21:54:58.5871341Z chroot: no such user: nobody:+65535
2024-12-28T21:54:58.5871738Z --- exp	2024-12-28 21:54:55.879759300 +0000
2024-12-28T21:54:58.5872161Z +++ out	2024-12-28 21:54:55.880759301 +0000
2024-12-28T21:54:58.5872547Z @@ -1 +0,0 @@
2024-12-28T21:54:58.5872815Z -65535
2024-12-28T21:54:58.5873114Z chroot: no such user: nobody:+65535

@sylvestre sylvestre marked this pull request as ready for review December 28, 2024 21:57
if let Ok(result) = run_ucmd_as_root(&ts, &["--user=nobody:+65535", dir, "pwd"]) {
result
.failure()
.stderr_contains("no such user: nobody:+65535");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the error message deliberately different from the one of GNU chroot?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it is for a next step
I am just removing the panic

@cakebaker cakebaker merged commit a3b7a08 into uutils:main Dec 31, 2024
62 of 63 checks passed
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