diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-07-09 14:45:17 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-07-09 16:25:53 +0100 |
commit | 166121d66d38a3f6584222a03558493c1a23de72 (patch) | |
tree | 97190dd6a94a926f4eca4bac43be5c1220f48e93 | |
parent | a04897e74b24b59ed2a212d967f3698f08fec438 (diff) |
dgit: Regularise patch filenames, and defend against funny commit subjects
* Do not specified patch names which look like series filenames
* When we invent a filename based on a commit message, add ".patch".
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rw-r--r-- | Debian/Dgit.pm | 3 | ||||
-rw-r--r-- | debian/changelog | 3 | ||||
-rwxr-xr-x | dgit | 2 | ||||
-rwxr-xr-x | tests/tests/quilt | 4 |
4 files changed, 9 insertions, 3 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index ba1c288..dcecbd1 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -50,7 +50,7 @@ BEGIN { git_get_ref git_for_each_ref git_for_each_tag_referring is_fast_fwd $package_re $component_re $deliberately_re - $distro_re $versiontag_re + $distro_re $versiontag_re $series_filename_re $branchprefix initdebug enabledebug enabledebuglevel printdebug debugcmd @@ -69,6 +69,7 @@ our $deliberately_re = "(?:TEST-)?$package_re"; our $distro_re = $component_re; our $versiontag_re = qr{[-+.\%_0-9a-zA-Z/]+}; our $branchprefix = 'dgit'; +our $series_filename_re = qr{(?:^|\.)series(?!\n)$}s; # policy hook exit status bits # see dgit-repos-server head comment for documentation diff --git a/debian/changelog b/debian/changelog index 5d78d25..7900c92 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,9 @@ dgit (3.12~) unstable; urgency=medium Important bugfixes to dgit: * Pass --no-renames to git diff-tree -z, avoiding potential trouble. + * Defend against commit subject lines which would generate patches which + look like series files, etc. Involves adding .patch to all generated + patch filenames. -- @@ -5274,6 +5274,7 @@ sub quiltify ($$$$) { die "contains unexpected slashes\n" if m{//} || m{/$}; die "contains leading punctuation\n" if m{^\W} || m{/\W}; die "contains bad character(s)\n" if m{[^-a-z0-9_.+=~/]}i; + die "is series file\n" if m{$series_filename_re}o; die "too long" if length > 200; }; return $_ unless $@; @@ -5312,6 +5313,7 @@ sub quiltify ($$$$) { $patchname =~ y/-a-z0-9_.+=~//cd; $patchname =~ s/^\W/x-$&/; $patchname = substr($patchname,0,40); + $patchname .= ".patch"; } if (!defined $patchdir) { $patchdir = ''; diff --git a/tests/tests/quilt b/tests/tests/quilt index 1a921b3..f26f744 100755 --- a/tests/tests/quilt +++ b/tests/tests/quilt @@ -41,8 +41,8 @@ iteration diff <<END - debian/patches/series ups-topic/ups-yml -spongiform-upstream-new-file-incl-change -zorkmid-options-=-42 +spongiform-upstream-new-file-incl-change.patch +zorkmid-options-=-42.patch END for f in `cat debian/patches/series`; do |