You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2016/02/05 17:23:28 UTC

[Bug 7295] New: kill -HUP (still) changes ps name

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7295

            Bug ID: 7295
           Summary: kill -HUP (still) changes ps name
           Product: Spamassassin
           Version: 3.4.1
          Hardware: PC
                OS: NetBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: spamc/spamd
          Assignee: dev@spamassassin.apache.org
          Reporter: prlw1@cam.ac.uk

Created attachment 5377
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5377&action=edit
exec using perl_from_hashbang_line patch

After bug 5255 came bug 5419 where the problem was a name change in ps output
from "spamd" to "perl" after a SIGHUP.

In the same vein, I am seeing the change "perl" to "perl5.22.1" after a SIGHUP.

This is because when run, ps will show $perl_from_hashbang_line. After a SIGHUP
do_sighup_restart will change it to $^X (perl's built in $EXECUTABLE_NAME)

I think you might hope that the two would be the same, however, surprisingly on
my NetBSD system, perl and perl5.22.1 are hard linked, and $EXECUTABLE_NAME
returns perl5.22.1 when running a script with #!/usr/pkg/bin/perl - see
http://gnats.netbsd.org/50772.

Given this odd case, is there any advantage to using $^X rather than
$perl_from_hashbang_file? As you would hope they are the same, I assume not,
and the following patch uses perl_from_hashbang_file, and if it isn't found,
uses $^X.

Thoughts?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7295] kill -HUP (still) changes ps name

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7295

--- Comment #5 from Matus UHLAR - fantomas <uh...@fantomas.sk> ---
just note that debian uses start-stop-daemon that takes pid file AND compares
process name so that pid file matches the running process.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7295] kill -HUP (still) changes ps name

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7295

Patrick Welche <pr...@cam.ac.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |prlw1@cam.ac.uk

--- Comment #1 from Patrick Welche <pr...@cam.ac.uk> ---
Maybe I should phrase this more strongly:

Currently, you
1) read the script to find the perl path from the #! line
2) read the environment variable $^X aka EXECUTABLE_NAME
3) hope that 1) == 2)
   if it is, all is well and execute
4) execute using the environment variable

The logic suggests that the #! line is the one to trust, not the
environment variable, and you already do the hard work to read that
line. The attached patch implements what appears to be the logic you
intend.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7295] kill -HUP (still) changes ps name

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7295

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WORKSFORME
                 CC|                            |apache@hege.li
             Status|NEW                         |RESOLVED

--- Comment #3 from Henrik Krohns <ap...@hege.li> ---
(In reply to Patrick Welche from comment #1)
> The logic suggests that the #! line is the one to trust

No it doesn't.

Obviously $perl_from_hashbang_line can't be trusted, because someone might
start spamd with "/usr/local/perl/bin/perl spamd". Then the hashbang is not
used.

Closing, since there are no replies and I'm not even sure what problem this
creates. Why not just pgrep -f spamd etc, why does perl executable in process
list matter?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7295] kill -HUP (still) changes ps name

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7295

--- Comment #7 from Matus UHLAR - fantomas <uh...@fantomas.sk> ---
disregard my comments:
spamd does NOT change title to "spamd" if debug is rned on, which I did.
sorry

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7295] kill -HUP (still) changes ps name

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7295

Kevin A. McGrail <km...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kmcgrail@apache.org

--- Comment #2 from Kevin A. McGrail <km...@apache.org> ---
Why are you sending SIGHUP's to spamd?  to reload rules or something?

Then you are seeing ps output change and that irks you, correct?

Have you tested the patch you submit it and does it work for you?  

Can you submit an ICLA? https://www.apache.org/licenses/icla.pdf

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7295] kill -HUP (still) changes ps name

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7295

Matus UHLAR - fantomas <uh...@fantomas.sk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uhlar@fantomas.sk

--- Comment #4 from Matus UHLAR - fantomas <uh...@fantomas.sk> ---
I use spamd from debian package, and this problem causes issues on my system
too. package uses sighup to reload rules after update.

# /etc/init.d/spamd start
Starting SpamAssassin Mail Filter Daemon: spamd.
# ps axuww | grep spamd
root       322 60.8  1.6 177024 132252 ?       Ss   15:43   0:04 /usr/bin/perl
-T -w /usr/sbin/spamd --max-children 4 --helper-home-dir --default-user=abuse
-D config -d --pidfile=/run/spamd.pid
root       329  0.0  1.5 177024 125240 ?       S    15:43   0:00 spamd child
root       330  0.0  1.5 177024 125304 ?       S    15:43   0:00 spamd child
root       332  0.0  0.0   7956   636 pts/4    S+   15:43   0:00 grep spamd
# /etc/init.d/spamd reload
Reloading SpamAssassin Mail Filter Daemon: spamd.
# ps axuww | grep spamd
root       322 27.6  0.2  32736 23904 ?        Ss   15:43   0:05 /usr/bin/perl
-T -w -I /etc/perl -I /usr/lib/i386-linux-gnu/perl5/5.32 -I /usr/share/perl5 -I
/usr/lib/i386-linux-gnu/perl-base -I /usr/lib/i386-linux-gnu/perl/5.32 -I
/usr/share/perl/5.32 /usr/sbin/spamd --max-children 4 --helper-home-dir
--default-user=abuse -D config -d --pidfile=/run/spamd.pid
abuse      342  128  0.6  69016 56176 ?        Rs   15:43   0:01 /usr/bin/perl
-T -w -I /etc/perl -I /usr/lib/i386-linux-gnu/perl5/5.32 -I /usr/share/perl5 -I
/usr/lib/i386-linux-gnu/perl-base -I /usr/lib/i386-linux-gnu/perl/5.32 -I
/usr/share/perl/5.32 /usr/sbin/spamd --max-children 4 --helper-home-dir
--default-user=abuse -D config -d --pidfile=/run/spamd.pid
root       345  0.0  0.0   7956   636 pts/4    S+   15:43   0:00 grep spamd
# /etc/init.d/spamd reload
Reloading SpamAssassin Mail Filter Daemon: No spamd found running; none killed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7295] kill -HUP (still) changes ps name

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7295

--- Comment #6 from Matus UHLAR - fantomas <uh...@fantomas.sk> ---
looking at processlist:

root      4181     1  2 11:35 ?        00:00:04 /usr/bin/perl -T -w -I
/etc/perl -I /usr/lib/i386-linux-gnu/perl5/5.32 -I /usr/share/perl5 -I
/usr/lib/i386-linux-gnu/perl-base -I /usr/lib/i386-linux-gnu/perl/5.32 -I
/usr/share/perl/5.32 /usr/sbin/spamd --max-children 4 --helper-home-dir
--default-user=abuse -D config -d --pidfile=/run/spamd.pid
root      4192  4181  0 11:35 ?        00:00:00 spamd child
root      4193  4181  0 11:35 ?        00:00:00 spamd child

 4181 ?        00:00:04 perl
 4192 ?        00:00:00 spamd child
 4193 ?        00:00:00 spamd child

testing with "perl" instead of "spamd":
# start-stop-daemon --stop --pidfile /run/spamd.pid --signal HUP --name spamd
No spamd found running; none killed.
# start-stop-daemon --stop --pidfile /run/spamd.pid --signal HUP --name perl
# 

looks that changing $0 to "spamd" after successful reload would fix this
problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.