File: 0006_skip_hooks_with_tilde.patch

package info (click to toggle)
dhcpcd5 9.4.1-24~deb12u4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,620 kB
  • sloc: ansic: 37,376; sh: 2,098; makefile: 359
file content (30 lines) | stat: -rw-r--r-- 1,040 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 55e3904961f453d65f82f76b591bf8fc71946fce Mon Sep 17 00:00:00 2001
From: Adam Dinwoodie <me-and@users.noreply.github.com>
Date: Fri, 29 Jul 2022 07:14:41 +0100
Subject: [PATCH] Always skip hooks ending in ~ (#113)

dhcpcd-run-hooks is intended to skip hooks with filenames ending in `~`,
but the test only works if `$skip_hooks` is defined and not empty.
Refactor the test such that files ending in `~` are always skipped, as
appears to be the intent of this code.
---
 hooks/dhcpcd-run-hooks.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hooks/dhcpcd-run-hooks.in b/hooks/dhcpcd-run-hooks.in
index c858da3b..b0dc2ea5 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;;