Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Hello Chris, On Tue, Nov 08, 2016 at 06:56:10PM +, Chris Lamb wrote: > Hi Andreas, > > > Simply *why* is this error added? > > I added this Lintian check after #838966 was filed against one of my > packages. [...] Thanks for providing this background info. Though I have to say this only makes me more certain we're heading down the wrong path here. Consider the case when someone has bind-mounted enough bits into their chroot that invoke-rc.d starts systemctl instead of directly invoking the init script. What about upstart (which is still supported in invoke-rc.d even though I hear upstart is no more)? And open-rc? And ... ? I'm hope we agree that because your package ships an init script (|| \ systemd unit || ...) you should not start depending on lsb-base && systemd && ... (in other words every init system?! Will it even work to run systemctl in the chroot talking to systemd outside the chroot starting things inside the chroot? I'd guess no.) I'm still hoping we can solve this in one generic place. Without having thought it through I feel like pointing the finger towards init-system-helpers (invoke-rc.d and update-rc.d). I would think that when you run an init-less (aka *buildd*) chroot you would also have a policy-rc.d rule that disallows running of init-scripts etc. via invoke-rc.d (and update-rc.d). Maybe we could even automate that by having the *-rc.d tools auto-detect we don't have an init system in the chroot and treat that as if a policy-rc.d rule was in place. (Someone with experience on how buildd setups and policy-rc.d actually works would be welcome to hear from here.) I'm sure there are a bunch of trivial init scripts that will work to start in a init-less chroot, but I would think it can't be a generally supportable concept. Likely if you skip the init system you should start whatever you want to run directly. Ideas and/or comments welcome. Regards, Andreas Henriksson PS. sorry for both being pessimistic and incapable of writing short mails.
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Hi Andreas, > Simply *why* is this error added? I added this Lintian check after #838966 was filed against one of my packages. I did not add it as part of a plan to remove lsb-base, so alas I cannot comment on the rest of your email. Apologies if you spent some time crafting those portions. > - Having every package shipping an init script depend on additional >packages […] (Just as an aside, not every initscript uses /lib/lsb/init-functions.) > If not, I guess I'll go stick my head in the sand and ignore lintian > while feeling sorry (and frustrated) for all the people blindly following > (the often good) advice given by lintian without questioning why they're > doing so. :/ I share your dislike of noise and/or irrelevant advice from automated tools. However, please refrain from making these kinds of "I'll take my toys elsewhere" emotional-based arguments — in my experience, they are not terribly productive. :) Best wishes, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Le vendredi, 14 octobre 2016, 22.57:13 h CEST Jakub Wilk a écrit : > * Vincent Bernat , 2016-10-11, 08:44: > >We put 3.0-6, then we have to update to 3.2-14 for status_proc. Then we > >discover there may be people with backports so we update to 3.2-14~. This > >makes a lot of people in Debian work for people that do not exist (those > >with distributions older than oldoldstable that install packages from > >unstable > It's worse than that: > > The last release that didn't have lsb-base (>= 3.2-14) is lenny, i.e. > (old)^3stable. The last release that didn't have lsb-base (>= 3.0-6) is > sarge, i.e. (old)^5stable. > > Lintian has no business being THAT pedantic, especially not in a tag with > severity:important. I will remove the version constraint. Oh, indeed. Thanks for checking ! -- Cheers, OdyX
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
* Vincent Bernat , 2016-10-11, 08:44: We put 3.0-6, then we have to update to 3.2-14 for status_proc. Then we discover there may be people with backports so we update to 3.2-14~. This makes a lot of people in Debian work for people that do not exist (those with distributions older than oldoldstable that install packages from unstable It's worse than that: The last release that didn't have lsb-base (>= 3.2-14) is lenny, i.e. (old)^3stable. The last release that didn't have lsb-base (>= 3.0-6) is sarge, i.e. (old)^5stable. Lintian has no business being THAT pedantic, especially not in a tag with severity:important. I will remove the version constraint. (If anybody really wants, they can implement a separate tag with severity:pedantic. But IMHO that's not worth the trouble.) -- Jakub Wilk
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Am 13.10.2016 um 12:26 schrieb Michael Biebl: > I would prefer having the version requirement dropped as well. It seem > rather pointless when even oldstable has a newer version. > > Aside from this issue: Should we handle packages differently which ship > native systemd service files? > You might boot with sysvinit or use /etc/init.d/foo which needs > the redirection from the lsb hook, but is that common enough with > systemd being our default init system to warrant a hard dependency? We have around 1100 packages with around 1300 sysv init scripts sourcing /lib/lsb/init-functions. lsb-base has 462 rdeps. So, roughly speaking, we'd have to touch 600 packages. That's quite a bit of churn. I wonder if we couldn't just generate the lsb-base dependency and inject it via misc:Depends. Say via dh_installinit or a separate dh helper. This would have the benefit that in the hypothetical future, where lsb-base is merged into init-system-helpers, we wouldn't have to touch all those packages again. Michael -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth? signature.asc Description: OpenPGP digital signature
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
On Tue, 11 Oct 2016 08:44:57 +0200 Vincent Bernat wrote: > ⦠8 octobre 2016 13:05 CEST, Evgeni Golov  : > > >> > > But all-in-all, what matters is the dependency, as there were no > >> > > changes > >> > > since 2013 (4.1+Debian10), and Jessie has 4.1+Debian13. > >> > > >> > Just to be clear, are you suggesting that the version part should be > >> > dropped? > >> > >> It's a political question. My nitpicker side favours precise dependencies > >> (because we can), but my realistic side admits lsb-base >= 4.1+Debian13 > >> will > >> be available for all packages which will see changes following the lintian > >> warning. > >> > >> If we can, and we can, we should have precise dependencies instead of > >> 'available in stable'; it helps downstreams as well. > > > > I kind of agree. Just adding the >= 3.0-6 dep all over Debian is not really > > needed. > > For downstreams, well, can't lintian have profiles for them and thus emit > > slightly > > different suggestions, if the downstreams actually still have such an > > old lsb-base? > > Ubuntu Precise also has a recent-enough version of lsb-base. Putting a > version is extra work because it may need to be updated. We put 3.0-6, > then we have to update to 3.2-14 for status_proc. Then we discover there > may be people with backports so we update to 3.2-14~. This makes a lot > of people in Debian work for people that do not exist (those with > distributions older than oldoldstable that install packages from > unstable or those from old derived distributions that install packages > From unstable). I would prefer having the version requirement dropped as well. It seem rather pointless when even oldstable has a newer version. Aside from this issue: Should we handle packages differently which ship native systemd service files? You might boot with sysvinit or use /etc/init.d/foo which needs the redirection from the lsb hook, but is that common enough with systemd being our default init system to warrant a hard dependency? -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth? signature.asc Description: OpenPGP digital signature
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
❦ 8 octobre 2016 13:05 CEST, Evgeni Golov : >> > > But all-in-all, what matters is the dependency, as there were no changes >> > > since 2013 (4.1+Debian10), and Jessie has 4.1+Debian13. >> > >> > Just to be clear, are you suggesting that the version part should be >> > dropped? >> >> It's a political question. My nitpicker side favours precise dependencies >> (because we can), but my realistic side admits lsb-base >= 4.1+Debian13 will >> be available for all packages which will see changes following the lintian >> warning. >> >> If we can, and we can, we should have precise dependencies instead of >> 'available in stable'; it helps downstreams as well. > > I kind of agree. Just adding the >= 3.0-6 dep all over Debian is not really > needed. > For downstreams, well, can't lintian have profiles for them and thus emit > slightly > different suggestions, if the downstreams actually still have such an > old lsb-base? Ubuntu Precise also has a recent-enough version of lsb-base. Putting a version is extra work because it may need to be updated. We put 3.0-6, then we have to update to 3.2-14 for status_proc. Then we discover there may be people with backports so we update to 3.2-14~. This makes a lot of people in Debian work for people that do not exist (those with distributions older than oldoldstable that install packages from unstable or those from old derived distributions that install packages From unstable). -- Write clearly - don't sacrifice clarity for "efficiency". - The Elements of Programming Style (Kernighan & Plauger) signature.asc Description: PGP signature
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Ohai, On Wed, Oct 05, 2016 at 10:23:58PM +0200, Didier 'OdyX' Raboud wrote: > Le mercredi, 5 octobre 2016, 20.08:31 h CEST Chris Lamb a écrit : > > Didier 'OdyX' Raboud wrote: > > > But all-in-all, what matters is the dependency, as there were no changes > > > since 2013 (4.1+Debian10), and Jessie has 4.1+Debian13. > > > > Just to be clear, are you suggesting that the version part should be > > dropped? > > It's a political question. My nitpicker side favours precise dependencies > (because we can), but my realistic side admits lsb-base >= 4.1+Debian13 will > be available for all packages which will see changes following the lintian > warning. > > If we can, and we can, we should have precise dependencies instead of > 'available in stable'; it helps downstreams as well. I kind of agree. Just adding the >= 3.0-6 dep all over Debian is not really needed. For downstreams, well, can't lintian have profiles for them and thus emit slightly different suggestions, if the downstreams actually still have such an old lsb-base? Greets Evgeni
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Le mercredi, 5 octobre 2016, 20.08:31 h CEST Chris Lamb a écrit : > Didier 'OdyX' Raboud wrote: > > But all-in-all, what matters is the dependency, as there were no changes > > since 2013 (4.1+Debian10), and Jessie has 4.1+Debian13. > > Just to be clear, are you suggesting that the version part should be > dropped? It's a political question. My nitpicker side favours precise dependencies (because we can), but my realistic side admits lsb-base >= 4.1+Debian13 will be available for all packages which will see changes following the lintian warning. If we can, and we can, we should have precise dependencies instead of 'available in stable'; it helps downstreams as well. > I've seen other bits of Deban be really rather "picky" about versions (even > ones that are satisfied in oldstable!) so I took my lead from that. > > What do others think? > > (ACK on the status_of_proc — will fix.) Great, thanks. -- Cheers, OdyX
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Didier 'OdyX' Raboud wrote: > There are more precise checks that could also be done; such as: > - any use of status_of_proc from /lib/lsb/init-functions needs lsb-base (>= > 3.2-14~) Filed as Bug#839861: lintian: init.d-script-needs-depends-on-lsb-base does not use strict enough lsb-base version for (eg.) status_of_proc. Please follow-up there (if you have anything to add, that is...) ! Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Didier 'OdyX' Raboud wrote: > But all-in-all, what matters is the dependency, as there were no changes > since > 2013 (4.1+Debian10), and Jessie has 4.1+Debian13. Just to be clear, are you suggesting that the version part should be dropped? I've seen other bits of Deban be really rather "picky" about versions (even ones that are satisfied in oldstable!) so I took my lead from that. What do others think? (ACK on the status_of_proc — will fix.) Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Le mardi, 27 septembre 2016, 15.29:00 h CEST Chris Lamb a écrit : > Package: lintian > Severity: wishlist > Tags: patch > > Hi, > > Attached is the following: > > commit 288035a951de277d0248ce28c561fbf7f8646839 > Author: Chris Lamb > Date: Tue Sep 27 16:28:04 2016 +0200 > > checks/init.d: Check for initscripts that source > /lib/lsb/init-functions without declaring the corresponding dependency on > lsb-base (>= 3.0-6). Nice one. There are more precise checks that could also be done; such as: - any use of status_of_proc from /lib/lsb/init-functions needs lsb-base (>= 3.2-14~) But all-in-all, what matters is the dependency, as there were no changes since 2013 (4.1+Debian10), and Jessie has 4.1+Debian13. -- Cheers, OdyX signature.asc Description: This is a digitally signed message part.
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Hi Niels, Thanks again for the review. > Apologies, I had assumed you had run the test suite, so it turns out > there are a few more remarks. Mea culpa. As an "excuse" I had received your previous instructions on the the testsuite, perlcritic, etc. but after I had written this patch… but I should have run it regardlness. > * There are test failures with the patch (presumably the tests needs >updating). >- At least init.d-* and legacy-scripts had failures Fixed. >- For legacy tests, just add the tag to "tags" and move on. For the > rest, please up date them so they do not emit the tag if reasonably > possible. Fixed…although I err'd on adding the tag in some places instead of a control file simply to add the Depends. > * There are perlcritic warnings (boolean operator precedence mixing) Fixed. > * There are unescaped "<" or ">" in the tag description, which should >be escaped with < or > (like HTML). Odds are it is just the >dependency relation. Fixed. Updated patch attached: commit c09ecd4c2a776461d68ce9449e95169348cb79a4 Author: Chris Lamb Date: Sat Oct 1 16:05:06 2016 +0100 Check scripts using init-functions without lsb-base Depends. Emit a tag for initscripts that source the /lib/lsb/init-functions utility functions without declaring the corresponding dependency on lsb-base (>= 3.0-6). Closes: #838997 Signed-off-by: Chris Lamb checks/init.d.desc | 6 ++ checks/init.d.pm | 12 +++- .../files-bad-perm-owner/debian/debian/control.in | 2 +- t/tests/init.d-general/debian/debian/control.in| 6 +- t/tests/init.d-lsb-depends/debian/debian/init | 71 ++ t/tests/init.d-lsb-depends/desc| 4 ++ t/tests/init.d-lsb-depends/tags| 1 + .../init.d-lsb-headers/debian/debian/control.in| 16 ++--- t/tests/init.d-script-registration/tags| 1 + t/tests/legacy-scripts/tags| 1 + t/tests/scripts-calls-init-script/tags | 1 + t/tests/systemd-general/tags | 1 + Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `- From c09ecd4c2a776461d68ce9449e95169348cb79a4 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Sat, 1 Oct 2016 16:05:06 +0100 Subject: [PATCH] Check scripts using init-functions without lsb-base Depends. Emit a tag for initscripts that source the /lib/lsb/init-functions utility functions without declaring the corresponding dependency on lsb-base (>= 3.0-6). Closes: #838997 Signed-off-by: Chris Lamb --- checks/init.d.desc | 6 ++ checks/init.d.pm | 12 +++- .../files-bad-perm-owner/debian/debian/control.in | 2 +- t/tests/init.d-general/debian/debian/control.in| 6 +- t/tests/init.d-lsb-depends/debian/debian/init | 71 ++ t/tests/init.d-lsb-depends/desc| 4 ++ t/tests/init.d-lsb-depends/tags| 1 + .../init.d-lsb-headers/debian/debian/control.in| 16 ++--- t/tests/init.d-script-registration/tags| 1 + t/tests/legacy-scripts/tags| 1 + t/tests/scripts-calls-init-script/tags | 1 + t/tests/systemd-general/tags | 1 + 12 files changed, 107 insertions(+), 15 deletions(-) create mode 100644 t/tests/init.d-lsb-depends/debian/debian/init create mode 100644 t/tests/init.d-lsb-depends/desc create mode 100644 t/tests/init.d-lsb-depends/tags diff --git a/checks/init.d.desc b/checks/init.d.desc index ce33ba5..5b19b3a 100644 --- a/checks/init.d.desc +++ b/checks/init.d.desc @@ -370,3 +370,9 @@ Info: The given init script declares a dependency on the totally broken. Ref: https://wiki.debian.org/LSBInitScripts +Tag: init.d-script-needs-depends-on-lsb-base +Severity: important +Certainty: possible +Info: The given init script sources the /lib/lsb/init-functions utility + functions without declaring the corresponding dependency on lsb-base + (>= 3.0-6). diff --git a/checks/init.d.pm b/checks/init.d.pm index f91afa1..7b0fa7d 100644 --- a/checks/init.d.pm +++ b/checks/init.d.pm @@ -198,7 +198,7 @@ sub run { # Check if file exists in package and check the script for # other issues if it was included in the package. -check_init($initd_path); +check_init($initd_path, $info); } return unless $initd_dir and $initd_dir->is_dir; @@ -222,7 +222,7 @@ sub run { # coverage in the first pass. unless ($initd_postinst{$script->basename}) { tag $tagname, $script; -check_init($script); +check_init($script, $info); } } @@ -230,7 +230,7 @@ sub run { } sub check_init { -my ($initd_path) =
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Chris Lamb: > Dear Niels, > > Thanks for the review. > You are welcome :) Apologies, I had assumed you had run the test suite, so it turns out there are a few more remarks. * There are test failures with the patch (presumably the tests needs updating). - At least init.d-* and legacy-scripts had failures - For legacy tests, just add the tag to "tags" and move on. For the rest, please up date them so they do not emit the tag if reasonably possible. * There are perlcritic warnings (boolean operator precedence mixing) * There are unescaped "<" or ">" in the tag description, which should be escaped with < or > (like HTML). Odds are it is just the dependency relation. >> Please shorten the synopsis and move the more length part into the >> description. > > Done… > Thanks, though it is still a bit too long. I would probably personally have reduced it to: "Check scripts using init-functions without lsb-base Depends" With the "Closes" bit moved down to the "Signed-Off-By". (The leading "checks/init.d:" is not a requirement for commit message. I appreciate we use it frequently enough that it may seem at such). Thanks, ~Niels
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Dear Niels, Thanks for the review. > Please shorten the synopsis and move the more length part into the > description. Done… > Please create a non-legacy test case for new tags. A long term goal is > to remove all the t/tests/legacy-* tests. … and done. Good to know :) Updated patch attached: commit 7152e3984acb45ebb455387765a5e7af4176bb62 Author: Chris Lamb Date: Sat Oct 1 12:39:39 2016 +0100 checks/init.d: Check scripts using init-functions without lsb-base Depends. (Closes: #838997) Emit a tag for initscripts that source the /lib/lsb/init-functions utility functions without declaring the corresponding dependency on lsb-base (>= 3.0-6). Signed-off-by: Chris Lamb checks/init.d.desc| 6 +++ checks/init.d.pm | 12 +++-- t/tests/init.d-lsb-depends/debian/debian/init | 71 +++ t/tests/init.d-lsb-depends/desc | 4 ++ t/tests/init.d-lsb-depends/tags | 1 + 5 files changed, 91 insertions(+), 3 deletions(-) Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `- From e382f9e37fae3a4a9af304b47c49ddbec7d8f0e5 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Sat, 1 Oct 2016 12:42:10 +0100 Subject: [PATCH] checks/init.d: Check scripts using init-functions without lsb-base Depends. (Closes: #838997) Emit a tag for initscripts that source the /lib/lsb/init-functions utility functions without declaring the corresponding dependency on lsb-base (>= 3.0-6). Signed-off-by: Chris Lamb --- checks/init.d.desc| 6 +++ checks/init.d.pm | 12 +++-- t/tests/init.d-lsb-depends/debian/debian/init | 71 +++ t/tests/init.d-lsb-depends/desc | 4 ++ t/tests/init.d-lsb-depends/tags | 1 + 5 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 t/tests/init.d-lsb-depends/debian/debian/init create mode 100644 t/tests/init.d-lsb-depends/desc create mode 100644 t/tests/init.d-lsb-depends/tags diff --git a/checks/init.d.desc b/checks/init.d.desc index ce33ba5..3be8a3d 100644 --- a/checks/init.d.desc +++ b/checks/init.d.desc @@ -370,3 +370,9 @@ Info: The given init script declares a dependency on the totally broken. Ref: https://wiki.debian.org/LSBInitScripts +Tag: init.d-script-needs-depends-on-lsb-base +Severity: important +Certainty: possible +Info: The given init script sources the /lib/lsb/init-functions utility + functions without declaring the corresponding dependency on lsb-base + (>= 3.0-6). diff --git a/checks/init.d.pm b/checks/init.d.pm index f91afa1..4174a4d 100644 --- a/checks/init.d.pm +++ b/checks/init.d.pm @@ -198,7 +198,7 @@ sub run { # Check if file exists in package and check the script for # other issues if it was included in the package. -check_init($initd_path); +check_init($initd_path, $info); } return unless $initd_dir and $initd_dir->is_dir; @@ -222,7 +222,7 @@ sub run { # coverage in the first pass. unless ($initd_postinst{$script->basename}) { tag $tagname, $script; -check_init($script); +check_init($script, $info); } } @@ -230,7 +230,7 @@ sub run { } sub check_init { -my ($initd_path) = @_; +my ($initd_path, $info) = @_; # In an upstart system, such as Ubuntu, init scripts are symlinks to # upstart-job. It doesn't make sense to check the syntax of upstart-job, @@ -321,6 +321,12 @@ sub check_init { while ($l =~ s/^[^\#]*?(start|stop|restart|force-reload|status)//o) { $tag{$1} = 1; } + +if ($l =~ m{^\s*\.\s+/lib/lsb/init-functions} +&& not $info->relation('strong')->implies('lsb-base (>= 3.0-6)')) { +tag 'init.d-script-needs-depends-on-lsb-base', + $initd_path, "(line $.)"; +} } close($fd); diff --git a/t/tests/init.d-lsb-depends/debian/debian/init b/t/tests/init.d-lsb-depends/debian/debian/init new file mode 100644 index 000..48d4cde --- /dev/null +++ b/t/tests/init.d-lsb-depends/debian/debian/init @@ -0,0 +1,71 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: init.d-lsb-depends +# Required-Start: $syslog $remote_fs +# Required-Stop: $syslog $remote_fs +# Should-Start: $local_fs +# Should-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: init.d-lsb-depends +# Description: init.d-lsb-depends +### END INIT INFO + + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/init.d-lsb-depends +NAME=init.d-lsb-depends +DESC=init.d-lsb-depends + +RUNDIR=/var/run/redis +PIDFILE=$RUNDIR/init.d-lsb-depends.pid + +test -x $DAEMON || exit 0 + +if [ -r /etc/default/$NAME ] +then + . /etc/default/$NAME +fi + +. /lib/lsb/init-functi
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
On Tue, 27 Sep 2016 15:29:00 +0100 Chris Lamb wrote: > Package: lintian > Severity: wishlist > Tags: patch > > Hi, > > Attached is the following: > Hi, Thanks for the patch. It looks good and I only got two comments! :) > commit 288035a951de277d0248ce28c561fbf7f8646839 > Author: Chris Lamb > Date: Tue Sep 27 16:28:04 2016 +0200 > > checks/init.d: Check for initscripts that source > /lib/lsb/init-functions without declaring the corresponding dependency on > lsb-base (>= 3.0-6). > Please shorten the synopsis and move the more length part into the description. > Signed-off-by: Chris Lamb > >checks/init.d.desc | 5 + >checks/init.d.pm| 12 +--- >t/tests/legacy-scripts/desc | 2 ++ >t/tests/legacy-scripts/tags | 1 + > [...] Please create a non-legacy test case for new tags. A long term goal is to remove all the t/tests/legacy-* tests. :) Thanks, ~Niels
Bug#838997: lintian: checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6).
Package: lintian Severity: wishlist Tags: patch Hi, Attached is the following: commit 288035a951de277d0248ce28c561fbf7f8646839 Author: Chris Lamb Date: Tue Sep 27 16:28:04 2016 +0200 checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6). Signed-off-by: Chris Lamb checks/init.d.desc | 5 + checks/init.d.pm| 12 +--- t/tests/legacy-scripts/desc | 2 ++ t/tests/legacy-scripts/tags | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `- >From 288035a951de277d0248ce28c561fbf7f8646839 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Tue, 27 Sep 2016 16:28:04 +0200 Subject: [PATCH] checks/init.d: Check for initscripts that source /lib/lsb/init-functions without declaring the corresponding dependency on lsb-base (>= 3.0-6). Signed-off-by: Chris Lamb --- checks/init.d.desc | 5 + checks/init.d.pm| 12 +--- t/tests/legacy-scripts/desc | 2 ++ t/tests/legacy-scripts/tags | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/checks/init.d.desc b/checks/init.d.desc index ce33ba5..5b31754 100644 --- a/checks/init.d.desc +++ b/checks/init.d.desc @@ -370,3 +370,8 @@ Info: The given init script declares a dependency on the totally broken. Ref: https://wiki.debian.org/LSBInitScripts +Tag: init.d-script-needs-depends-on-lsb-base +Severity: important +Certainty: possible +Info: The given init script sources /lib/lsb/init-functions without + declaring the corresponding dependency on lsb-base (>= 3.0-6). diff --git a/checks/init.d.pm b/checks/init.d.pm index f91afa1..4174a4d 100644 --- a/checks/init.d.pm +++ b/checks/init.d.pm @@ -198,7 +198,7 @@ sub run { # Check if file exists in package and check the script for # other issues if it was included in the package. -check_init($initd_path); +check_init($initd_path, $info); } return unless $initd_dir and $initd_dir->is_dir; @@ -222,7 +222,7 @@ sub run { # coverage in the first pass. unless ($initd_postinst{$script->basename}) { tag $tagname, $script; -check_init($script); +check_init($script, $info); } } @@ -230,7 +230,7 @@ sub run { } sub check_init { -my ($initd_path) = @_; +my ($initd_path, $info) = @_; # In an upstart system, such as Ubuntu, init scripts are symlinks to # upstart-job. It doesn't make sense to check the syntax of upstart-job, @@ -321,6 +321,12 @@ sub check_init { while ($l =~ s/^[^\#]*?(start|stop|restart|force-reload|status)//o) { $tag{$1} = 1; } + +if ($l =~ m{^\s*\.\s+/lib/lsb/init-functions} +&& not $info->relation('strong')->implies('lsb-base (>= 3.0-6)')) { +tag 'init.d-script-needs-depends-on-lsb-base', + $initd_path, "(line $.)"; +} } close($fd); diff --git a/t/tests/legacy-scripts/desc b/t/tests/legacy-scripts/desc index d95a521..ee8dc4e 100644 --- a/t/tests/legacy-scripts/desc +++ b/t/tests/legacy-scripts/desc @@ -4,3 +4,5 @@ Sequence: Version: 6ds-1ubuntu0.5.10.1 Type: non-native Description: Legacy test "scripts" +Test-For: + init.d-script-needs-depends-on-lsb-base diff --git a/t/tests/legacy-scripts/tags b/t/tests/legacy-scripts/tags index 3f2854c..0436902 100644 --- a/t/tests/legacy-scripts/tags +++ b/t/tests/legacy-scripts/tags @@ -10,6 +10,7 @@ E: scripts: init.d-script-does-not-implement-required-option etc/init.d/lsb-brok E: scripts: init.d-script-does-not-implement-required-option etc/init.d/lsb-broken restart E: scripts: init.d-script-has-duplicate-lsb-section etc/init.d/lsb-broken E: scripts: init.d-script-has-unterminated-lsb-section etc/init.d/lsb-broken:15 +E: scripts: init.d-script-needs-depends-on-lsb-base etc/init.d/skeleton (line 40) E: scripts: missing-dep-for-interpreter jruby => jruby | jruby1.0 | jruby1.1 | jruby1.2 (usr/bin/jruby-broken) E: scripts: missing-dep-for-interpreter lefty => graphviz (usr/bin/lefty-foo) E: scripts: package-installs-python-bytecode usr/lib/python2.3/site-packages/test.pyc -- 2.9.3