<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>215031</bug_id>
          
          <creation_ts>2008-03-27 11:44 0000</creation_ts>
          <short_desc>mail-filter/postgrey-1.31 init script doesn&apos;t work with openrc and it usually appears died</short_desc>
          <delta_ts>2008-05-21 18:46:16 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Ebuilds</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>mrfree@infinito.it</reporter>
          <assigned_to>net-mail@gentoo.org</assigned_to>
          <cc>casta@xwing.info</cc>
    
    <cc>gentoo@obeliks.de</cc>
    
    <cc>gentoo@obfusc8.org</cc>
    
    <cc>neil@digimed.co.uk</cc>
    
    <cc>reuben-gentoo-bugzilla@reub.net</cc>

      

      
          <long_desc isprivate="0">
            <who>mrfree@infinito.it</who>
            <bug_when>2008-03-27 11:44:34 0000</bug_when>
            <thetext>For the problem with OpenRC replacing the --exec args with the following is enough:

start-stop-daemon --start --quiet --background \
  --exec /usr/bin/perl -- -T -w /usr/sbin/postgrey \
  --${POSTGREY_ADDR} \
  --daemonize \
  --pidfile=${POSTGREY_PID} \
  ${POSTGREY_DELAY_ARG} \
  ${POSTGREY_OPTS} \
  &quot;${POSTGREY_TEXT_ARG}&quot;

(I inverted the last two args as suggested in #213709 too)


When the service starts (it happens with the in-tree init script too):
 * Starting Postgrey ...                  [ok]
 * start-stop-daemon: caught an interrupt [ok]

but the daemon works well</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2008-03-27 11:58:09 0000</bug_when>
            <thetext>Please, attach a unified diff next time; a whole lot easier to review any changes.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dertobi123@gentoo.org</who>
            <bug_when>2008-04-06 15:43:41 0000</bug_when>
            <thetext>Fixed in CVS.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gentoo@obfusc8.org</who>
            <bug_when>2008-04-08 12:51:44 0000</bug_when>
            <thetext>And this breaks without openrc, suggest you find some other way of fixing the problem than by breaking sysvinit.

If there&apos;s another perl script running start-stop-daemon dies with &apos;/usr/bin/perl already running&apos;.  Suggest reversion until someone comes up with a new fix for openrc.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dertobi123@gentoo.org</who>
            <bug_when>2008-04-08 16:42:06 0000</bug_when>
            <thetext>uhrm, I did test this with both latest (stable) baselayout and openrc ... please give me a few more details on your setup please.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gentoo@obfusc8.org</who>
            <bug_when>2008-04-08 19:19:48 0000</bug_when>
            <thetext>(In reply to comment #4)
&gt; uhrm, I did test this with both latest (stable) baselayout and openrc ...
&gt; please give me a few more details on your setup please.
&gt; 

# qlist -IvC baselayout sysvinit postgrey
mail-filter/postgrey-1.31-r1
sys-apps/baselayout-1.12.11.1
sys-apps/sysvinit-2.86-r10

All latest stable as of yesterday except for postgrey.  Error only occurs if there is another perl daemon running (I&apos;m guessing spamd in my case, though I haven&apos;t bothered to trace it since calling /usr/sbin/postgrey directly instead of /usr/bin/perl resolved it for me.

Anything further I can provide that will help you verify it?  I guess I could strace it and post the log if you want, so you can see where the conflict occurs...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dertobi123@gentoo.org</who>
            <bug_when>2008-04-10 17:09:50 0000</bug_when>
            <thetext>I reverted the change for now. If someone has a proper fix for this ... please post a diff ;)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>casta@xwing.info</who>
            <bug_when>2008-04-16 17:36:52 0000</bug_when>
            <thetext>Created an attachment (id=149963)
postgrey-openrc-fix.patch

I suggest adding a &quot;--name&quot; option to start-stop-daemon
Seems to fix the problem with openrc. I have no baselayout 1.12 box to do a non-regression test, but I do not think it hurts...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dertobi123@gentoo.org</who>
            <bug_when>2008-04-16 18:04:09 0000</bug_when>
            <thetext>(In reply to comment #7)
&gt; Created an attachment (id=149963) [edit]
&gt; postgrey-openrc-fix.patch
&gt; 
&gt; I suggest adding a &quot;--name&quot; option to start-stop-daemon
&gt; Seems to fix the problem with openrc. I have no baselayout 1.12 box to do a
&gt; non-regression test, but I do not think it hurts...
&gt; 

tested on systems with both OpenRC plus baselayout 1.12 - working and committed to CVS. Thanks for your patch!</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gentoo@obeliks.de</who>
            <bug_when>2008-05-18 15:21:01 0000</bug_when>
            <thetext>(In reply to comment #7)
&gt; Created an attachment (id=149963) [edit]
&gt; postgrey-openrc-fix.patch
&gt; 
&gt; I suggest adding a &quot;--name&quot; option to start-stop-daemon
&gt; Seems to fix the problem with openrc. I have no baselayout 1.12 box to do a
&gt; non-regression test, but I do not think it hurts...
&gt; 

I know this bug is closed, but I think the more elegant solution would be to use --pidfile with both start-stop-daemon and postgrey. After all, that&apos;s what the PID file is for ;) Patch coming right up.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gentoo@obeliks.de</who>
            <bug_when>2008-05-18 15:21:56 0000</bug_when>
            <thetext>Created an attachment (id=153563)
add --pidfile to start-stop-daemon in start()

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dertobi123@gentoo.org</who>
            <bug_when>2008-05-21 18:16:38 0000</bug_when>
            <thetext>(In reply to comment #10)
&gt; Created an attachment (id=153563) [edit]
&gt; add --pidfile to start-stop-daemon in start()
&gt; 

--pidfile is already set ...

&lt;-- snip --&gt;
start-stop-daemon --start --quiet --background \
                --name postgrey \
                --exec /usr/sbin/postgrey -- \
                --${POSTGREY_ADDR} \
                --daemonize \
                --pidfile=${POSTGREY_PID} \
                ${POSTGREY_DELAY_ARG} \
                ${POSTGREY_OPTS} \
                &quot;${POSTGREY_TEXT_ARG}&quot;
        eend ${?}
&lt;-- snip --&gt;</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gentoo@obeliks.de</who>
            <bug_when>2008-05-21 18:31:12 0000</bug_when>
            <thetext>(In reply to comment #11)
&gt; (In reply to comment #10)
&gt; &gt; Created an attachment (id=153563) [edit]
&gt; &gt; add --pidfile to start-stop-daemon in start()
&gt; &gt; 
&gt; 
&gt; --pidfile is already set ...

--pidfile is set as a param to postgrey, which results in the pidfile being created in the first place. But if you also pass it to start-stop-daemon, it checks for the pidfile/pid instead of the name passed to --exec, which solves the mentioned problem (in a more elegant way than using --name, imho). Hence the patch.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dertobi123@gentoo.org</who>
            <bug_when>2008-05-21 18:46:16 0000</bug_when>
            <thetext>(In reply to comment #12)
&gt; --pidfile is set as a param to postgrey, which results in the pidfile being
&gt; created in the first place. But if you also pass it to start-stop-daemon, it
&gt; checks for the pidfile/pid instead of the name passed to --exec, which solves
&gt; the mentioned problem (in a more elegant way than using --name, imho). Hence
&gt; the patch.
&gt; 

Missed that ... added the patch and added =postgrey-1.31-r2 to CVS. Thanks Bernhard!</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>149963</attachid>
            <date>2008-04-16 17:36 0000</date>
            <desc>postgrey-openrc-fix.patch</desc>
            <filename>postgrey-openrc-fix.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIGZpbGVzL3Bvc3RncmV5LnJjLm5ldy5vbGQJMjAwOC0wNC0xNiAxOTozMjo0Ny4wMDAwMDAw
MDAgKzAyMDAKKysrIGZpbGVzL3Bvc3RncmV5LnJjLm5ldwkyMDA4LTA0LTE2IDE5OjM0OjA4LjAw
MDAwMDAwMCArMDIwMApAQCAtNzYsNiArNzYsNyBAQAogCWZpCiAKIAlzdGFydC1zdG9wLWRhZW1v
biAtLXN0YXJ0IC0tcXVpZXQgLS1iYWNrZ3JvdW5kIFwKKwkJLS1uYW1lIHBvc3RncmV5IFwKIAkJ
LS1leGVjIC91c3Ivc2Jpbi9wb3N0Z3JleSAtLSBcCiAJCS0tJHtQT1NUR1JFWV9BRERSfSBcCiAJ
CS0tZGFlbW9uaXplIFwK
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>153563</attachid>
            <date>2008-05-18 15:21 0000</date>
            <desc>add --pidfile to start-stop-daemon in start()</desc>
            <filename>postgrey-initrc-pidfile.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIHBvc3RncmV5ICAgICAgICAgICAyMDA4LTA1LTE4IDE3OjE4OjA5LjAwMDAwMDAwMCArMDIw
MAorKysgcG9zdGdyZXkucGF0Y2hlZCAgIDIwMDgtMDUtMTggMTc6MTc6NTcuMDAwMDAwMDAwICsw
MjAwCkBAIC03Niw2ICs3Niw3IEBACiAgICAgICAgZmkKCiAgICAgICAgc3RhcnQtc3RvcC1kYWVt
b24gLS1zdGFydCAtLXF1aWV0IC0tYmFja2dyb3VuZCBcCisgICAgICAgICAgICAgICAtLXBpZGZp
bGU9JHtQT1NUR1JFWV9QSUR9IFwKICAgICAgICAgICAgICAgIC0tZXhlYyAvdXNyL2Jpbi9wZXJs
IC0tIC1UIC13IC91c3Ivc2Jpbi9wb3N0Z3JleSBcCiAgICAgICAgICAgICAgICAtLSR7UE9TVEdS
RVlfQUREUn0gXAogICAgICAgICAgICAgICAgLS1kYWVtb25pemUgXAo=
</data>        

          </attachment>
    </bug>

</bugzilla>