Skip to content

Commit e74ce8a

Browse files
committed
less rewriting of symlinks
1 parent ab7ba5a commit e74ce8a

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/polymake/generate_deps_tree.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,18 @@ function full_artifact_dir(m::Module)
2424
end
2525
end
2626

27-
function force_symlink(source::AbstractString, target::AbstractString)
28-
tmpfile = tempname(dirname(target); cleanup=false)
29-
symlink(source, tmpfile)
30-
Base.Filesystem.rename(tmpfile, target)
27+
function force_symlink(target::AbstractString, link::AbstractString)
28+
# the rename operation below should be atomic and make sure the link always points
29+
# to a valid directory
30+
# but macos disagrees and sometimes reading files below this path fails with `EINVAL`
31+
# see also: http://www.weirdnet.nl/apple/rename.html
32+
# (it seems to be fixed on hfs+ but not on apfs...)
33+
# to reduce the frequency of this we only write the symlink if necessary
34+
# (note this does not fully avoid the error)
35+
islink(link) && readlink(link) == target && return
36+
tmpfile = tempname(dirname(link); cleanup=false)
37+
symlink(target, tmpfile)
38+
Base.Filesystem.rename(tmpfile, link)
3139
end
3240

3341
function prepare_deps_tree(targetdir::String)

src/polymake/type_setup.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ sub EdgeMap {
272272

273273
Map(String,String),
274274
Map(String,Int),
275+
Map(Int,String),
275276
Map(Int,Int),
276277
Map(Integer,Int),
277278
Map(Rational,Rational),

0 commit comments

Comments
 (0)