From e73bb32aa5cee8a188eca332c192a8feef4c03a6 Mon Sep 17 00:00:00 2001 From: Stefan Karpinski Date: Thu, 1 Oct 2020 18:33:07 -0400 Subject: [PATCH] PlatformEngines: stop disabling logging during symlink test (#2062) 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). --- Project.toml | 3 +-- src/PlatformEngines.jl | 18 ++++-------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Project.toml b/Project.toml index 44226c4341..cd60cef404 100644 --- a/Project.toml +++ b/Project.toml @@ -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." @@ -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" diff --git a/src/PlatformEngines.jl b/src/PlatformEngines.jl index b2eca54b68..0197bf5823 100644 --- a/src/PlatformEngines.jl +++ b/src/PlatformEngines.jl @@ -3,7 +3,7 @@ # 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 @@ -11,11 +11,6 @@ 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. @@ -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