[Bug 280275] ports-mgmt/pkg: Wrong exit code in periodic script 490.status-pkg-changes

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 14 Jul 2024 13:40:48 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280275

Andre Stoebe <andrestoebe@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|Affects Only Me             |Affects Some People

--- Comment #1 from Andre Stoebe <andrestoebe@gmail.com> ---
Actually, I think this whole list_rc dance is not needed and the original code
is fine.

The only change with my diff would be that the exit code of pkg and cmp is
passed-through and the periodic script might return > 2.

Here's a minimal diff for the original issue:

--- /usr/local/etc/periodic/daily/490.status-pkg-changes        2024-05-23
03:05:49.000000000 +0200
+++ 490.status-pkg-changes      2024-07-14 15:38:50.344033000 +0200
@@ -20,7 +20,8 @@
     rc=$?

     cmp -sz $bak/$bak_file $bak/${bak_file}2
-    if [ $? -eq 1 ]; then
+    rc=$?
+    if [ $rc -eq 1 ]; then
        diff -U 0 $bak/${bak_file}2 $bak/${bak_file} | \
            grep '^[-+][^-+]' | sort -k 1.2
     fi

-- 
You are receiving this mail because:
You are the assignee for the bug.