init.d script fails to set socket ownership and permissions on slower systems
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
amavisd-milter (Ubuntu) |
Fix Released
|
Undecided
|
Harald Jenny |
Bug Description
I've just started using amavisd-milter on an 'older' (i.e. slow) server, and I encountered a problem with the init.d startup script (/etc/init.
This meant that the ownership and permissions specified in /etc/default/
The solution to this problem is to have the startup script wait until the socket is created, before attempting to set the ownership and permissions.
I've updated the script on my server to resolve the problem, and I'd like to submit this as a patch, but I'm having trouble finding out which project to check out (i.e. with bzr branch lp:PROJECT-NAME)? Perhaps it is because there is an upstream project that I should be using instead? Please point me in the right direction?
System information:
# lsb_release -rd
Description: Ubuntu 18.04.5 LTS
Release: 18.04
# apt-cache policy amavisd-milter
amavisd-milter:
Installed: 1.5.0-5
Candidate: 1.5.0-5
Version table:
*** 1.5.0-5 500
500 http://
100 /var/lib/
Thanks,
Nick.
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 WNER" ]; then WNER" "$MILTERSOCKET" WNER" ]; then WNER" "$MILTERSOCKET"
82d81
< log_end_msg 0
84,88c83,99
< if [ "$MILTERSOCKETO
< chown "$MILTERSOCKETO
< 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 [ "$MILTERSOCKETO
> chown "$MILTERSOCKETO
> 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