Subject: bug#32934: privoxy daemon fails to start

From: Pierre Neidhardt <[email-masked]>
Date: Thu, 04 Oct 2018 22:02:59 +0200

Currently privoxy can only be started in non-daemon mode:

--8<---------------cut here---------------start------------->8---
$ privoxy --no-daemon /gnu/store/d3q0nz8568j32gslkc3lskxpzmimcx9z-privoxy-3.0.26/etc/privoxy/config
--8<---------------cut here---------------end--------------->8---

In daemon mode, we get the following error:

--8<---------------cut here---------------start------------->8---
$ strace -f privoxy /gnu/store/d3q0nz8568j32gslkc3lskxpzmimcx9z-privoxy-3.0.26/etc/privoxy/config
...
clone(/home/ambrevar/.guix-profile/bin/strace: Process 11406 attached
child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fed1647ea10) = 11406
[pid 11406] set_robust_list(0x7fed1647ea20, 24 <unfinished ...>
[pid 11405] nanosleep({tv_sec=1, tv_nsec=0},  <unfinished ...>
[pid 11406] <... set_robust_list resumed> ) = 0
[pid 11406] setsid()                    = 11406
[pid 11406] close(0)                    = 0
[pid 11406] close(1)                    = 0
[pid 11406] openat(AT_FDCWD, "/dev/null", O_RDONLY) = 0
[pid 11406] openat(AT_FDCWD, "/dev/null", O_WRONLY) = 1
[pid 11406] chdir("/")                  = 0
[pid 11406] stat("/gnu/store/d3q0nz8568j32gslkc3lskxpzmimcx9z-privoxy-3.0.26/etc/privoxy/config", {st_mode=S_IFREG|0444, st_size=68434, ...}) = 0
[pid 11406] brk(NULL)                   = 0x6b2000
[pid 11406] brk(0x6d3000)               = 0x6d3000
[pid 11406] openat(AT_FDCWD, "/gnu/store/d3q0nz8568j32gslkc3lskxpzmimcx9z-privoxy-3.0.26/etc/privoxy/config", O_RDONLY) = 3
[pid 11406] fstat(3, {st_mode=S_IFREG|0444, st_size=68434, ...}) = 0
[pid 11406] read(3, "#        Sample Configuration Fi"..., 4096) = 4096
[pid 11406] read(3, "#      The best all purpose solu"..., 4096) = 4096
[pid 11406] read(3, "et:\n#\n#      The templates are a"..., 4096) = 4096
[pid 11406] read(3, "#\n#  Default value:\n#\n#      Uns"..., 4096) = 4096
[pid 11406] read(3, "tten to the network\n#        deb"..., 4096) = 4096
[pid 11406] read(3, " machines (e.g. on\n#      your l"..., 4096) = 4096
[pid 11406] read(3, "(e.g Java) is also\n#      capabl"..., 4096) = 4096
[pid 11406] read(3, "[:port][/dst_masklen]]\n#\n#      "..., 4096) = 4096
[pid 11406] read(3, "\n#      an IPv4 address (not sup"..., 4096) = 4096
[pid 11406] read(3, "roxy but are made directly to th"..., 4096) = 4096
[pid 11406] read(3, "voxy and Tor, both running on th"..., 4096) = 4096
[pid 11406] read(3, "ifies:\n#\n#      Whether requests"..., 4096) = 4096
[pid 11406] read(3, "ing on the client connection is "..., 4096) = 4096
[pid 11406] read(3, "he \"No server or forwarder data\""..., 4096) = 4096
[pid 11406] read(3, "      resources are being blocke"..., 4096) = 4096
[pid 11406] read(3, "           |\n#      |-----------"..., 4096) = 4096
[pid 11406] read(3, " client's IP address from\n#     "..., 4096) = 2898
[pid 11406] read(3, "", 4096)           = 0
[pid 11406] close(3)                    = 0
[pid 11406] openat(AT_FDCWD, "/gnu/store/d3q0nz8568j32gslkc3lskxpzmimcx9z-privoxy-3.0.26/var/log/privoxy/logfile", O_WRONLY|O_CREAT|O_APPEND, 0666) = -1 EACCES (Permission denied)
[pid 11406] close(2)                    = 0
[pid 11406] openat(AT_FDCWD, "/gnu/store/d3q0nz8568j32gslkc3lskxpzmimcx9z-privoxy-3.0.26/var/log/privoxy/logfile", O_WRONLY|O_CREAT|O_APPEND, 0666) = -1 EACCES (Permission denied)
[pid 11406] exit_group(1)               = ?
[pid 11406] +++ exited with 1 +++
<... nanosleep resumed> {tv_sec=0, tv_nsec=998431322}) = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=11406, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
restart_syscall(<... resuming interrupted nanosleep ...>) = 0
wait4(11406, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], WNOHANG, NULL) = 11406
exit_group(1)                           = ?
+++ exited with 1 +++
--8<---------------cut here---------------end--------------->8---

We probably need to patch privoxy so that it writes the logfile to
/var/log/privoxy/logfile instead of inside the store.

-- 
Pierre Neidhardt
https://ambrevar.xyz/