Skip to content

Make std::env::current_dir work for path names longer than 2048 bytes on non-Windows #26896

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

Merged
merged 3 commits into from
Jul 10, 2015

Conversation

tbu-
Copy link
Contributor

@tbu- tbu- commented Jul 8, 2015

(On Windows, it works already.)

@rust-highfive
Copy link
Contributor

r? @huonw

(rust_highfive has picked a reviewer for you, use r? to override)

@huonw
Copy link
Member

huonw commented Jul 8, 2015

r? @alexcrichton

@rust-highfive rust-highfive assigned alexcrichton and unassigned huonw Jul 8, 2015
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This function actually primarily exists on Windows due to the utf-16 to wtf-8 conversion because it allows us to use a u16 stack buffer first and avoid the extra heap allocation unless necessary. On Unix, however, we shouldn't need this function because the same byte buffer filled in by the OS can be converted directly into an OsString.

@tbu-
Copy link
Contributor Author

tbu- commented Jul 9, 2015

@alexcrichton Addressed your comments.

Ok(PathBuf::from(OsString::from_bytes(buf).unwrap()))
} else {
let error = io::Error::last_os_error();
if error.raw_os_error().unwrap() == libc::ERANGE {
Copy link
Member

Choose a reason for hiding this comment

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

While unwrap() will always succeed, it's not idiomatic, so let's compare against Some(libc::ERANGE)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Abandoning sanity-checking for idomatic code is not something I'd like to do, but since you insist, I'll change it.

@tbu-
Copy link
Contributor Author

tbu- commented Jul 10, 2015

@alexcrichton Addressed all of your comments despite being unhappy with one.

@alexcrichton
Copy link
Member

@bors: r+ b83ec47

bors added a commit that referenced this pull request Jul 10, 2015
(On Windows, it works already.)
@bors
Copy link
Collaborator

bors commented Jul 10, 2015

⌛ Testing commit b83ec47 with merge fe0b5c0...

@bors
Copy link
Collaborator

bors commented Jul 10, 2015

💔 Test failed - auto-win-gnu-64-opt

@alexcrichton
Copy link
Member

@bors: retry

On Fri, Jul 10, 2015 at 10:54 AM, bors notifications@github.com wrote:

[image: 💔] Test failed - auto-win-gnu-64-opt
http://buildbot.rust-lang.org/builders/auto-win-gnu-64-opt/builds/637


Reply to this email directly or view it on GitHub
#26896 (comment).

@bors
Copy link
Collaborator

bors commented Jul 10, 2015

@bors bors merged commit b83ec47 into rust-lang:master Jul 10, 2015
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.

5 participants