Skip to content

Commit

Permalink
fix homedir error handling for 1020+ character usernames
Browse files Browse the repository at this point in the history
or 250 characters for a certain broken OS
  • Loading branch information
vtjnash committed Jun 23, 2017
1 parent 236e486 commit 8c1adc8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
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

0 comments on commit 8c1adc8

Please sign in to comment.