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

Ref #22457
(cherry picked from commit 8c1adc8)
  • Loading branch information
vtjnash authored and ararslan committed Sep 14, 2017
1 parent 96ddec8 commit 464079a
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
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
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 464079a

Please sign in to comment.