Page 1 of 1

1.22.1 zmupdate.pl problem and zmpkg.pl bug

Posted: Thu Apr 27, 2006 4:59 pm
by unclerichy
I always have a problem with zmupdate.pl so I tend to manually run everything. This time I decided to actually investigate...

The problem that I've always had is during the 'mysql < scripts/dbm/zm_update-1.22.0.sql' step it always complains about 'mysql' not found. It turns out that this is because the script sets the PATH to '/bin:/usr/bin'. My mysql lives in /usr/local/bin so I had to change the line

Code: Select all

$ENV{PATH}  = '/bin:/usr/bin';
to

Code: Select all

$ENV{PATH}  = '/bin:/usr/bin:/usr/local/bin';
Secondly, there's a bug in zmpkg.pl during the sudo/su code check - the final check for su has a missing single quote mark:

Code: Select all

$prefix = "su ".ZM_WEB_USER." -c ";
$suffix = "'";
$command = $prefix.$null_command.$suffix;
it should read

Code: Select all

$prefix = "su ".ZM_WEB_USER." -c '";
$suffix = "'";
$command = $prefix.$null_command.$suffix;
- note the single quote between the -c and the double quote?

As an aside, when running the sudo/su check it dumps all the output to the console which is a bit messy:

Code: Select all

Can't exec "sudo": No such file or directory at /usr/local/bin/zmpkg.pl line 252.
Use of uninitialized value in scalar chomp at /usr/local/bin/zmpkg.pl line 261.
Use of uninitialized value in concatenation (.) or string at /usr/local/bin/zmpkg.pl line 262.
/bin/sh: --shell=/bin/sh: invalid option
Usage:  /bin/sh [GNU long option] [option] ...
        /bin/sh [GNU long option] [option] script-file ...
GNU long options:
        --debug
        --debugger
        --dump-po-strings
        --dump-strings
        --help
        --init-file
        --login
        --noediting
        --noprofile
        --norc
        --posix
        --protected
        --rcfile
        --restricted
        --verbose
        --version
        --wordexp
Shell options:
        -irsD or -c command or -O shopt_option          (invocation only)
        -abefhkmnptuvxBCHP or -o option
Maybe for the next version an option in 'configure' to specify which su to use each time?

Posted: Thu Apr 27, 2006 9:29 pm
by zoneminder
Thanks for the report. I will apply the path and quote changes you suggest. The sudo stuff I have already done in 1.22.1, but forgot to upload until after I'd done the announcement.

I had thought about making it a config but most people probably don't know what is supported so zmpkg.pl does a test on startup to see what works. This is of course supposed to be hidden!