mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Rollup merge of #126917 - ferrocene:hoverbear/riscv64-inaccessible-temp-dir-resolution, r=jieyouxu
Disable rmake test `inaccessible-temp-dir` on riscv64
In https://github.com/rust-lang/rust/pull/126279 the `inaccessible-temp-dir` test was moved to rmake, I followed up with a 'fix' derived from https://github.com/rust-lang/rust/pull/126355 in https://github.com/rust-lang/rust/pull/126707.
That 'fix' was misguided and hiding the true issue of the linker being incorrect for `riscv64gc-unknown-linux-gnu` (addressed in https://github.com/rust-lang/rust/pull/126916).
Unfortunately, even with the linker fixed, this test doesn't work. I asked myself why this appeared to work on other platforms and investigated why. Both the containers for `armhf-gnu` and `riscv64gc` run their tests as `root` and have `NO_CHANGE_USER` set:
553a69030e/src/ci/docker/host-x86_64/disabled/riscv64gc-gnu/Dockerfile (L99)
This means the tests are run as `root`. As `root`, it's perfectly normal and reasonable to violate permission checks this way:
```bash
$ sudo mkdir scratch
$ sudo chmod o-w scratch
$ sudo mkdir scratch/backs
$
```
Because of this, this PR makes the test ignored on `riscv64gc` for now.
As an alternative, I believe the best long-term strategy would be to not run the tests as `root` for this job.
## Testing
> [!NOTE]
> `riscv64gc-unknown-linux-gnu` is a [**Tier 2 with Host Tools** platform](https://doc.rust-lang.org/beta/rustc/platform-support.html), all tests may not necessarily pass! This change should only ignore `inaccessible-temp-dir` and not affect other tests.
You can test out the job locally:
```sh
mv src/ci/docker/host-x86_64/disabled/riscv64gc-gnu src/ci/docker/host-x86_64/riscv64gc-gnu
DEPLOY=1 ./src/ci/docker/run.sh riscv64gc-gnu
```
This commit is contained in:
commit
3e6f6deddf
@ -13,13 +13,18 @@
|
||||
// use a directory with non-existing parent like `/does-not-exist/output`.
|
||||
// See https://github.com/rust-lang/rust/issues/66530
|
||||
|
||||
//@ ignore-riscv64
|
||||
// FIXME: The riscv build container runs as root, and can always write
|
||||
// into `inaccessible/tmp`. Ideally, the riscv64-gnu docker container
|
||||
// would use a non-root user, but this leads to issues with
|
||||
// `mkfs.ext4 -d`, as well as mounting a loop device for the rootfs.
|
||||
//@ ignore-arm
|
||||
// Reason: linker error on `armhf-gnu`
|
||||
//@ ignore-windows
|
||||
// Reason: `set_readonly` has no effect on directories
|
||||
// and does not prevent modification.
|
||||
|
||||
use run_make_support::{fs_wrapper, rustc, target, test_while_readonly};
|
||||
use run_make_support::{fs_wrapper, rustc, test_while_readonly};
|
||||
|
||||
fn main() {
|
||||
// Create an inaccessible directory.
|
||||
@ -28,7 +33,6 @@ fn main() {
|
||||
// Run rustc with `-Z temps-dir` set to a directory *inside* the inaccessible one,
|
||||
// so that it can't create `tmp`.
|
||||
rustc()
|
||||
.target(target())
|
||||
.input("program.rs")
|
||||
.arg("-Ztemps-dir=inaccessible/tmp")
|
||||
.run_fail()
|
||||
|
Loading…
Reference in New Issue
Block a user