Package: dhcpcd5
Version: 9.4.1-3
Severity: normal
Tags: patch, upstream

Dear Maintainer,

The script dhcpcd-run-hooks has code to skip hook scripts that should
not be run, either because the file name ends in "~" or because they're
listed in $skip_hooks.  However, if $skip_hooks is undefined or null,
the tests are not run at all, which means files with names ending with
"~" will be unexpectedly run.

This was reported to me privately by another Debian user, who had
attempted to manually apply my patch for 1008059, but found it wasn't
working as expected, as they had used an editor which left the old file
as a backup with that ~ extension.  The hook script is clearly intended
to skip over such files, but the skip doesn't take effect in the
mainline case.

I've attached a patch that fixes this on Debian.  This bug also seems to
be present in the upstream package, and I've provided the same patch at
<https://github.com/NetworkConfiguration/dhcpcd/pull/113>.

-- System Information:
Debian Release: 11.3
  APT prefers stable-updates
  APT policy: (990, 'stable-updates'), (990, 'stable-security'), (990, 
'stable'), (850, 'testing'), (500, 'unstable')
Architecture: arm64 (aarch64)
Foreign Architectures: armhf

Kernel: Linux 5.15.32-v8+ (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_CRAP
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dhcpcd5 depends on:
ii  dhcpcd-base  9.4.1-3
ii  lsb-base     11.1.0

dhcpcd5 recommends no packages.

Versions of packages dhcpcd5 suggests:
pn  dhcpcd-gtk               <none>
pn  openresolv | resolvconf  <none>

-- no debconf information
diff --git a/hooks/dhcpcd-run-hooks.in b/hooks/dhcpcd-run-hooks.in
index a237f6af..84465361 100644
--- a/hooks/dhcpcd-run-hooks.in
+++ b/hooks/dhcpcd-run-hooks.in
@@ -338,9 +338,11 @@ for hook in \
 	@HOOKDIR@/* \
 	@SYSCONFDIR@/dhcpcd.exit-hook
 do
+	case "$hook" in
+		*/*~)	continue;;
+	esac
 	for skip in $skip_hooks; do
 		case "$hook" in
-			*/*~)				continue 2;;
 			*/"$skip")			continue 2;;
 			*/[0-9][0-9]"-$skip")		continue 2;;
 			*/[0-9][0-9]"-$skip.sh")	continue 2;;

Reply via email to