From: Ian Jackson Date: Sat, 15 Jul 2017 22:15:54 +0000 (+0100) Subject: dgit import: Defend against broken symlinks in .. X-Git-Tag: archive/debian/3.12~15 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a68894875ce0d11261882f62b2aa28a6e3eed673;p=dgit.git dgit import: Defend against broken symlinks in .. Provide a special error message if lstat succeeds but lstat fails. This is not hypothetical - currently even dgit import ../blah.dsc can generate this situation ! Signed-off-by: Ian Jackson --- diff --git a/debian/changelog b/debian/changelog index 1d912c02..784269c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ dgit (3.12~) unstable; urgency=medium * Defend against commit subject lines which would generate patches which look like series files, etc. Involves adding .patch to all generated patch filenames. + * dgit import: Defend against broken symlinks in .. -- diff --git a/dgit b/dgit index 51975965..a68bf19c 100755 --- a/dgit +++ b/dgit @@ -6349,7 +6349,10 @@ END foreach my $fi (@dfi) { my $f = $fi->{Filename}; my $here = "../$f"; - next if lstat $here; + if (lstat $here) { + next if stat $here; + fail "lstat $here works but stat gives $! !"; + } fail "stat $here: $!" unless $! == ENOENT; my $there = $dscfn; if ($dscfn =~ m#^(?:\./+)?\.\./+#) {