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

Cannot lock file on lustre filesystem #3666

Closed
ghost opened this issue Feb 7, 2017 · 26 comments · Fixed by #3671
Closed

Cannot lock file on lustre filesystem #3666

ghost opened this issue Feb 7, 2017 · 26 comments · Fixed by #3671

Comments

@ghost
Copy link

ghost commented Feb 7, 2017

When I tried to install Cargo and Rust under a lustre filesystem using rustup I got the following error after trying to build a simple crate:

$ cargo run
error: failed to lock file: ~/simple_crate/Cargo.lock

Caused by:
  Function not implemented (os error 38)

It would be nice to let Cargo handle missing flock() by not locking? (durka42)

@alexcrichton
Copy link
Member

Sounds good to me! I believe the relevant support would go here. Would you be interested in sending a PR for this?

@ghost
Copy link
Author

ghost commented Feb 7, 2017

I would need some mentoring, but sure!

@alexcrichton
Copy link
Member

Sure yeah I'd be happy to help! I think you'll basically want to add a clause like the existing one for OSX except which matches the error code coming out of libc. I don't know precisely what 38 is but you can likely find what it is in the libc crate.

@alexcrichton
Copy link
Member

Hm not sure I understand, can you elaborate?

@ghost
Copy link
Author

ghost commented Feb 7, 2017

I'm not sure how to start

@alexcrichton
Copy link
Member

Oh sure yeah, so to start out you'll want to compile from source to ensure that's working. After that you can likely run cargo test to ensure all tests are passing.

Once that's all taken care of you can toy around modifying the relevant match block and see if that fixes tests for you.

If that's all working, then you can send a PR!

@ghost
Copy link
Author

ghost commented Feb 7, 2017

ok i found 38

https://doc.rust-lang.org/libc/x86_64-unknown-linux-gnu/libc/constant.ENOSYS.html

so it would be something like

#[cfg(target_os = "linux")]
Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => return Ok(()),

@alexcrichton
Copy link
Member

Ah yeah that looks right! (for a constant to check against)

@ghost
Copy link
Author

ghost commented Feb 7, 2017

That would be enough? or there is something else to be done?

Someone told me that it would be nice to check the filesystem, but I'm not sure how to do it

@alexcrichton
Copy link
Member

In theory that's it, but you may want to test out the cargo binary locally to ensure you don't get the same error

@ghost
Copy link
Author

ghost commented Feb 7, 2017

Ok, I have a logistical problem. I cannot build Cargo because it needs a previous rustc/cargo installation and it wont build because the filesystem cannot lock files

#3437

@alexcrichton
Copy link
Member

Heh that would indeed cause problems! Could you build it in /tmp perhaps which may not be the same filesystem?

@ghost
Copy link
Author

ghost commented Feb 7, 2017

Almost there. However the cargo registry is still in my home folder on lustre, how can I change this path?

@alexcrichton
Copy link
Member

Oh you can probably do CARGO_HOME=/tmp/cargo

@ghost
Copy link
Author

ghost commented Feb 8, 2017

It failed:

note: /usr/bin/ld: /tmp/make_temp/cargo/target/release/deps/libopenssl_sys-59e7705a3169e032.rlib(s23_meth.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/tmp/make_temp/cargo/target/release/deps/libopenssl_sys-59e7705a3169e032.rlib: could not read symbols: Bad value
collect2: ld returned 1 exit status

@alexcrichton
Copy link
Member

It seems that somehow you've picked up a statically linked version of OpenSSL as opposed to a dynamic version. You wouldn't happen to know why, would you?

@ghost
Copy link
Author

ghost commented Feb 8, 2017

I had to compile it myself, let me recompile it with ./config shared

@ghost
Copy link
Author

ghost commented Feb 8, 2017

Ok. I had to compile openssl and download the cmake binaries to make this work. I can build cargo correctly, but some test fail randomly. This is what i've been doing

https://gist.github.com/z1mvader/9185f4a8f18adefe516d63b4b338469a

I'll work on this tomorrow

@ghost
Copy link
Author

ghost commented Feb 8, 2017

Ok, there is a pattern on the random failures of tests. Everytime one of them fails. This error appears somewhere:

thread 'rustc' panicked at '/buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc/session/filesearch.rs:157: failed to get realpath: No such file or directory (os error 2)', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc/session/mod.rs:784

durka42 on irc suggested that it might be because everything is stored at /tmp, so after moving some stuff outside /tmp, it passed all tests.

I tried building and running some simple crates with this fork and it worked :) I'm gonna PR

bors added a commit that referenced this issue Feb 9, 2017
trying to fix unimplemented flock under linux

It fixes #3666
@bors bors closed this as completed in #3671 Feb 9, 2017
@ghost
Copy link
Author

ghost commented Apr 27, 2017

hey I just tested cargo on the same filesystem and this still happens, any suggestions?

@alexcrichton
Copy link
Member

Does the proposed fix not work?

@ghost
Copy link
Author

ghost commented Apr 27, 2017

Apparently not, but when I PR the fix it worked compiling cargo from source

@alexcrichton
Copy link
Member

The code is still there, so I'm not sure :(

@ghost
Copy link
Author

ghost commented Apr 27, 2017

Ok i just rechecked:

error: failed to write ~/some_crate/Cargo.lock

Caused by:
  failed to lock file: ~/some_crate/Cargo.lock

Caused by:
  Function not implemented (os error 38)

According to the libc docs, libc::ENOSYS is 38.

Am I missing something?

@alexcrichton
Copy link
Member

Are you sure the version of Cargo you're using has the fix?

@ghost
Copy link
Author

ghost commented Apr 28, 2017

I hate myself, yeah I forgot to set nightly as default. Thanks Alex

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 a pull request may close this issue.

1 participant