-- missing error detection.
e2lib.rmtempfile(tmpfile_path)
+ -- Some tools (rsync) do not return an error code when skipping symlinks,
+ -- device files, etc. Thus we delete the tmp file here, let rsync do its
+ -- job, and detect the silent error condition when moving the file to its
+ -- final destination. Yes there is a race, but we take that chance over
+ -- missing error detection.
+ e2lib.rmtempfile(tmpfile_path)
+
-- fetch the file to the temporary directory
if u.transport == "http" or
u.transport == "https" then
elseif u.transport == "file" then
-- rsync "sourcefile" "destdir/destfile"
local argv = {}
+ table.insert(argv, "-L") -- copy symlinks as real files.
table.insert(argv, e2lib.join("/", u.path, location))
table.insert(argv, tmpfile_path)
rc, re = e2lib.rsync(argv)
if not rc then
return false, e:cat(re)
end
- -- file was moved away above, but remove it from the list anyway
- e2lib.rmtempfile(tmpfile_path)
return true
end