From: Ian Jackson Date: Wed, 10 Oct 2018 23:19:41 +0000 (+0100) Subject: dgit: Handle EXDEV when saving origs X-Git-Tag: archive/debian/8.0~48 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=0f37a4cac41ca7dc266b9e9af877f0d6a6e49b01 dgit: Handle EXDEV when saving origs Replace two link calls with rename_link_xf, and change the subsequent error handling to use $@ iff appropriate. Part of the fix to #910730. Signed-off-by: Ian Jackson --- diff --git a/dgit b/dgit index d443c34d..6b961f5d 100755 --- a/dgit +++ b/dgit @@ -2224,18 +2224,18 @@ sub generate_commits_from_dsc () { printdebug "considering saving $f: "; - if (link $f, $upper_f) { + if (rename_link_xf 1, $f, $upper_f) { printdebug "linked.\n"; - } elsif ((printdebug "($!) "), + } elsif ((printdebug "($@) "), $! != EEXIST) { - fail f_ "saving %s: %s", "$buildproductsdir/$f", $!; + fail f_ "saving %s: %s", "$buildproductsdir/$f", $@; } elsif (!$refetched) { printdebug "no need.\n"; - } elsif (link $f, "$upper_f,fetch") { + } elsif (rename_link_xf 1, $f, "$upper_f,fetch") { printdebug "linked (using ...,fetch).\n"; - } elsif ((printdebug "($!) "), + } elsif ((printdebug "($@) "), $! != EEXIST) { - fail f_ "saving %s: %s", "$buildproductsdir/$f,fetch", $!; + fail f_ "saving %s: %s", "$buildproductsdir/$f,fetch", $@; } else { printdebug "cannot.\n"; }