summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2022-09-02 23:17:26 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2022-09-03 18:12:47 +0100
commit2286b68e5b63348a3e1d18b054152852801a5791 (patch)
tree85f5c6f49ce5ab09113a0bbf7d03bdfeb9651047
parent021c3ce3426825731a94ce0312da16c70d84c5df (diff)
dgit: unrepresentable check: Don't tolerate symlink creation
git diff can represent changes to symlinks, but dpkg-source uses diff(1) to apply changes, and git diff cannot. The result if we permit them is that we end up making source packages that can't be built, or aren't treesame to our HEAD. Reject this early. This resolves the error handling regression in dgit: quilt fixup: Don't use dpkg-source --commit, but git diff Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xdgit7
-rwxr-xr-xtests/tests/unrepresentable2
2 files changed, 4 insertions, 5 deletions
diff --git a/dgit b/dgit
index 9079ef3..f95e246 100755
--- a/dgit
+++ b/dgit
@@ -5447,7 +5447,7 @@ sub quiltify_trees_differ ($$;$$$) {
if ($unrepres) {
eval {
- die __ "not a plain file or symlink\n"
+ die __ "not a plain file\n"
unless $newmode =~ m/^(?:10|12)\d{4}$/ ||
$oldmode =~ m/^(?:10|12)\d{4}$/;
if ($oldmode =~ m/[^0]/ &&
@@ -5463,10 +5463,9 @@ sub quiltify_trees_differ ($$;$$$) {
unless $oldmode =~ m/^10/;
} else {
# creation
- die __ "creation with non-default mode\n"
+ die __ "creation with non-default mode, or symlink\n"
unless $newmode =~ m/^100644$/ or
- $newmode =~ m/^100755$/ or
- $newmode =~ m/^120000$/;
+ $newmode =~ m/^100755$/;
}
};
if ($@) {
diff --git a/tests/tests/unrepresentable b/tests/tests/unrepresentable
index 70f7f78..490b8f7 100755
--- a/tests/tests/unrepresentable
+++ b/tests/tests/unrepresentable
@@ -115,7 +115,7 @@ finish EP:'deletion of symlink' LATE-EP:'Mode change from 20000 to 000000'
start new
ln -s hi new
git add new
-finish BUILD:'modifies file work/new through a symlink' 'new version is symlink'
+finish EP:'creation .* symlink' 'new version is symlink'
start src.c
git rm src.c