Skip to content

Commit 2525c69

Browse files
authored
Merge pull request #4205 from JuliaLang/backports-release-1.10
Backports release 1.10
2 parents 0b3af45 + 653993d commit 2525c69

File tree

4 files changed

+37
-15
lines changed

4 files changed

+37
-15
lines changed

src/Artifacts.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,14 @@ function _mv_temp_artifact_dir(temp_dir::String, new_path::String)::Nothing
8484
err = ccall(:jl_fs_rename, Int32, (Cstring, Cstring), temp_dir, new_path)
8585
if err 0
8686
# rename worked
87-
chmod(new_path, filemode(dirname(new_path)))
87+
new_path_mode = filemode(dirname(new_path))
88+
if Sys.iswindows()
89+
# If this is Windows, ensure the directory mode is executable,
90+
# as `filemode()` is incomplete. Some day, that may not be the
91+
# case, there exists a test that will fail if this is changes.
92+
new_path_mode |= 0o111
93+
end
94+
chmod(new_path, new_path_mode)
8895
set_readonly(new_path)
8996
return
9097
else

src/GitTools.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,6 @@ function clone(io::IO, url, source_path; header=nothing, credentials=nothing, kw
9797
printpkgstyle(io, :Cloning, header === nothing ? "git-repo `$url`" : header)
9898
bar = MiniProgressBar(header = "Fetching:", color = Base.info_color())
9999
fancyprint = can_fancyprint(io)
100-
callbacks = if fancyprint
101-
LibGit2.Callbacks(
102-
:transfer_progress => (
103-
@cfunction(transfer_progress, Cint, (Ptr{LibGit2.TransferProgress}, Any)),
104-
bar,
105-
)
106-
)
107-
else
108-
LibGit2.Callbacks()
109-
end
110100
fancyprint && start_progress(io, bar)
111101
if credentials === nothing
112102
credentials = LibGit2.CachedCredentials()
@@ -121,6 +111,16 @@ function clone(io::IO, url, source_path; header=nothing, credentials=nothing, kw
121111
end
122112
return LibGit2.GitRepo(source_path)
123113
else
114+
callbacks = if fancyprint
115+
LibGit2.Callbacks(
116+
:transfer_progress => (
117+
@cfunction(transfer_progress, Cint, (Ptr{LibGit2.TransferProgress}, Any)),
118+
bar,
119+
)
120+
)
121+
else
122+
LibGit2.Callbacks()
123+
end
124124
mkpath(source_path)
125125
return LibGit2.clone(url, source_path; callbacks=callbacks, credentials=credentials, kwargs...)
126126
end

src/utils.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
# "Precompiling" is the longest operation
2+
const pkgstyle_indent = textwidth(string(:Precompiling))
13

24
function printpkgstyle(io::IO, cmd::Symbol, text::String, ignore_indent::Bool=false; color=:green)
3-
indent = textwidth(string(:Precompiling)) # "Precompiling" is the longest operation
4-
ignore_indent && (indent = 0)
5-
printstyled(io, lpad(string(cmd), indent), color=color, bold=true)
6-
println(io, " ", text)
5+
indent = ignore_indent ? 0 : pkgstyle_indent
6+
@lock io begin
7+
printstyled(io, lpad(string(cmd), indent), color=color, bold=true)
8+
println(io, " ", text)
9+
end
710
end
811

912
function linewrap(str::String; io = stdout_f(), padding = 0, width = Base.displaysize(io)[2])

test/artifacts.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,4 +825,16 @@ end
825825
end
826826
end
827827

828+
if Sys.iswindows()
829+
@testset "filemode(dir) non-executable on windows" begin
830+
mktempdir() do dir
831+
touch(joinpath(dir, "foo"))
832+
@test !isempty(readdir(dir))
833+
# This technically should be true, the fact that it's not is
834+
# a wrinkle of libuv, it would be nice to fix it and so if we
835+
# do, this test will let us know.
836+
@test filemode(dir) & 0o001 == 0
837+
end
838+
end
839+
end
828840
end # module

0 commit comments

Comments
 (0)