Bug#880998: debian-goodies: checkrestart should error-out when failing to call lsof

2017-11-07 Thread Axel Beckert
Hi Nicolas,

Nicolas Braud-Santoni wrote:
> On Mon, Nov 06, 2017 at 10:12:11PM +0100, Axel Beckert wrote:
> > Nicolas Braud-Santoni wrote:
> > > PS: I included the patches as signed commit in the
> > > collab-maint repository, in branch bug880998.
> > 
> > Thanks! That makes it way easier as "git am" choked on your bug report
> > mail with the two patches.
> 
> That's interesting, I just generated the patches with
> `git format-patch origin/master` and attached them to the mail with
> reportbug.

They also looked fine, but "git am" only applied the first one (with
the whole bug report and some of the patch headers as commit message)
and didn't care (or errored out) on the second one.

> What would be the correct way to send multiple patches to a bug?

In general it's not wrong what you did. Maybe the BTS broke something
git expected. And re-reading the "git am" makes it seem as if "git am"
expects and only supports one patch per mail.

Regards, Axel
-- 
 ,''`.  |  Axel Beckert , https://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-|  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



Bug#880998: debian-goodies: checkrestart should error-out when failing to call lsof

2017-11-07 Thread Nicolas Braud-Santoni
On Mon, Nov 06, 2017 at 10:12:11PM +0100, Axel Beckert wrote:
> 
> Hi Nicolas,
> 
> Nicolas Braud-Santoni wrote:
> > PS: I included the patches as signed commit in the
> > collab-maint repository, in branch bug880998.
> 
> Thanks! That makes it way easier as "git am" choked on your bug report
> mail with the two patches.

That's interesting, I just generated the patches with
`git format-patch origin/master` and attached them to the mail with reportbug.
What would be the correct way to send multiple patches to a bug?

In any case, thanks for the swift reply.


Best,

  nicoo


signature.asc
Description: PGP signature


Bug#880998: debian-goodies: checkrestart should error-out when failing to call lsof

2017-11-06 Thread Axel Beckert
Control: tag -1 + pending

Hi Nicolas,

Nicolas Braud-Santoni wrote:
> PS: I included the patches as signed commit in the
> collab-maint repository, in branch bug880998.

Thanks! That makes it way easier as "git am" choked on your bug report
mail with the two patches.

Regards, Axel
-- 
 ,''`.  |  Axel Beckert , https://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-|  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



Bug#880998: debian-goodies: checkrestart should error-out when failing to call lsof

2017-11-06 Thread Nicolas Braud-Santoni
On Mon, Nov 06, 2017 at 09:47:08PM +0100, Nicolas Braud-Santoni wrote:
> checkrestart should instead error-out.
> Please find enclosed patches to that effect.


PS: I included the patches as signed commit in the
collab-maint repository, in branch bug880998.


signature.asc
Description: PGP signature


Bug#880998: debian-goodies: checkrestart should error-out when failing to call lsof

2017-11-06 Thread Nicolas Braud-Santoni
Package: debian-goodies
Version: 0.69.1
Severity: important
Tags: stretch buster patch

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Dear maintainers,

checkrestart fails without setting an error code when lsof is not found,
and reports 0 processes needing to be restarted:

$ sudo checkrestart
/bin/sh: 1: lsof: not found
Found 0 processes using old versions of upgraded files


checkrestart should instead error-out.
Please find enclosed patches to that effect.


Best,

  nicoo

-BEGIN PGP SIGNATURE-

iQJNBAEBCgA3FiEEiWEbFKE2h/s1SpJPnU+IAQz+GeMFAloAykkZHG5pY29sYXNA
YnJhdWQtc2FudG9uaS5ldQAKCRCdT4gBDP4Z4wm/EAC9zl+i3CtlfaVlFV22jY+F
iy5iJWqSKgEYPNjpwwbzQQgthLloDhYGnhWE8AL0kwwrKvYo1jbMLErny1QoYT/X
l4Vm6GRPlWJRXSU7+yU779JEBlYGyAmkKXbZPoxC7zPF157m39cANQ1IWeT6BwJh
DhmgkDyY3rxyfnWu1Q21w+Tj+5gXe/d4ZkyABBfDTDajmtkxT2SXADq6Dv80kAxw
vdvnB7+ChxtlCHPcScVlNu0NiiJaAC1s2gHEIej6JVVxHdi1C4MJ5D8/Q6+mviA5
Ei7+9yLl7AFrcUUrjY9DmBdgTFLclP1oghmeLcago7EATNrbITRD8ylpKEHW0XRj
zMQMras+apwcm213feBVNw4RkKroLIwWSVqNtg3wy7RfkJ9+Ume7qnA3O6ucIW5K
2GjDYT4LULQhMV1xvgtB2yoLYtS8xkoy38I3yZqzk+anYUV8ztmnV1VegCDlfCAu
rvx8B6vasQGxpDoU/D6wjOxPdjUtBCCj2iO5rq9YxnuvLskUj8w6FFM0k7PftLo/
c7R5WN6s0sm7JcaApmO7UcOfEi14YIkbf9rz92QM5P9D6YiMdVxyn5DFPC2cQYp+
kGTJkyDCMrrJ+aTZ+UFx6MHiH+HutZZRsXQ4P4WIUxTef2CxLSC54AI6l2/Z23hG
B/YNydO0wT1T+DJSTyqtpQ==
=u3oC
-END PGP SIGNATURE-
>From 6e97f7cf789fd8ab2672d9b4faff11de99e865bb Mon Sep 17 00:00:00 2001
From: Nicolas Braud-Santoni 
Date: Mon, 6 Nov 2017 21:44:18 +0100
Subject: [PATCH 1/2] checkrestart: Properly error-out when calling lsof fails

---
 checkrestart | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/checkrestart b/checkrestart
index 52dbc70..abf920d 100755
--- a/checkrestart
+++ b/checkrestart
@@ -320,9 +320,10 @@ def main():
 
 def lsoffilescheck(blacklist = None):
 # Use LSOF to extract the list of deleted files
+from subprocess import check_output
 processes = {}
 
-for line in os.popen('lsof +XL -F nf').readlines():
+for line in check_output(['lsof', '+XL', '-F', 'nf']).splitlines():
 field, data = line[0], line[1:-1]
 
 if field == 'p':
-- 
2.14.2

>From dc228ead6cddd9bd2ce6737388917ff236d48070 Mon Sep 17 00:00:00 2001
From: Nicolas Braud-Santoni 
Date: Mon, 6 Nov 2017 21:44:51 +0100
Subject: [PATCH 2/2] checkrestart: Properly error-out when calling pmap fails

---
 checkrestart | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/checkrestart b/checkrestart
index abf920d..4fc299a 100755
--- a/checkrestart
+++ b/checkrestart
@@ -364,6 +364,7 @@ def lsoffilescheck(blacklist = None):
 def procfilescheck(blacklist = None, excludepidlist = None):
 # Use the underlying /proc file system to determine processes that
 # are using deleted files
+from subprocess import check_output
 processes = {}
 # Get a list of running processes
 pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]
@@ -386,7 +387,7 @@ def procfilescheck(blacklist = None, excludepidlist = None):
 continue
 
 # Get the list of memory mapped files using system pmap
-for output in os.popen('pmap ' + pid).readlines():
+for output in check_output(['pmap', pid]).splitlines():
 data = re.split('\s+', output.strip('\n'), 3)
 if len(data) == 4:
 f = data[3]
-- 
2.14.2