Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 932744 - net-proxy/squid - init script incorrectly determines pidfile when chroot is enabled
Summary: net-proxy/squid - init script incorrectly determines pidfile when chroot is e...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Hank Leininger
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-05-25 18:14 UTC by Hank Leininger
Modified: 2024-07-03 13:26 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hank Leininger 2024-05-25 18:14:58 UTC
net-proxy/squid/files/squid.initd-r6 attempts to derive the pidfile path from reading the service's config file:

squid.initd-r6: local PIDFILE=$(cat ${CONFFILES} 2>/dev/null 3>/dev/null | awk '/^[ \t]*pid_filename[ \t]+/ { print $2 }')
...
squid.initd-r6: [ -z ${PIDFILE} ] && PIDFILE=/run/squid.pid
...

However, if squid.conf enables chroot ("chroot /var/chroot/squid" or whatnot), then that pid_filename will be relative to the chroot top. We don't account for that so we are looking in the wrong place.

Calling reload, rotate functions just calls squid -k ... and it reads the config correctly and does the right thing. stop() starts out doing the right thing too (calls squid -k shutdown), but then when we loop waiting for squid to exit (cleanup can take a while), we are watching for the pidfile in the wrong place and quit waiting immediately.

I think this bug has been present ever since pid_filename extraction was added in 2009.
Comment 1 Larry the Git Cow gentoo-dev 2024-07-03 13:26:40 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e3a9968929b0dbb164a56bcb18db0a5a86839a78

commit e3a9968929b0dbb164a56bcb18db0a5a86839a78
Author:     Hank Leininger <hlein@korelogic.com>
AuthorDate: 2024-05-25 17:44:57 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2024-07-03 13:26:37 +0000

    net-proxy/squid: add 6.9
    
    Fix some gcc-14 compilation issues, add upstream memleak fix patch,
    init script & logrotate/cron fixes.
    
    Closes: https://bugs.gentoo.org/932742
    Closes: https://bugs.gentoo.org/931123
    Closes: https://bugs.gentoo.org/932744
    Closes: https://bugs.gentoo.org/932750
    Signed-off-by: Hank Leininger <hlein@korelogic.com>
    Closes: https://github.com/gentoo/gentoo/pull/36815
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 net-proxy/squid/Manifest                          |   2 +
 net-proxy/squid/files/squid-6.9-memleak_fix.patch | 563 ++++++++++++++++++++++
 net-proxy/squid/files/squid.cron-r1               |  15 +
 net-proxy/squid/files/squid.initd-r7              | 133 +++++
 net-proxy/squid/files/squid.logrotate-r1          |  11 +
 net-proxy/squid/squid-6.9.ebuild                  | 391 +++++++++++++++
 6 files changed, 1115 insertions(+)