From 9acb31a971d4f653836bbcf07410f51d3f80dbdd Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 16 Aug 2015 13:30:01 +0100 Subject: [PATCH 1/1] If a .orig in .. is a symlink, hardlink the link target into our private unpack directory, rather than the link itself (since latter won't work if the symlink is relative). --- Debian/Dgit.pm | 12 +++++++++++- debian/changelog | 3 +++ dgit | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index ac44b9ab..fa853741 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -17,7 +17,8 @@ BEGIN { @ISA = qw(Exporter); @EXPORT = qw(setup_sigwarn debiantag server_branch server_ref - stat_exists fail ensuredir executable_on_path + stat_exists link_ltarget + fail ensuredir executable_on_path waitstatusmsg failedcmd cmdoutput cmdoutput_errok git_rev_parse git_get_ref git_for_each_ref @@ -219,6 +220,15 @@ sub cmdoutput { return $d; } +sub link_ltarget ($$) { + my ($old,$new) = @_; + lstat $old or return undef; + if (-l _) { + $old = cmdoutput qw(realpath --), $old; + } + link $old, $new or die "link $old $new: $!"; +} + sub git_rev_parse ($) { return cmdoutput qw(git rev-parse), "$_[0]~0"; } diff --git a/debian/changelog b/debian/changelog index 577b81a0..1c5fbc4d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ dgit (1.3) unstable; urgency=low * In option parser test `@ARGV' not `length @ARGV'. Closes:#795710. + * If a .orig in .. is a symlink, hardlink the link target into our + private unpack directory, rather than the link itself (since latter + won't work if the symlink is relative). -- diff --git a/dgit b/dgit index 62cd0499..2d42f940 100755 --- a/dgit +++ b/dgit @@ -1382,7 +1382,7 @@ sub generate_commit_from_dsc () { my $f = $fi->{Filename}; die "$f ?" if $f =~ m#/|^\.|\.dsc$|\.tmp$#; - link "../../../$f", $f + link_ltarget "../../../$f", $f or $!==&ENOENT or die "$f $!"; @@ -2794,7 +2794,7 @@ END foreach my $f (<../../../../*>) { #/){ my $b=$f; $b =~ s{.*/}{}; next unless is_orig_file $b, srcfn $upstreamversion,''; - link $f, $b or die "$b $!"; + link_ltarget $f, $b or die "$b $!"; $dscaddfile->($b); } -- 2.30.2