$NetBSD: patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm,v 1.3 2022/09/27 01:20:39 gdt Exp $ Perl doesn't really support "> /dev/null", so just capture into $output. % ktruss -i perl -e 'qx(does-not-exist >/dev/null 2>&1);'|egrep 'dup2.*2' does-not-exist: not found % ktruss -i perl -e 'qx(does-not-exist 2>&1);'|egrep 'dup2.*2' 16954 1 perl dup2(0x1, 0x2) = 2 The problem is that, whilst Perl supports 2>&1 internally (and does not use the shell at all) if there is no other redirection, it does not support file redirection - it defers that (and therefore necessarily must also defer the stderr redirection) to the shell. If the system's shell happens to report "Not found" errors before redirection is processed (E.g. NetBSD shell) then the stderr redirection is happening too late to be captured. That leads to unintended errors reported on stderr - primarily if sudo is not installed on the system, or not in the $PATH. Use the -m parameter to su, as ZM_WEB_USER shouldn't require a login shell. --- scripts/ZoneMinder/lib/ZoneMinder/General.pm.orig 2019-02-22 15:38:47.000000000 +0000 +++ scripts/ZoneMinder/lib/ZoneMinder/General.pm @@ -129,7 +129,7 @@ sub getCmdFormat { chomp( $output ); Debug( "Test failed, '$output'\n" ); - $prefix = "su ".$Config{ZM_WEB_USER}." -c '"; + $prefix = "su -m ".$Config{ZM_WEB_USER}." -c '"; $suffix = "'"; $command = $prefix.$null_command.$suffix; Debug( "Testing \"$command\"\n" );