Jeff,

You are correct that the $vars and %Conf options are missing.  I just committed
a fix
<https://github.com/backuppc/backuppc/commit/357e8376f6f659a1b2281f9172c8b62e8f4e21e7>
.

Craig

On Sat, May 18, 2019 at 9:29 PM <backu...@kosowsky.org> wrote:

> backu...@kosowsky.org wrote at about 23:19:58 -0400 on Saturday, May 18,
> 2019:
>  > Seems like @args is passed to cmdExecOrEval (e.g., when eval'ing
>  > Pre/Pos commands) but not used in the function itself.
>  > Same is true for the analogous cmdSystemOrEvalLong command.
>  >
>  >
>  > # Exec or eval a command.  $cmd is either a string on an array ref.
>  > #
>  > # @args are optional arguments for the eval() case; they are not used
>  > # for exec().
>  > #
>  > sub cmdExecOrEval
>  > {
>  >     my($bpc, $cmd, @args) = @_;
>  >
>  >     if ( (ref($cmd) eq "ARRAY" ? $cmd->[0] : $cmd) =~ /^\&/ ) {
>  >         $cmd = join(" ", @$cmd) if ( ref($cmd) eq "ARRAY" );
>  >      print(STDERR "cmdExecOrEval: about to eval perl code $cmd\n")
>  >                      if ( $bpc->{verbose} );
>  >         eval($cmd);
>  >         print(STDERR "Perl code fragment for exec shouldn't
> return!!\n");
>  >         POSIX::_exit(1);
>  >     } else {
>  >         $cmd = [split(/\s+/, $cmd)] if ( ref($cmd) ne "ARRAY" );
>  >      print(STDERR "cmdExecOrEval: about to exec ",
>  >            $bpc->execCmd2ShellCmd(@$cmd), "\n")
>  >                      if ( $bpc->{verbose} );
>  >      alarm(0);
>  >      $cmd = [map { m/(.*)/ } @$cmd];         # untaint
>  >      #
>  >      # force list-form of exec(), ie: no shell even for 1 arg
>  >      #
>  >         exec { $cmd->[0] } @$cmd;
>  >         print(STDERR "Exec failed for @$cmd\n");
>  >         POSIX::_exit(1);
>  >     }
>  > }
>  >
>
> Note that the comment in the following code snippet from the subroutine
> 'UserCommandRun' in BackupPC_dump is confusing:
>
>     #
>     # Run the user's command, dumping the stdout/stderr into the
>     # Xfer log file.  Also supply the optional $vars and %Conf in
>     # case the command is really perl code instead of a shell
>     # command.
>     #
>     $bpc->cmdSystemOrEval($cmd,
>             sub {
>                 $XferLOG->write(\$_[0]);
>                 print($LogFd $bpc->timeStamp, "Output from $cmdType: ",
> $_[0]);
>             });
>
> Specifically, where and how are the variables $vars and %Conf
> supplied?
> Indeed these are exactly the variables I am trying to reference but
> they are neither passed in the above code nor are they inherited (as
> per my previous post).
>
> Note that even if $vars and %Conf were passed as the 3rd argument to
> $bpc->cmdSystemOrEval, the arguments would be ignored when passed on
> to cmdSystemOrEvalLong as per my earlier post...
>
>
>
> _______________________________________________
> BackupPC-users mailing list
> BackupPC-users@lists.sourceforge.net
> List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
> Wiki:    http://backuppc.wiki.sourceforge.net
> Project: http://backuppc.sourceforge.net/
>
_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Reply via email to