Merge lp:~clint-fewbar/ubuntu/natty/squid/fix-upgrades-after-reload into lp:ubuntu/natty/squid

Proposed by Clint Byrum on 2011-02-16
Status: Merged
Merged at revision: 58
Proposed branch: lp:~clint-fewbar/ubuntu/natty/squid/fix-upgrades-after-reload
Merge into: lp:ubuntu/natty/squid
Diff against target: 55 lines (+37/-0)
2 files modified
debian/changelog (+7/-0)
debian/preinst (+30/-0)
To merge this branch: bzr merge lp:~clint-fewbar/ubuntu/natty/squid/fix-upgrades-after-reload
Reviewer Review Type Date Requested Status
Ubuntu Sponsors Team 2011-02-16 Pending
Review via email: mp+49918@code.launchpad.net

Description of the change

This is the same merge as the one proposed with lucid, except I've removed the check for what version we're upgrading from. Ultimately, this is a useful check no matter what, given that the user could have refused to merge the upstart job file if it has local changes.

I have not tested it as thorougly on natty as I did on lucid, though I did at least check to see that it installs and runs the code appropriately if the squid job has lost track of its squid daemon.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-01-11 10:49:37 +0000
3+++ debian/changelog 2011-02-16 05:22:55 +0000
4@@ -1,3 +1,10 @@
5+squid (2.7.STABLE9-2.1ubuntu3) natty; urgency=low
6+
7+ * Detect and deal with the situation where upstart has lost track of
8+ squid. (LP: #717397)
9+
10+ -- Clint Byrum <clint@ubuntu.com> Tue, 15 Feb 2011 07:00:38 -0800
11+
12 squid (2.7.STABLE9-2.1ubuntu2) natty; urgency=low
13
14 * Run squid with -N and drop 'expect fork' to prevent HUP's from
15
16=== modified file 'debian/preinst'
17--- debian/preinst 2010-04-16 09:00:19 +0000
18+++ debian/preinst 2011-02-16 05:22:55 +0000
19@@ -52,6 +52,36 @@
20 chsh -s /bin/sh proxy
21 fi
22
23+# Because of this bug:
24+# https://bugs.launchpad.net/bugs/573853
25+# Upstart may have lost track of squid. Correct that by using the
26+# pid file to stop it and then start the job back up
27+if [ "$1" = "upgrade" ] \
28+ && [ -f "/var/run/squid.pid" ] \
29+ && [ -f "/etc/init/squid.conf" ]
30+then
31+ SQUID_PID=`cat /var/run/squid.pid`
32+ # is this still running, and actually squid
33+ if [ -d "/proc/${SQUID_PID}" ] \
34+ && [ "`stat -L -c %D%i /proc/${SQUID_PID}/exe`" = "`stat -L -c %D%i /usr/sbin/squid`" ]
35+ then
36+ UPSTART_SQUID_PID=`initctl status squid | awk -F'process ' '/start\/running, process / { print $2 }'`
37+ PIDFILE_PPID=`awk '{print $4}' /proc/$SQUID_PID/stat`
38+ # If the user has disabled expect fork the pids will be the same
39+ if [ "$UPSTART_SQUID_PID" != "$SQUID_PID" -a "$PIDFILE_PPID" != "$UPSTART_SQUID_PID" ]
40+ then
41+ # stop the job
42+ if invoke-rc.d squid stop
43+ then
44+ # kill the pid file pid
45+ kill ${SQUID_PID}
46+ # start the job again
47+ invoke-rc.d squid start
48+ fi
49+ fi
50+ fi
51+fi
52+
53 #DEBHELPER#
54
55 exit 0

Subscribers

People subscribed via source and target branches

to all changes: