From 1806e3610ddf86378836f2ced7af12d30a1e3222 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 9 Jan 2020 08:04:29 +0100 Subject: [PATCH] mxmirror: Avoid perl warning 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, line 240. Use of uninitialized value in concatenation (.) or string at /usr/sbin/mxmirror line 410, 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 --- mxmirror/mxmirror | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mxmirror/mxmirror b/mxmirror/mxmirror index 0b4e1f9..6e67b41 100755 --- a/mxmirror/mxmirror +++ b/mxmirror/mxmirror @@ -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; }