On Wed, Oct 05, 2022 at 04:56:57PM +0200, Alexander Hall wrote:
> While I dislike the ">/dev/null 2>&1" sledgehammer, this is in the right 
> direction.

Agreed.

We should be fine silencing only the test condition which produces legit
output and warnings.

All else produces no output and should not error out;  if it does, those
warnings should be printed and fixed.

Feedback? OK?

Index: install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1210
diff -u -p -U4 -r1.1210 install.sub
--- install.sub 5 Oct 2022 19:30:47 -0000       1.1210
+++ install.sub 9 Oct 2022 22:43:41 -0000
@@ -3316,17 +3316,17 @@ check_unattendedupgrade() {
 
        _d=${_d%% *}
        if [[ -n $_d ]]; then
                make_dev $_d
-               if mount -t ffs -r /dev/${_d}a /mnt; then
+               if mount -t ffs -r /dev/${_d}a /mnt >/dev/null 2>&1; then
                        [[ -f /mnt/bsd.upgrade && -f /mnt/auto_upgrade.conf ]]
                        _rc=$?
                        ((_rc == 0)) && cp /mnt/auto_upgrade.conf /
                        echo "Which disk is the root disk = ${_d}" >> 
/auto_upgrade.conf
                        umount /mnt
                fi
                rm -f /dev/{r,}$_d?
-       fi >/dev/null 2>&1
+       fi
 
        return $_rc
 }
 

Reply via email to