Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Hh/no errors #166

Merged
merged 2 commits into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.5.4"

[deps]
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[compat]
Expand Down
2 changes: 1 addition & 1 deletion src/BinaryProvider.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module BinaryProvider

using Libdl
using Libdl, Logging

# Utilities for controlling verbosity
include("LoggingUtils.jl")
Expand Down
10 changes: 8 additions & 2 deletions src/PlatformEngines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ function probe_symlink_creation(dest::AbstractString)
link_path *= "1"
end

loglevel = Logging.min_enabled_level(current_logger())
try
disable_logging(Logging.Warn)
symlink("foo", link_path)
return true
catch e
Expand All @@ -128,6 +130,7 @@ function probe_symlink_creation(dest::AbstractString)
end
rethrow(e)
finally
disable_logging(loglevel-1)
rm(link_path; force=true)
end
end
Expand Down Expand Up @@ -267,8 +270,11 @@ function probe_platform_engines!(;verbose::Bool = false)
# Windows 10 now has a `tar` but it needs the `-f -` flag to use stdin/stdout
# The Windows 10 tar does not work on substituted drives (`subst U: C:\Users`)
# If a drive letter is part of the filename, then tar spits out a warning on stderr:
# "tar: Removing leading drive letter from member names" - but it works properly
tarListing = read(pipeline(`$tar_cmd -cf - $tmpfile`, `$tar_cmd -tvf -`), String)
# "tar: Removing leading drive letter from member names"
# Therefore we cd to tmpdir() first
cd(tempdir()) do
tarListing = read(pipeline(`$tar_cmd -cf - $(basename(tmpfile))`, `$tar_cmd -tvf -`), String)
end
# obtain the text of the line before the filename
m = match(Regex("((?:\\S+\\s+)+?)$tmpfile"), tarListing)[1]
# count the number of words before the filename
Expand Down
5 changes: 3 additions & 2 deletions src/Products.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ function locate(lp::LibraryProduct; verbose::Bool = false,
if platforms_match(platform, platform_key_abi())
if isolate
# Isolated dlopen is a lot slower, but safer
if success(`$(Base.julia_cmd()) -e "import Libdl; Libdl.dlopen(\"$dl_path\")"`)
dl_esc_path = replace(dl_path, "\\"=>"\\\\")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, we gotta be careful with this one; I don't think this will work on every platform. What is more likely to work is to replace(dl_path, "\\"=>"/"), since forward-slash (even though it's not the default returned by tools on Windows) should work everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not expect that any other platform than windows will have a\ in the path.
Moreover, I just copied the idea of line 395

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked whether your proposal would work on windows, and interestingly it does pass the test. But ImageMagick does not build with "\\"=>"/" whereas it does with "\\" => "\\\\".
So I would encourage someone with a Linux machine to also test whether ImageMagick builds successfully with my version.

if success(`$(Base.julia_cmd()) -e "import Libdl; Libdl.dlopen(\"$(dl_esc_path)\")"`)
return dl_path
end
else
Expand Down Expand Up @@ -341,7 +342,7 @@ function locate(fp::FileProduct; platform::Platform = platform_key_abi(),
mappings["\$$(var)"] = string(val)
mappings["\${$(var)}"] = string(val)
end

expanded = fp.path
for (old, new) in mappings
expanded = replace(expanded, old => new)
Expand Down