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

Fix a bug where last part of the key is discarded and replaced with default filename #17

Merged
merged 4 commits into from
Feb 7, 2017

Conversation

nsmaciej
Copy link
Contributor

@nsmaciej nsmaciej commented Feb 6, 2017

Before 1.0.0, this line used to say

Some(name) if name.len() > 0 => {

With 1.0.0 it was changed to if name.is_empty() which caused the filename part of the path to be discarded instead of prepending it to PREFS_FILE_EXTENSION

@nsmaciej
Copy link
Contributor Author

nsmaciej commented Feb 6, 2017

I wasn't expecting any failures. Looks like something to do with app_dir. When test_save_load fails you can see it:

Err(Directory(Io(Error { repr: Os { code: 183, message: "Cannot create a file when that file already exists." } })))

I cannot reproduce the error. Works on my mac™.

@andybarron
Copy link
Owner

Hahaaaa that is a terrible bug, whoops. Thanks for doing this.

As for the raciness, is there a way to make Cargo run tests in series rather than parallel? It would be nice not to glob all our tests together...

@nsmaciej
Copy link
Contributor Author

nsmaciej commented Feb 7, 2017

I realised it must be a race condition. I remove the second test in my fork and it got rid of the problem.

I don't think globing the test cases is a good idea either, it feels like just hiding the problem.

It might be possible to special case this using the error codes. It also feels quite std bug-worthy, "file already exists" doesn't feel like something DirBuilder should be returning.

@nsmaciej
Copy link
Contributor Author

nsmaciej commented Feb 7, 2017

There is a bug already opened for this rust-lang/rust#33707.
I feel it's ok then to glob the test case for now and release a new version.

If that's ok with you I'll clean this up and make it use gen_sample_prefs again.

@andybarron
Copy link
Owner

andybarron commented Feb 7, 2017 via email

@nsmaciej
Copy link
Contributor Author

nsmaciej commented Feb 7, 2017

I think this looks fine

@andybarron
Copy link
Owner

Wonderful, merging now. I'll publish 1.0.1 and yank 1.0.0 as soon as I get the chance.

@andybarron andybarron merged commit 0e64ee2 into andybarron:master Feb 7, 2017
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