[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#458742: lintian: Please test for valid filenames for run-parts



Russ Allbery wrote:

> it would save me time if you could also add a new test case for any patch
> that introduces a new tag.

Revised patch with testcases attached.

> For this tag, I think we also want to exclude files named .placeholder
> (maybe any files starting with .) so that we don't get false positives
> from the cron packages themselves.

Agreed; the latter suggestion is reflected in the new patch.


Regards,

-- 
Chris Lamb, UK                                       chris@chris-lamb.co.uk
                                                            GPG: 0x634F9A20
Index: checks/files
===================================================================
--- checks/files	(revision 1117)
+++ checks/files	(working copy)
@@ -135,6 +135,10 @@
 	if ($file =~ m,^etc/nntpserver, ) {
 	    tag "package-uses-obsolete-file", "$file";
 	}
+	# ---------------- /etc/cron.daily, etc.
+	elsif ($file =~ m,^etc/cron\.(daily|hourly|monthly|weekly)/[^\.].*\., ) {
+	    tag "run-parts-cron-script-filename-contains-full-stop", "$file";
+	}
 	# ---------------- /etc/cron.d
 	elsif ($file =~ m,^etc/cron\.d/\S, and $operm != 0644) {
 	    tag "bad-permissions-for-etc-cron.d-script", sprintf("$file %04o != 0644",$operm);
Index: checks/files.desc
===================================================================
--- checks/files.desc	(revision 1117)
+++ checks/files.desc	(working copy)
@@ -328,6 +328,11 @@
  violation of policy.
 Ref: policy 10.5
 
+Tag: run-parts-cron-script-filename-contains-full-stop
+Type: warning
+Info: The script in /etc/cron.<time-interval> will not be executed by
+ run-parts(8) because the filename contains a "." (full-stop).
+
 Tag: bad-permissions-for-etc-cron.d-script
 Type: error
 Info: Files in <tt>/etc/cron.d</tt> are configuration files for cron and not
Index: testset/etcfiles/debian/conffiles
===================================================================
--- testset/etcfiles/debian/conffiles	(revision 1117)
+++ testset/etcfiles/debian/conffiles	(working copy)
@@ -1,2 +1,5 @@
 /etc/proper
 /var/lib/foo
+/etc/cron.daily/cronfile-normal
+/etc/cron.daily/.cronfile-begins-with-fullstop
+/etc/cron.daily/cronfile-contains.fullstop
Index: testset/etcfiles/debian/rules
===================================================================
--- testset/etcfiles/debian/rules	(revision 1117)
+++ testset/etcfiles/debian/rules	(working copy)
@@ -11,6 +11,10 @@
 	install -d $(tmp)/etc
 	install -m 644 proper $(tmp)/etc
 	install -m 644 improper $(tmp)/etc
+	mkdir $(tmp)/etc/cron.daily
+	touch $(tmp)/etc/cron.daily/cronfile-normal
+	touch $(tmp)/etc/cron.daily/.cronfile-begins-with-fullstop
+	touch $(tmp)/etc/cron.daily/cronfile-contains.fullstop
 	ln $(tmp)/etc/improper $(tmp)/etc/improper-link
 	install -d $(tmp)/usr/share/doc/etcfiles
 	install -d $(tmp)/var/lib
@@ -21,6 +25,12 @@
 	install -d $(tmp)/DEBIAN
 	install -m 644 debian/conffiles $(tmp)/DEBIAN
 
+	echo '68b329da9893e34099c7d8ad5cb9c940  ./etc/cron.daily/cronfile-normal' \
+	    > debian/tmp/DEBIAN/md5sums
+	echo '68b329da9893e34099c7d8ad5cb9c940  ./etc/cron.daily/.cronfile-begins-with-fullstop' \
+	    > debian/tmp/DEBIAN/md5sums
+	echo '68b329da9893e34099c7d8ad5cb9c940  ./etc/cron.daily/cronfile-contains.fullstop' \
+	    > debian/tmp/DEBIAN/md5sums
 	echo 'ab371382468880299e5ebd05921764ce  ./etc/proper' \
 	    > debian/tmp/DEBIAN/md5sums
 	echo 'ab371382468880299e5ebd05921764ce  etc/improper' \
Index: testset/tags.etcfiles
===================================================================
--- testset/tags.etcfiles	(revision 1117)
+++ testset/tags.etcfiles	(working copy)
@@ -12,3 +12,4 @@
 W: etcfiles: file-missing-in-md5sums usr/share/doc/etcfiles/changelog
 W: etcfiles: non-etc-file-marked-as-conffile /var/lib/foo
 W: etcfiles: package-contains-hardlink etc/improper -> etc/improper-link
+W: etcfiles: run-parts-cron-script-filename-contains-full-stop etc/cron.daily/cronfile-contains.fullstop

Attachment: signature.asc
Description: PGP signature


Reply to: