Followup-For: Bug #801564
Control: found -1 3.5.23-2
Control: tag -1 + patch

Hi,

the way the fix was implemented has a small issue: it retains even an
unmodified configuration file from squid 2.7. This is no problem now,
but it will make the error show up again the next time the shipped
squid.conf changes (perhaps in buster). For now just debsums reports
that the configuration files are modified.

I'm attaching a patch that I tested in my piuparts instance and it
successfully solved the issue on upgrade paths starting from both
wheezy and lenny.
In the postinst compare the md5sum of squid.conf.pre3.5_upgrade to the
known shipped squid from squeeze/wheezy (first sum) and lenny (second
sum) and delete it if matched.
The else branch should be indented for better readability, I skipped
that in order to show that no changes are needed there.

Maybe this check should be performed in the preinst instead, and have
dpkg ask about the modified configuration file if there is a 2.7 config
with user modifications, but doing this and the neccessary rollback code
is much more complicated and error prone, and harder to test.


Andreas
diff -Nru squid3-3.5.23/debian/squid.postinst squid3-3.5.23/debian/squid.postinst
--- squid3-3.5.23/debian/squid.postinst	2017-04-08 02:03:35.000000000 +0200
+++ squid3-3.5.23/debian/squid.postinst	2017-04-27 22:25:42.000000000 +0200
@@ -60,7 +60,13 @@
 		# Use '< 2.8' version to catch backports and security versions >2.7.
 		#
 		if dpkg --compare-versions "$2" lt '2.8' && test -f /etc/squid/squid.conf.pre3.5_upgrade; then
-
+			md5pre35=$(md5sum /etc/squid/squid.conf.pre3.5_upgrade | awk '{ print $1 }')
+			if [ "$md5pre35" = "6d674d5f9842b50a2c691a135007c804" ] || \
+				[ "$md5pre35" = "5d85f7dce9a84082e23a656b3cb0c984" ]; then
+				# The old configuration file was unchanged from the version shipped
+				# with squid 2.7, keep the new one in place and delete the old one.
+				rm -f /etc/squid/squid.conf.pre3.5_upgrade
+			else
 			#
 			# Our special 2.x protection left squid.conf absent,
 			# so the new package installing put its own there.
@@ -72,6 +78,7 @@
 			# Restore the old user file as main squid.conf
 			#
 			mv /etc/squid/squid.conf.pre3.5_upgrade /etc/squid/squid.conf
+			fi
 		fi
 		#
 		# Chown the directories.

Reply via email to