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

Travis build fails: "Read-only file system" #46

Closed
rschmitt opened this issue Jan 9, 2017 · 7 comments
Closed

Travis build fails: "Read-only file system" #46

rschmitt opened this issue Jan 9, 2017 · 7 comments

Comments

@rschmitt
Copy link

rschmitt commented Jan 9, 2017

Heatseeker has a build script that collects some build-time metadata and writes a version.rs file. After migrating to trust, Travis builds (except for builds targeting Darwin) are failing with the following error:

error: failed to run custom build command for `heatseeker v1.5.0 (file:///project)`
process didn't exit successfully: `/target/debug/build/heatseeker-77dc6031b5733332/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 30, message: "Read-only file system" } }', ../src/libcore/result.rs:837

The custom build command never caused any problems before, and somehow it's still not causing problems for Darwin builds. I'm not sure if the problem is in the trust template, my adaptation of it, or Travis itself.

@japaric
Copy link
Owner

japaric commented Jan 9, 2017

This is because cross, which uses Docker under the hood (only for Linux), mounts the Cargo project as read only. That's why the build script fails.

Build scripts shouldn't modify the src directory as that can mess up Cargo "freshness" check which in turn can cause consecutive cargo builds to always rebuild the crate.

The "proper" way to pass version information is to write to a file in the target directory (OUT_DIR) and then include_str that into your source.

@rschmitt
Copy link
Author

Thanks, this saved me a lot of time. I noticed that git rev-parse no longer runs on the Linux builds; I assume this means that cross's Docker images don't include git?

@japaric
Copy link
Owner

japaric commented Jan 10, 2017

this means that cross's Docker images don't include git?

They don't. I think they should, to support this pattern.

@maccoda
Copy link

maccoda commented May 6, 2017

I am getting the same error but mine is due to the integration test I am running which produces a file as the output. I have tried writing outside of the source directory using ../out and for this I do not have permission, then writing into target as the build does still returned Read-only file system. So I was just wondering is there a way to actually test this in the Docker image or will I just not be able to run these tests on this CI?

@japaric
Copy link
Owner

japaric commented May 6, 2017

... which produces a file as the output.

You should be writing this file to a temporary directory with delete-on-drop semantics. That's the standard-ish practice. Check the tempdir crate.

@maccoda
Copy link

maccoda commented May 6, 2017

Thanks for that. Will give that a go.

@hoodie
Copy link

hoodie commented Jul 4, 2017

hey, do we want to add git to the Dockerfiles? I kinda already did the work hoodie/cross@a6eed71

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

No branches or pull requests

4 participants