commit:     7faa918e54130698215f6c8230a174005462a8af
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Fri Feb  2 03:01:00 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  2 04:33:18 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7faa918e

app-misc/ca-certificates: fix ewwy gross warning when no hooks exist

In the previous patch to update-ca-certificates, a continuation was
omitted for the case where no hooks exist, and POSIX sh expanded the
glob to "*". Bash has nullglob for this, but the POSIX solution is to
check if it is a file and skip otherwise.

The result: running update-ca-certificates logged an exit 127 of the
hook, then blithely continued and returned overall success since hooks
aren't defined as required to succeed.

Instead, we avoid running nonexistent hooks, which avoids logging any
return values and still continues while returning overall success, so,
no actual difference. But it does look nicer.

Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...1-r1.ebuild => ca-certificates-20230311.3.96.1-r2.ebuild} |  0
 ...pdate-ca-certificates-drop-pointless-dependency-on-.patch | 12 +++++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/app-misc/ca-certificates/ca-certificates-20230311.3.96.1-r1.ebuild 
b/app-misc/ca-certificates/ca-certificates-20230311.3.96.1-r2.ebuild
similarity index 100%
rename from app-misc/ca-certificates/ca-certificates-20230311.3.96.1-r1.ebuild
rename to app-misc/ca-certificates/ca-certificates-20230311.3.96.1-r2.ebuild

diff --git 
a/app-misc/ca-certificates/files/0001-update-ca-certificates-drop-pointless-dependency-on-.patch
 
b/app-misc/ca-certificates/files/0001-update-ca-certificates-drop-pointless-dependency-on-.patch
index e64a42808552..bdcb9ce631db 100644
--- 
a/app-misc/ca-certificates/files/0001-update-ca-certificates-drop-pointless-dependency-on-.patch
+++ 
b/app-misc/ca-certificates/files/0001-update-ca-certificates-drop-pointless-dependency-on-.patch
@@ -1,4 +1,4 @@
-From 0d5077f59b12bcf64a0489c884e6715cb98ae4b3 Mon Sep 17 00:00:00 2001
+From c33e85bc2fe61e66e2fa5c2ab0efc4277b7cef5e Mon Sep 17 00:00:00 2001
 From: Eli Schwartz <[email protected]>
 Date: Mon, 29 Jan 2024 21:54:04 -0500
 Subject: [PATCH] update-ca-certificates: drop pointless dependency on external
@@ -25,22 +25,24 @@ It's very easy to replace with `printf %s\\n *`, so do so. 
Even if it
 wasn't easy to replace with printf, it would be easy to replace with
 `for x in *; "$x"; done` instead.
 ---
- image/usr/sbin/update-ca-certificates | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+ image/usr/sbin/update-ca-certificates | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/image/usr/sbin/update-ca-certificates 
b/image/usr/sbin/update-ca-certificates
-index bb5aa54..7abffc9 100755
+index bb5aa54..fbf1ee2 100755
 --- a/image/usr/sbin/update-ca-certificates
 +++ b/image/usr/sbin/update-ca-certificates
-@@ -218,7 +218,7 @@ then
+@@ -218,8 +218,9 @@ then
    echo "Running hooks in $HOOKSDIR..."
    VERBOSE_ARG=
    [ "$verbose" = 0 ] || VERBOSE_ARG="--verbose"
 -  eval run-parts "$VERBOSE_ARG" --test -- "$HOOKSDIR" | while read hook
 +  ( LC_ALL=C; printf %s\\n "$HOOKSDIR"/* ) | while read hook
    do
++    [ -f "$hook" ] || continue
      ( cat "$ADDED"
        cat "$REMOVED" ) | "$hook" || echo "E: $hook exited with code $?."
+   done
 -- 
 2.43.0
 

Reply via email to