Skip to content

Commit

Permalink
PlatformEngines: stop disabling logging during symlink test (#2062)
Browse files Browse the repository at this point in the history
Closes #2061. Should be followed up by changing `symlink` not to
warn but only throw an error (whose error message can include a
warning to hint that symlinks don't work on Windows).
  • Loading branch information
StefanKarpinski authored Oct 1, 2020
1 parent 9818e43 commit e73bb32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
3 changes: 1 addition & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "Pkg"
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b780"
keywords = ["package management"]
license = "MIT"
desc = "The next-generation Julia package manager."
Expand All @@ -10,7 +10,6 @@ Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Expand Down
18 changes: 4 additions & 14 deletions src/PlatformEngines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
# Content in this file is extracted from BinaryProvider.jl, see LICENSE.method

module PlatformEngines
using SHA, Logging
using SHA
import ...Pkg: Pkg, TOML, pkg_server, depots1
using Base.BinaryPlatforms

export probe_platform_engines!, parse_7z_list, parse_tar_list, verify,
download_verify, unpack, package, download_verify_unpack,
list_tarball_files, list_tarball_symlinks

# To reduce method invalidation, it's best to call a logging method that
# avoids introduction of backedges.
# See https://github.com/JuliaLang/julia/pull/35714
const logging_level = isdefined(Base.CoreLogging, :_invoked_min_enabled_level) ? Base.CoreLogging._invoked_min_enabled_level : Base.CoreLogging.min_enabled_level

# In this file, we setup the `gen_download_cmd()`, `gen_unpack_cmd()` and
# `gen_package_cmd()` functions by providing methods to probe the environment
# and determine the most appropriate platform binaries to call.
Expand Down Expand Up @@ -126,21 +121,16 @@ function probe_symlink_creation(dest::AbstractString)
# Build arbitrary (non-existent) file path name
link_path = joinpath(dest, "binaryprovider_symlink_test")
while ispath(link_path)
link_path *= "1"
link_path *= rand('A':'Z')
end

loglevel = logging_level(current_logger())
try
disable_logging(Logging.Warn)
symlink("foo", link_path)
return true
catch e
if isa(e, Base.IOError)
return false
end
rethrow(e)
isa(e, Base.IOError) || rethrow(e)
return false
finally
disable_logging(loglevel-1)
rm(link_path; force=true)
end
end
Expand Down

0 comments on commit e73bb32

Please sign in to comment.