--- a/cfg-update 2017-12-21 16:08:52.701358985 -0500 +++ a/cfg-update 2018-03-18 13:31:25.910802902 -0400 @@ -171,12 +171,10 @@ my $vstate7 = "Link to File "; my $vstate8 = "File to Link "; my $vstate9 = "Link to Link "; ### my $indexing_complete = "undefined"; my $md5sum; - my $md5sum_file; - my $md5sum_index; my $md5sum_before; my $md5sum_update; my $md5sum_merged; my $md5sum_after; my $show_warning; @@ -977,10 +975,14 @@ } if ($opt_d >= 1) { $tab =~ s/ //; print "$tab"."\n"; } } sub determine_state{ #DEPS# (requires that global variable $file1 contains a filename) + + my $md5sum_file; + my $md5sum_index; + if ($opt_d >= 1) { print "$tab"."\n"; $tab = $tab." "; } if (-f $index_file) { if ($opt_d >= 1) { if (-f $file1) { print "$tab"." md5sum $file1 $debug | cut -d\" \" -f1 $debug\n"; }} local $ENV{LC_ALL}="C"; if ($file1 =~ /\/\//) { # search for // in filename, everything in front of this // is the path of the remote host @@ -994,11 +996,11 @@ if ($opt_d >= 1) { print "$tab"." MD5 checksum of current config file : $md5sum_file\n"; } if ($opt_d >= 1) { print "$tab"." grep \"$file1_without_host \" $host_path$index_file $debug | cut -d\" \" -f2 $debug\n"; } local $ENV{LC_ALL}="C"; chomp ($md5sum_index = `grep "$file1_without_host " "$host_path$index_file" $debug | cut -d" " -f2 $debug`); if ($opt_d >= 1) { print "$tab"." MD5 checksum in the checksum-index : $md5sum_index\n"; } - if ($md5sum_index =~ /.+/) { + if ($md5sum_file && $md5sum_index =~ /.+/) { if ($md5sum_index !~ $md5sum_file) { $state = $state1; $vstate = $vstate1; # 1 = MF = Modified File - checksum differs from index if (-B "$file1") { $state = $state2; $vstate = $vstate2; } # 2 = MB = Modified Binary - you probably replaced the binary file so replace not allowed } else { $state = $state3; $vstate = $vstate3; # 3 = UF = Unmodified File - checksum matches with index