From: Ian Jackson Date: Sat, 15 Jul 2017 22:27:29 +0000 (+0100) Subject: dgit import: Avoid making broken symlinks in .. X-Git-Tag: archive/debian/3.12~13 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=51a525fdc552ff2d5f388c47b29c38784f2e5fa4;hp=83af484ee17f5d18ee6a161b01aa0b546d8943cb dgit import: Avoid making broken symlinks in .. In most cases we could carry on and fail later. But creating a broken symlink is undesirable, particularly because it might prevent dgit from trying to make a non-broken symlink pointing elsewhere in future (or prevent dget from downloading the file). Even worse, if the dsc is in .. but an absolute path was provided, we would make a circular symlink! Signed-off-by: Ian Jackson --- diff --git a/debian/changelog b/debian/changelog index eeaeb1ff..ad43d412 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ dgit (3.12~) unstable; urgency=medium patch filenames. * dgit import: Defend against broken symlinks in .. * dgit import: Right error message for missing files in .. + * dgit import: Avoid making broken symlinks in .. -- diff --git a/dgit b/dgit index 944de859..dd3b31c7 100755 --- a/dgit +++ b/dgit @@ -6365,6 +6365,8 @@ END $there =~ s#/+[^/]+$## or fail "import $dscfn requires ../$f, but it does not exist"; $there .= "/$f"; + my $test = $there =~ m{^/} ? $there : "../$there"; + stat $test or fail "import $dscfn requires $test, but: $!"; symlink $there, $here or fail "symlink $there to $here: $!"; progress "made symlink $here -> $there"; # print STDERR Dumper($fi);