Bug#469926: lintian: test suite fails when invoked with umask != 0022
Package: lintian
Version: 1.23.46
Severity: minor
Tags: patch
It seems that in many of the test packages in the test suite the
debian/rules script creates files without specifying the permissions
explicitly. If the test suite is run with a non-standard umask, this
causes Lintian to produce a lot more non-standard-file-perm warnings
(among others) than is inteded:
$ umask
0077
$ cd lintian-1.23.46
$ debian/rules runtests
.... running tests ....
[ -d debian/tests ] || mkdir debian/tests
LINTIAN_ROOT="" /usr/bin/perl testset/runtests -k testset debian/tests
Checking for missing info tags ... done.
Running static lab test ... create ... renew ... remove ... rmdir ...done.
Running test on binary 4-1.1: copying... building... testing... FAILED:
--- testset/tags.binary 2008-03-04 01:11:21.000000000 +0100
+++ debian/tests/tags.binary 2008-03-07 16:20:52.000000000 +0100
@@ -1,4 +1,5 @@
E: binary source: debian-rules-missing-required-target binary-indep
+E: binary-data: control-file-has-bad-permissions md5sums 0600 != 0644
E: binary: debian-changelog-file-missing-or-wrong-name
E: binary: debian-news-file-uses-obsolete-national-encoding at line 3
E: binary: depends-on-x-metapackage depends: xorg
@@ -107,6 +108,16 @@
W: binary: menu-item-uses-apps-section /usr/share/menu/binary:7
W: binary: menu-item-uses-windowmanagers-section /usr/lib/menu/binary:13
W: binary: menu-item-uses-windowmanagers-section /usr/share/menu/binary:13
+W: binary: non-standard-file-perm usr/bar 0600 != 0644
+W: binary: non-standard-file-perm usr/bar2 0600 != 0644
+W: binary: non-standard-file-perm usr/foo 0600 != 0644
+W: binary: non-standard-file-perm usr/share/baz 0600 != 0644
+W: binary: non-standard-file-perm usr/share/binary/largefile 0600 != 0644
+W: binary: non-standard-file-perm usr/share/doc-base/space 0600 != 0644
+W: binary: non-standard-file-perm usr/share/doc/binary/html/ch1.html 0600 != 0644
+W: binary: non-standard-file-perm usr/share/doc/binary/html/ch5.html 0600 != 0644
+W: binary: non-standard-file-perm usr/share/doc/binary/html/ch6.html 0600 != 0644
+W: binary: non-standard-file-perm usr/share/doc/binary/html/index.html 0600 != 0644
W: binary: old-fsf-address-in-copyright-file
W: binary: package-contains-hardlink usr/bar2 -> usr/share/baz
W: binary: package-contains-upstream-install-documentation usr/share/doc/binary/INSTALL
[...]
This isn't a big problem after realizing that you can just change the
umask before invoking the runtests script, but it would be nice to not
need to remeber this or figure it out in the first place, so I suggest
the easiest way to get around this is to set the umask to 0022 in the
runtests script right after it's invoked, for example like this:
diff -Naur a/testset/runtests b/testset/runtests
--- a/testset/runtests 2008-03-03 05:28:55.000000000 +0000
+++ b/testset/runtests 2008-03-07 04:51:05.000000000 +0000
@@ -122,6 +122,10 @@
my %tags;
my %types = ( 'E' => 'error', 'W' => 'warning', 'I' => 'info' );
+# Set standard umask because many of the test packages rely on this
+# when creating files from the debian/rules script.
+umask(0022);
+
# --- Display output immediately
$| = 1;
However, this might not be enough, because in some of the test
packages the debian/rules script uses files already in Lintian's
source package to build the package, and the permissions for these
files depend on what the umask was when the Lintian source package
was extracted:
$ umask
0077
$ dpkg-source -x lintian_1.23.46.dsc
$ cd lintian-1.23.46
$ umask 0022
$ debian/rules runtests
.... running tests ....
[ -d debian/tests ] || mkdir debian/tests
LINTIAN_ROOT="" /usr/bin/perl testset/runtests -k testset debian/tests
Checking for missing info tags ... done.
Running static lab test ... create ... renew ... remove ... rmdir ...done.
Running test on binary 4-1.1: copying... building... testing... done.
Running test on cdbs-test 1-1~bpo40+1: copying... building... testing... done.
Running test on debconf 1~rc1: copying... building... testing... done.
Running test on debug 1.0: copying... building... testing... done.
Running test on dh-test 1-1: copying... building... testing... done.
Running test on diffs 1-1~lint1: copying... building... testing... done.
Running test on empty 2: copying... building... testing... done.
Running test on etcfiles 1: copying... building... testing... FAILED:
--- testset/tags.etcfiles 2008-02-19 01:50:45.000000000 +0100
+++ debian/tests/tags.etcfiles 2008-03-07 16:29:13.000000000 +0100
@@ -11,6 +11,7 @@
W: etcfiles: file-missing-in-md5sums etc/improper-link
W: etcfiles: file-missing-in-md5sums usr/share/doc/etcfiles/changelog
W: etcfiles: non-etc-file-marked-as-conffile /var/lib/foo
+W: etcfiles: non-standard-file-perm var/lib/foo 0600 != 0644
W: etcfiles: package-contains-hardlink etc/improper -> etc/improper-link
W: etcfiles: readme-debian-mentions-usr-doc line 2
W: etcfiles: run-parts-cron-filename-contains-full-stop etc/cron.daily/cronfile-contains.fullstop
Running test on filenames 12-0.1: copying... building... testing... done.
Running test on foo++ 5: copying... building... testing... FAILED:
--- testset/tags.foo++ 2008-02-05 02:30:19.000000000 +0100
+++ debian/tests/tags.foo++ 2008-03-07 16:29:19.000000000 +0100
@@ -19,4 +19,6 @@
W: foo++ source: uploader-not-full-name Frank
W: foo++ source: uploader-not-full-name Josip
W: foo++: latest-debian-changelog-entry-without-new-date
+W: foo++: non-standard-file-perm usr/share/doc/foo++/README.Debian.gz 0600 != 0644
+W: foo++: non-standard-file-perm usr/share/doc/foo++/changelog.gz 0600 != 0644
W: foo++: readme-debian-contains-debmake-default-email-address
Running test on libbaz 1-1: copying... building... testing... done.
Running test on maintainer-scripts 7-0.1: copying... building... internal error: failed: cd debian/tests/maintainer-scripts && dpkg-buildpackage -rfakeroot -us -uc -d >../build.maintainer-scripts 2>&1
make: *** [runtests] Error 2
To avoid this, the debian/rules scripts in the problematic packages
must be adjusted. I've attached a patch which should avoid the
redundant warnings for these cases, but without affecting the errors
and warnings that actually are inteded.
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash
Versions of packages lintian depends on:
ii binutils 2.18.1~cvs20080103-1 The GNU assembler, linker and bina
ii diffstat 1.45-2 produces graph of changes introduc
ii dpkg-dev 1.14.16.6 package building tools for Debian
ii file 4.23-2 Determines file type using "magic"
ii gettext 0.17-2 GNU Internationalization utilities
ii intltool-debian 0.35.0+20060710.1 Help i18n of RFC822 compliant conf
ii libparse-debianchan 1.1.1-2 parse Debian changelogs and output
ii liburi-perl 1.35.dfsg.1-1 Manipulates and accesses URI strin
ii man-db 2.5.1-2 on-line manual pager
ii perl [libdigest-md5 5.8.8-12 Larry Wall's Practical Extraction
lintian recommends no packages.
-- no debconf information
diff -Naur a/testset/etcfiles/debian/rules b/testset/etcfiles/debian/rules
--- a/testset/etcfiles/debian/rules 2008-02-19 00:44:20.000000000 +0000
+++ b/testset/etcfiles/debian/rules 2008-03-07 04:03:18.000000000 +0000
@@ -18,7 +18,7 @@
ln $(tmp)/etc/improper $(tmp)/etc/improper-link
install -d $(tmp)/usr/share/doc/etcfiles
install -d $(tmp)/var/lib
- cp proper $(tmp)/var/lib/foo
+ install -m 644 proper $(tmp)/var/lib/foo
install -m 644 debian/README.Debian $(tmp)/usr/share/doc/etcfiles
install -m 644 debian/changelog $(tmp)/usr/share/doc/etcfiles
#gzip -9 $(tmp)/usr/share/doc/etcfiles/changelog
diff -Naur a/testset/foo++/debian/rules b/testset/foo++/debian/rules
--- a/testset/foo++/debian/rules 2006-01-22 20:27:57.000000000 +0000
+++ b/testset/foo++/debian/rules 2008-03-07 04:07:01.000000000 +0000
@@ -10,9 +10,11 @@
binary-indep:
install -d debian/$(foo)/DEBIAN
install -d debian/$(foo)/usr/share/doc/$(foo)
- cp debian/changelog debian/$(foo)/usr/share/doc/$(foo)/changelog
+ install -m 644 debian/changelog \
+ debian/$(foo)/usr/share/doc/$(foo)/changelog
gzip -9 debian/$(foo)/usr/share/doc/$(foo)/changelog
- cp debian/README.Debian debian/$(foo)/usr/share/doc/$(foo)/README.Debian
+ install -m 644 debian/README.Debian \
+ debian/$(foo)/usr/share/doc/$(foo)/README.Debian
gzip -9 debian/$(foo)/usr/share/doc/$(foo)/README.Debian
dpkg-gencontrol -isp -p$(foo) -Pdebian/$(foo)
dpkg --build debian/$(foo) ..
diff -Naur a/testset/maintainer-scripts/debian/rules b/testset/maintainer-scripts/debian/rules
--- a/testset/maintainer-scripts/debian/rules 2006-03-05 07:02:21.000000000 +0000
+++ b/testset/maintainer-scripts/debian/rules 2008-03-07 04:45:53.000000000 +0000
@@ -6,17 +6,14 @@
binary-indep:
install -d debian/tmp/DEBIAN
- cp debian/config debian/tmp/DEBIAN
- cp debian/preinst debian/tmp/DEBIAN
- chmod +x debian/tmp/DEBIAN/preinst
- cp debian/postinst debian/tmp/DEBIAN
- chmod +x debian/tmp/DEBIAN/postinst
- cp debian/prerm debian/tmp/DEBIAN
- chmod +x debian/tmp/DEBIAN/prerm
- cp debian/postrm debian/tmp/DEBIAN
- chmod +x debian/tmp/DEBIAN/postrm
+ install -m 0644 debian/config debian/tmp/DEBIAN
+ install -m 0755 debian/preinst debian/tmp/DEBIAN
+ install -m 0755 debian/postinst debian/tmp/DEBIAN
+ install -m 0755 debian/prerm debian/tmp/DEBIAN
+ install -m 0755 debian/postrm debian/tmp/DEBIAN
install -d debian/tmp/usr/share/doc/maintainer-scripts
- cp debian/changelog debian/tmp/usr/share/doc/maintainer-scripts/changelog
+ install -m 0644 debian/changelog \
+ debian/tmp/usr/share/doc/maintainer-scripts/changelog
gzip -9 debian/tmp/usr/share/doc/maintainer-scripts/changelog
dpkg-gencontrol -isp
dpkg --build debian/tmp ..
diff -Naur a/testset/manpages/debian/rules b/testset/manpages/debian/rules
--- a/testset/manpages/debian/rules 2008-01-22 01:20:31.000000000 +0000
+++ b/testset/manpages/debian/rules 2008-03-07 04:28:51.000000000 +0000
@@ -69,7 +69,7 @@
mkdir -p $(tmp)/usr/lib/perl5
install -d $(tmp)/usr/share/doc/manpages
- cp debian/changelog $(tmp)/usr/share/doc/manpages/changelog
+ install -m644 debian/changelog $(tmp)/usr/share/doc/manpages/changelog
gzip -9 $(tmp)/usr/share/doc/manpages/changelog
install -d $(tmp)/DEBIAN
install -m755 debian/postinst $(tmp)/DEBIAN/postinst
diff -Naur a/testset/scripts/debian/rules b/testset/scripts/debian/rules
--- a/testset/scripts/debian/rules 2008-02-09 20:36:57.000000000 +0000
+++ b/testset/scripts/debian/rules 2008-03-07 04:30:59.000000000 +0000
@@ -77,11 +77,11 @@
dh_python
touch $(tmp)/usr/lib/python2.3/site-packages/test.pyc
- cp debian/changelog $(tmp)/usr/share/doc/scripts/changelog
+ install -m 644 debian/changelog $(tmp)/usr/share/doc/scripts/changelog
gzip -9 $(tmp)/usr/share/doc/scripts/changelog
- cp debian/copyright $(tmp)/usr/share/doc/scripts/copyright
+ install -m 644 debian/copyright $(tmp)/usr/share/doc/scripts/copyright
- cp debian/scripts.conffiles $(tmp)/DEBIAN/conffiles
+ install -m 644 debian/scripts.conffiles $(tmp)/DEBIAN/conffiles
install -m 755 debian/preinst $(tmp)/DEBIAN/preinst
install -m 755 debian/postinst $(tmp)/DEBIAN/postinst
install -m 755 debian/postrm $(tmp)/DEBIAN/postrm
Reply to: