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 homedir error handling for 1020+ character usernames #22457

Merged
merged 1 commit into from
Jun 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/path.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function homedir()
if rc == 0
resize!(buf, sz[])
return String(buf)
elseif rc == UV_ENOBUFS
elseif rc == Base.UV_ENOBUFS
resize!(buf, sz[] - 1)
else
error("unable to retrieve home directory")
Expand Down
12 changes: 12 additions & 0 deletions test/path.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,15 @@ test_relpath()
# Test type stability
@test isa(joinpath("a", "b"), String)
@test isa(joinpath(abspath("a"), "b"), String)

# homedir
let var = is_windows() ? "USERPROFILE" : "HOME",
MAX_PATH = is_windows() ? 240 : 1020
for i = 0:9
local home = " "^MAX_PATH * "123456789"[1:i]
@test withenv(var => home) do
homedir()
end == home
end
@test isabspath(withenv(homedir, var => nothing))
end