tags 817927 fixed-upstream
thanks

Hi Francois,

needrestart uses the default Getopt::Std implementation shipped by
perl-modules - but python implements a custom getopts parser and
handles '-c' in the special way you've already described.

I dislike reimplementing the python approach again, but other
languages might make simular problems (i.e. perl using -e).

The upcoming needrestart 2.8 release will silence any getopts warnings
about unknown options. Furthermore, interpreters will be skipped if
they are using command line options (python -c, perl -e|E, ruby -e)


Thx & HTH,
Thomas


On Fri, Mar 11, 2016 at 06:22:51PM +0100, [email protected] 
wrote:
> Package: needrestart
> Version: 1.2-8+deb8u1
> Severity: normal
> Tags: upstream
> 
> Dear Maintainer,
> 
> I have installed needrestart on a number of jessie systems.
>  Yesterday, I upgraded a machine from wheezy to jessie,
> This system acts as a buildmaster.
>  and asoon asI instaled needrestart, I get the following warnings after
> each run of apt/aptitude::
> =================
> [Core] Using UI 'NeedRestart::UI::stdio'...
> [main] detected systemd
> [Core] #1537 is a NeedRestart::Interp::Python
> Unknown option: -
> Unknown option: n
> Unknown option: o
> Unknown option: _
> Unknown option: a
> Unknown option: e
> Unknown option: -
> Unknown option: l
> Unknown option: o
> Unknown option: g
> Unknown option: f
> Unknown option: l
> Unknown option: e
> Unknown option: =
> Unknown option: w
> Unknown option: .
> Unknown option: l
> Unknown option: o
> Unknown option: g
> Unknown option: -
> Unknown option: p
> Unknown option: y
> Unknown option: o
> Unknown option: n
> Unknown option: =
> Unknown option: b
> Unknown option: l
> Unknown option: b
> Unknown option: o
> Unknown option: .
> Unknown option: a
> [Python] #1537: could not get a source file, skipping
> =================
> 
> 
> The 1537 processus is the twisted daemon (buildmaster)
> fp2x@drbuildbot:~$ ps -edf | fgrep 1537
> buildbot  1537     1  0 10:24 ?        00:00:05 /usr/bin/python -c from 
> twisted.scripts import twistd; twistd.run() --no_save --logfile=twistd.log 
> --python=buildbot.tac
> fp2x     13192 10967  0 17:34 pts/1    00:00:00 grep -F --color=auto 1537
> fp2x@drbuildbot:~$ cat /proc/1537/cmdline | tr '\0' '\n'
> /usr/bin/python
> -c                                                [1]
> from twisted.scripts import twistd; twistd.run()  [2]
> --no_save                                         [3]
> --logfile=twistd.log                              [4]
> --python=buildbot.tac                             [5]
> 
> Extract of /usr/share/perl5/NeedRestart/Interp/Python.pm
>    104      # get original ARGV
>    105      (my $bin, local @ARGV) = nr_parse_cmd($pid);
> 
>    106      # eat Python's command line options
>    107      my %opts;
>    108      getopts('BdEhim:ORQ:sStuvVW:x3?c:', \%opts);
> 
>    109      # extract source file
>    110      unless($#ARGV > -1) {
>    111          chdir($cwd);
>    112          print STDERR "$LOGPREF #$pid: could not get a source file, 
> skipping\n" if($self->{debug});
>    113          return ();
>    114      }
>    115      my $src = $ARGV[0];
> 
> We see that the getops() in line 108 emits a warning for each letter in 
> lines
> [3] through [5] of ARGV which is not in the 'BdEhim:ORQ:sStuvVW:x3?c: set
> 
> This parsing of a python command line is wrong. getopts() should be 
> applied
> only to the part of ARGV which is before the '-c' option.
> 
> The [3-[5] parameters are interpreted by the python twited daemon 
> instance.
> 
> I am not at ease enough with perl programming to provide a patch but the 
> logic is
> Search backwards the (python) command line  (argv) if there is a '-c' 
> option.
> If the '-c' option is found, please ignore all the following tokens, and
> thre is no hope to detect a source file.
> 
> IMHO, it is not a packagning bug, and it can affect a number of systems.
> 
> 
> -- Package-specific info:
> needrestart output:
> Running kernel seems to be up-to-date.
> No services need to be restarted.
> 
> checkrestart output:
> 
> 
> -- System Information:
> Debian Release: 8.3
>   APT prefers stable-updates
>   APT policy: (500, 'stable-updates'), (500, 'stable')
> Architecture: amd64 (x86_64)
> 
> Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
> Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
> 
> Versions of packages needrestart depends on:
> ii  dpkg                       1.17.26
> ii  libmodule-find-perl        0.12-1
> ii  libmodule-scandeps-perl    1.16-1
> ii  libproc-processtable-perl  0.51-1
> ii  libsort-naturally-perl     1.03-1
> ii  libterm-readkey-perl       2.32-1+b1
> ii  perl                       5.20.2-3+deb8u4
> 
> needrestart recommends no packages.
> 
> needrestart suggests no packages.
> 
> -- no debconf information
> 
> Cordialement,
> Regards,
> Mit freundlichen Grüßen,
> مع  تحياتي الخالصة  
> ---
> F. Petitjean
> Bureau Veritas
> 
> Département Recherche, le département de l'excellence technique
> 
> Fier d'être depuis 40 ans au service de Bureau Veritas Branche Marine
> 
> Moi, lorsque je n’ai rien à dire, je veux qu’on le sache. (R. Devos)
> 
> This message contains confidential information. 
> To know more, please click on the following link: 
> http://disclaimer.bureauveritas.com
--

    ::  WWW:                        https://fiasko-nw.net/~thomas/  ::
   :::  Jabber:                   xmpp:[email protected]  :::
    ::  flickr:             https://www.flickr.com/photos/laugufe/  ::

Reply via email to