Skip to content

Commit

Permalink
mxmirror: Avoid perl warning
Browse files Browse the repository at this point in the history
When the source jbod is not in mxmounts, we currenty get

    **ERROR: unknown jbod: X2083
    Use of uninitialized value in concatenation (.) or string at /usr/sbin/mxmirror line 410, <F> line 240.
    Use of uninitialized value in concatenation (.) or string at /usr/sbin/mxmirror line 410, <F> line 240.
    **ERROR: CAN'T PARSE FROM/TO: X2083 X2076

because the `undef` result of `convert_to_sourcepath` is
used by `convert_to_destinationpath`.

Bark out early when the source path is not parsable.

This changes output to

    buczek@pummelfee:~/git/mxtools (master)$ mxmirror/mxmirror
    **ERROR: unknown jbod: X2083
    **ERROR: CAN'T PARSE FROM: X2083 X2076
  • Loading branch information
donald committed Jan 9, 2020
1 parent d8f6b34 commit 1806e36
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mxmirror/mxmirror
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,13 @@ sub read_mirrormap {
if(($from, $to, $args) = /^(\S+) (\S+)\s*(.*)$/) {
$source = convert_to_sourcepath($from);
unless ($source) {
print STDERR "**ERROR: CAN'T PARSE FROM: $_\n";
next;
}
$destination = convert_to_destinationpath($to, $source);
unless($source and $destination) {
print STDERR "**ERROR: CAN'T PARSE FROM/TO: $_\n";
unless($destination) {
print STDERR "**ERROR: CAN'T PARSE TO: $_\n";
next;
}
Expand Down

0 comments on commit 1806e36

Please sign in to comment.