tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

www/tinyproxy issues under netbsd/amd64 (11.0_STABLE)



hi-

    There are a couple of issues with www/tinyproxy:

[1] the package provides a "files/tinyproxy.sh" rc.d file (via RCD_SCRIPTS).
    the tinyproxy.sh script file assumes that the directory /var/run/tinyproxy
    has already been created (e.g. by the @exec lines in PLIST).

    this works fine, until you reboot and /etc/rc.d/clearcritlocal
    does "cd /var/run && rm -rf -- *" and blows that directory away.
    That causes tinyproxy to fail to start with this error:

# /usr/pkg/bin/tinyproxy -d
tinyproxy: Could not create file /var/run/tinyproxy/tinyproxy.pid: No such file or directory


    I think the solution to this is to copy what is done in
    /etc/rc.d/mdnsd with the start_precmd:

--- /tmp/tinyproxy_ORIG	2026-09-25 11:56:39.334016066 -0400
+++ /etc/rc.d/tinyproxy	2026-09-25 11:57:34.470342487 -0400
@@ -13,6 +13,16 @@
 command="/usr/pkg/bin/${name}"
 pidfile="/var/run/tinyproxy/${name}.pid"
 required_files="/usr/pkg/etc/${name}.conf"
+start_precmd="tinyproxy_precmd"
+
+tinyproxy_precmd()
+{
+    if [ ! -d /var/run/tinyproxy ]; then
+        mkdir -p -m 755 /var/run/tinyproxy
+    fi
+    chown tinyproxy:tinyproxy /var/run/tinyproxy
+}
+
 
 load_rc_config $name
 run_rc_command "$1"

    unless there is a better way?


[2] the package PLIST creates /var/log/tinyproxy using an @exec.
    but the example tinyproxy.conf has both the LogFile and Syslog
    commented out:

# egrep '^#LogFile|^#Syslog' /usr/pkg/share/examples/tinyproxy/tinyproxy.conf.default
#LogFile "/var/log/tinyproxy/tinyproxy.log"
#Syslog On

    this causes tinyproxy to disable logging at startup with the warning:

        # /etc/rc.d/tinyproxy start
        Starting tinyproxy.
        WARNING: logging deactivated (can't log to stdout when daemonized)

    looking at the code, it prints that WARNING if both the LogFile and
    the Syslog are disabled (which makes sense).  the source code says
    it can only log to one or the other (not both).

    so if pkgsrc wants tinyproxy to use the /var/log/tinyproxy directory
    it created, it should uncomment the LogFile directive in the conf file?
    I think that could be done with an updated patch-etc_tinyproxy.conf.in
    file?


    though it might be nice if there were some sort of pkgsrc option
    that let the user choose to direct logs to either the file or
    syslog, but i'm not sure how you'd do that.


chuck


Home | Main Index | Thread Index | Old Index