Here is the fix that I'm using (complete updated file is also attached).
The updated init.d script checks that the socket exists before executing
the chown/chmod commands. If it doesn't exist, it sleeps for 1 second
and rechecks, repeating if necessary up to 5 times, before logging a
warning if the socket still doesn't exist.

$ diff amavisd-milter.old amavisd-milter
82d81
<                  log_end_msg 0
84,88c83,99
<                    if [ "$MILTERSOCKETOWNER" ]; then
<                      chown "$MILTERSOCKETOWNER" "$MILTERSOCKET"
<                    fi
<                    if [ "$MILTERSOCKETMODE" ]; then
<                      chmod "$MILTERSOCKETMODE" "$MILTERSOCKET"
---
>                    # Wait for up to 5 seconds for unix socket to be created
>                    for i in 1 2 3 4 5; do
>                      if [ -S "$MILTERSOCKET" ]; then
>                        break
>                      fi
>                      sleep 1
>                    done
>                    # Set ownership and permissions on unix socket as 
> appropriate
>                    if [ -S "$MILTERSOCKET" ]; then
>                      if [ "$MILTERSOCKETOWNER" ]; then
>                        chown "$MILTERSOCKETOWNER" "$MILTERSOCKET"
>                      fi
>                      if [ "$MILTERSOCKETMODE" ]; then
>                        chmod "$MILTERSOCKETMODE" "$MILTERSOCKET"
>                      fi
>                    else
>                      log_warning_msg "timed out waiting for pipe to be 
> created"
90a102
>                  log_end_msg 0


** Attachment added: "Updated init.d script (containing fix)"
   
https://bugs.launchpad.net/ubuntu/+source/amavisd-milter/+bug/1915501/+attachment/5463509/+files/amavisd-milter

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1915501

Title:
  init.d script fails to set socket ownership and permissions on slower
  systems

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/amavisd-milter/+bug/1915501/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to