From cdbf0b43ce179a6ab160830293cb737b2d4cf957 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 16 Jul 2017 12:31:49 +0100 Subject: test suite: Introduce example 1.1 orig containg some interesting objects We are going to want to test alternation/deletion of symlinks and non-644 files. To test this we need to switch to using example_1.1.orig.tar.gz (and the corresponding git branch in the worktree), so that we have such existing objects. Signed-off-by: Ian Jackson --- tests/tests/unrepresentable | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/tests/unrepresentable') diff --git a/tests/tests/unrepresentable b/tests/tests/unrepresentable index 0d02c6a..621829e 100755 --- a/tests/tests/unrepresentable +++ b/tests/tests/unrepresentable @@ -4,13 +4,13 @@ set -e t-tstunt-parsechangelog -t-prep-newpackage example 1.0 +t-prep-newpackage example 1.1 ln -s $troot/pkg-srcs/${p}_${v%-*}.orig.tar.* . cd $p -start () { git checkout quilt-tip~0; } +start () { git checkout quilt-tip-1.1~0; } attempt () { t-dgit -wgf --quilt=smash quilt-fixup; } badly-1 () { -- cgit v1.2.3 From 73431be6826351c4b3bbd50b61848693e1646749 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 16 Jul 2017 11:50:40 +0100 Subject: test suite: Test symlink modification and deletion, not creation We are going to tolerate symlink creation, because dpkg-source can consume patches to create symlinks (even though it cannot create them). Signed-off-by: Ian Jackson --- tests/tests/unrepresentable | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/tests/unrepresentable') diff --git a/tests/tests/unrepresentable b/tests/tests/unrepresentable index 621829e..fa71bd3 100755 --- a/tests/tests/unrepresentable +++ b/tests/tests/unrepresentable @@ -25,9 +25,13 @@ badly-2 () { attempt } -badly-1 symlink 'not a plain file' - ln -s TARGET symlink - git add symlink +badly-1 orig-symlink 'not a plain file' + ln -sf NEWTARGET orig-symlink + git add orig-symlink +badly-2 + +badly-1 orig-symlink 'not a plain file' + git rm -f orig-symlink badly-2 start -- cgit v1.2.3 From fd9881c5c24f97f7c7421db946e6f09afdb2758a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 16 Jul 2017 11:19:29 +0100 Subject: dgit: unrepres. changes: Prepare to tolerate symlinks Permit symlinks (which have mode 120000 in git) to make their way through for more detailed checks. No functional change except to error messages, because: * If neither thing was a symlink, then the existing regexps still match and the new "modified symlink" clause will not, so the flow is unchanged. * Otherwise, if both $oldmode and $newmode match [^0], ie, this is a modification rather than deletion or removal, we insist that $oldmode=$newmode, and then, fail the new "modified symlink" check. * Otherwise, we fail the check for default mode. So in the case we are allowing to proceed further, we fail as before. Signed-off-by: Ian Jackson --- tests/tests/unrepresentable | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/tests/unrepresentable') diff --git a/tests/tests/unrepresentable b/tests/tests/unrepresentable index fa71bd3..206af86 100755 --- a/tests/tests/unrepresentable +++ b/tests/tests/unrepresentable @@ -25,12 +25,12 @@ badly-2 () { attempt } -badly-1 orig-symlink 'not a plain file' +badly-1 orig-symlink 'modified symlink' ln -sf NEWTARGET orig-symlink git add orig-symlink badly-2 -badly-1 orig-symlink 'not a plain file' +badly-1 orig-symlink 'non-default mode or type' git rm -f orig-symlink badly-2 @@ -39,7 +39,7 @@ start git commit -m deleted attempt -badly-1 src.c 'mode changed' +badly-1 src.c 'mode or type changed' chmod +x src.c git add src.c badly-2 -- cgit v1.2.3 From 242ba73109ae30e7d8849b01f0c668b87d4f4d63 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 16 Jul 2017 11:28:50 +0100 Subject: dgit: unrepres. changes: Tolerate deletion of executable files We don't care what the old mode was; if we tell dpkg-source to record the deletion it can do so. But we do care that it was a file. Experimentally, dpkg-source on stretch ignores attempts to delete symlinks. The removal of the check for $newmode has no functional change, because in this context we know that $newmode is all 0s. If it wasn't, we would have been in "both old and new files exist", above. So that limb of the test will never match and should be removed. Signed-off-by: Ian Jackson --- tests/tests/unrepresentable | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/tests/unrepresentable') diff --git a/tests/tests/unrepresentable b/tests/tests/unrepresentable index 206af86..80b5a05 100755 --- a/tests/tests/unrepresentable +++ b/tests/tests/unrepresentable @@ -30,7 +30,7 @@ badly-1 orig-symlink 'modified symlink' git add orig-symlink badly-2 -badly-1 orig-symlink 'non-default mode or type' +badly-1 orig-symlink 'deletion of symlink' git rm -f orig-symlink badly-2 -- cgit v1.2.3 From c3db904b1de5630bd90655563f341d22e22986bc Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 16 Jul 2017 11:41:14 +0100 Subject: dgit: unrepres. changes: Tolerate creation of symlinks Experimentally, dpkg-source on stretch will create patches to create new symlinks. (It will fail on attempts to modify existing symlinks and it ignores attempts to change plain file executability.) Implementation: add an alternative which tolerates the git symlink mode. This replaces the check on $oldmode, which in this context we know is all 0s and can therefore never match. While we're here, change the error message. Closes:#857382. Signed-off-by: Ian Jackson --- tests/tests/unrepresentable | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/tests/unrepresentable') diff --git a/tests/tests/unrepresentable b/tests/tests/unrepresentable index 80b5a05..89df719 100755 --- a/tests/tests/unrepresentable +++ b/tests/tests/unrepresentable @@ -44,7 +44,7 @@ badly-1 src.c 'mode or type changed' git add src.c badly-2 -badly-1 new 'non-default mode' +badly-1 new 'creation with non-default mode' echo hi >new chmod 755 new git add new -- cgit v1.2.3 From 1c1a95aa2d220dc8fb067fe93795a9a31043a98e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 16 Jul 2017 12:54:11 +0100 Subject: quilt fixup: Check we can delete files with funny modes Signed-off-by: Ian Jackson --- tests/tests/unrepresentable | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/tests/unrepresentable') diff --git a/tests/tests/unrepresentable b/tests/tests/unrepresentable index 89df719..b2de452 100755 --- a/tests/tests/unrepresentable +++ b/tests/tests/unrepresentable @@ -39,6 +39,12 @@ start git commit -m deleted attempt +start + git rm orig-exec + git rm -f orig-unwriteable + git commit -m 'deleted funny' +attempt + badly-1 src.c 'mode or type changed' chmod +x src.c git add src.c -- cgit v1.2.3 From ba5d46b8844b347f9dd54657b818c5017491bd13 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 16 Jul 2017 12:55:54 +0100 Subject: quilt fixup: Check that funny changes are represented properly Specifically, do dgit push --dry-run. This will check that the source package and git tree agree - ie, that what we have produced can round-trip through dpkg-source. Signed-off-by: Ian Jackson --- tests/tests/unrepresentable | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tests/tests/unrepresentable') diff --git a/tests/tests/unrepresentable b/tests/tests/unrepresentable index b2de452..e4b0da8 100755 --- a/tests/tests/unrepresentable +++ b/tests/tests/unrepresentable @@ -12,6 +12,11 @@ cd $p start () { git checkout quilt-tip-1.1~0; } attempt () { t-dgit -wgf --quilt=smash quilt-fixup; } +good () { + attempt + t-dgit --quilt=nofix -wgf build-source + t-dgit -wgf --dry-run push --new +} badly-1 () { wrongfn=$1 @@ -37,13 +42,13 @@ badly-2 start git rm src.c git commit -m deleted -attempt +good start git rm orig-exec git rm -f orig-unwriteable git commit -m 'deleted funny' -attempt +good badly-1 src.c 'mode or type changed' chmod +x src.c @@ -57,6 +62,6 @@ badly-1 new 'creation with non-default mode' badly-2 start -attempt +good t-ok -- cgit v1.2.3