[debsums] 03/03: test protection against symlink loop

dod at debian.org dod at debian.org
Wed Oct 26 09:06:39 UTC 2016


This is an automated email from the git hooks/post-receive script.

dod pushed a commit to branch master
in repository debsums.

commit 45d30bd7dc1d352daf804e43d4361b5456611189
Author: Dominique Dumont <dod at debian.org>
Date:   Wed Oct 26 11:06:02 2016 +0200

    test protection against symlink loop
---
 t/debsums.t                                             |  16 ++++++++++++++++
 t/fakechroots/link-with-loop/etc/fakepkg.cfg            |   1 +
 .../link-with-loop/usr/share/doc/fakepkg/README         |   1 +
 .../usr/share/doc/fakepkg/changelog.Debian.gz           | Bin 0 -> 161 bytes
 .../link-with-loop/usr/share/doc/fakepkg/copyright      |  14 ++++++++++++++
 .../link-with-loop/usr/share/doc/fakepkg/loop.1         |   1 +
 .../link-with-loop/usr/share/doc/fakepkg/loop.2         |   1 +
 .../link-with-loop/usr/share/doc/fakepkg/readme.up      |   1 +
 .../link-with-loop/var/lib/dpkg/info/fakepkg.conffiles  |   1 +
 .../link-with-loop/var/lib/dpkg/info/fakepkg.list       |  11 +++++++++++
 .../link-with-loop/var/lib/dpkg/info/fakepkg.md5sums    |   4 ++++
 t/fakechroots/link-with-loop/var/lib/dpkg/status        |  12 ++++++++++++
 .../link-with-loop/var/lib/dpkg/updates/.emptydir       |   0
 13 files changed, 63 insertions(+)

diff --git a/t/debsums.t b/t/debsums.t
index 3eff985..a72c30b 100644
--- a/t/debsums.t
+++ b/t/debsums.t
@@ -172,6 +172,22 @@ foreach my $option (qw(-c -s)) {
     expected_rc(0);
 }
 
+########################################
+# Checks symlinks with loops           #
+########################################
+
+# Expect a warning
+$chroot = "t/fakechroots/link-with-loop";
+ at command = ($command, "--root=$chroot");
+foreach my $option (qw(-c -s)) {
+    run(@command, $option);
+    is(stderr,
+       "debsums: Error: symlink loop detected in path 'usr/share/doc/fakepkg/loop.1'. Please file a bug again fakepkg.
+debsums: can't open fakepkg file t/fakechroots/link-with-loop/usr/share/doc/fakepkg/loop.1 (Too many levels of symbolic links)\n",
+       'Warning on STDERR');
+    expected_rc(2);
+}
+
 #######################
 ### All checks done ###
 #######################
diff --git a/t/fakechroots/link-with-loop/etc/fakepkg.cfg b/t/fakechroots/link-with-loop/etc/fakepkg.cfg
new file mode 100644
index 0000000..362d60b
--- /dev/null
+++ b/t/fakechroots/link-with-loop/etc/fakepkg.cfg
@@ -0,0 +1 @@
+# Valid conffile
diff --git a/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/README b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/README
new file mode 120000
index 0000000..5a9deb7
--- /dev/null
+++ b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/README
@@ -0,0 +1 @@
+readme.up
\ No newline at end of file
diff --git a/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/changelog.Debian.gz b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/changelog.Debian.gz
new file mode 100644
index 0000000..bdbec22
Binary files /dev/null and b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/changelog.Debian.gz differ
diff --git a/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/copyright b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/copyright
new file mode 100644
index 0000000..ecf2c92
--- /dev/null
+++ b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/copyright
@@ -0,0 +1,14 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Comment: This is a fake copyright file, part of debsums' test suite
+
+Files: *
+Copyright:
+  2015  Axel Beckert <abe at debian.org>
+License: GPL
+ This is free software, licensed under the terms of the GNU General Public
+ License.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE.
+ .
+ You are free to distribute this software under the terms of the GNU General
+ Public License. On Debian systems, the complete text of the GNU General
+ Public License can be found in /usr/share/common-licenses/GPL file.
diff --git a/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/loop.1 b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/loop.1
new file mode 120000
index 0000000..ac7d6e1
--- /dev/null
+++ b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/loop.1
@@ -0,0 +1 @@
+loop.2
\ No newline at end of file
diff --git a/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/loop.2 b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/loop.2
new file mode 120000
index 0000000..0c6ed00
--- /dev/null
+++ b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/loop.2
@@ -0,0 +1 @@
+loop.1
\ No newline at end of file
diff --git a/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/readme.up b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/readme.up
new file mode 100644
index 0000000..3a61404
--- /dev/null
+++ b/t/fakechroots/link-with-loop/usr/share/doc/fakepkg/readme.up
@@ -0,0 +1 @@
+yadayada
diff --git a/t/fakechroots/link-with-loop/var/lib/dpkg/info/fakepkg.conffiles b/t/fakechroots/link-with-loop/var/lib/dpkg/info/fakepkg.conffiles
new file mode 100644
index 0000000..8e3fbe9
--- /dev/null
+++ b/t/fakechroots/link-with-loop/var/lib/dpkg/info/fakepkg.conffiles
@@ -0,0 +1 @@
+/etc/fakepkg.cfg
diff --git a/t/fakechroots/link-with-loop/var/lib/dpkg/info/fakepkg.list b/t/fakechroots/link-with-loop/var/lib/dpkg/info/fakepkg.list
new file mode 100644
index 0000000..89d9f9e
--- /dev/null
+++ b/t/fakechroots/link-with-loop/var/lib/dpkg/info/fakepkg.list
@@ -0,0 +1,11 @@
+/usr
+/usr/share
+/usr/share/doc
+/usr/share/doc/fakepkg
+/usr/share/doc/fakepkg/copyright
+/usr/share/doc/fakepkg/changelog.Debian.gz
+/usr/share/doc/fakepkg/readme.up
+/usr/share/doc/fakepkg/README
+/etc
+/etc/fakepkg.cfg
+usr/share/doc/fakepkg/loop.1 usr/share/doc/fakepkg/loop.2
diff --git a/t/fakechroots/link-with-loop/var/lib/dpkg/info/fakepkg.md5sums b/t/fakechroots/link-with-loop/var/lib/dpkg/info/fakepkg.md5sums
new file mode 100644
index 0000000..2a7a8b0
--- /dev/null
+++ b/t/fakechroots/link-with-loop/var/lib/dpkg/info/fakepkg.md5sums
@@ -0,0 +1,4 @@
+52f02364e60d4865543a2e935533ef33  usr/share/doc/fakepkg/copyright
+082797d51b0c32d421e274b05926618a  usr/share/doc/fakepkg/changelog.Debian.gz
+6f821e46bd67ac27249ceaa26c207923  usr/share/doc/fakepkg/readme.up
+6f821e46bd67ac27249ceaa26c207923  usr/share/doc/fakepkg/loop.1
diff --git a/t/fakechroots/link-with-loop/var/lib/dpkg/status b/t/fakechroots/link-with-loop/var/lib/dpkg/status
new file mode 100644
index 0000000..c040b54
--- /dev/null
+++ b/t/fakechroots/link-with-loop/var/lib/dpkg/status
@@ -0,0 +1,12 @@
+Package: fakepkg
+Status: install ok installed
+Priority: extra
+Section: metapackages
+Installed-Size: 123
+Maintainer: Axel Beckert <abe+debsums-testsuite at debian.org>
+Architecture: all
+Version: 1
+Description: dummy package for debsums' test suite
+ This is an empty dummy package just used for debsums' test suite.
+Conffiles:
+ /etc/fakepkg.cfg dc0b26e33cba0138a27aa00dcc90ae09
diff --git a/t/fakechroots/link-with-loop/var/lib/dpkg/updates/.emptydir b/t/fakechroots/link-with-loop/var/lib/dpkg/updates/.emptydir
new file mode 100644
index 0000000..e69de29

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/debsums.git



More information about the Pkg-perl-cvs-commits mailing list