Menu

#11 prune hash keys ending in '/' are lost

open
nobody
None
5
2005-04-26
2005-04-26
mruuska
No

If a key in the prune hash ends in '/', it will be
mishandled. Eg.:

(In flexbackup.conf:)

$prune{'/home/.*?/'} = "foobar";

will result in:

Use of uninitialized value in pattern match (m//) at
/usr/bin/flexbackup line 5661.

Cause:

# Subtree pruning
foreach my $fs (keys %cfg::prune) {
$fs = &nuke_trailing_slash($fs);
foreach my $expr (&split_list($cfg::prune{$fs})) {
$::prune{$fs}{$expr} = 1;
}
}

nuke_trailing_slash() mutilates the key and therefore
nothing can be found from the prune hash with that key.

Possible fix:

# Subtree pruning
foreach my $fs (keys %cfg::prune) {
$nuked_fs = &nuke_trailing_slash($fs);
foreach my $expr (&split_list($cfg::prune{$fs})) {
$::prune{$nuked_fs}{$expr} = 1;
}
}

I don't know what other effects this might have since I
don't know the code and don't have time or want to dive
into it more than this.

Other hash operations might be affected by nuking in a
same way.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.