[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

symlink side effect



Recently a colleague and I were doing some filespace juggling and
moved some mhonarc archives around. Specifically, we moved an archive
to a new parition and then made a symlink at the old location.  That
didn't go so well.

Most messages archived fine, then we hit one that had an attachment
and tried to create a directory to put the attachment in. Well, that
triggered some unusual code in mhfile.pl that decided to delete the
symlink, create an empty directory, then mhonarc got confused as to
why all the message pages had disappeared. Everything went downhill
from there.

I'm not sure what intention of this code is, but at least for me it's
kind of dangerous and we were lucky to catch the issue right away.
We've commented out the portion of code, and seem to be ok. But maybe
it is something worth revisiting for the next mhonarc release.

Cheers,
Jeff


=============

    ## Check if $path is a symlink
    if (-l $path) {
        # symlink, try to delete
        warn qq/Warning: "$path" is a symlink, will try to replace...\n/;
        if (!unlink($path)) {
            die qq/ERROR: "$path" is a symlink, unable to remove: $!\n/;
        }
    } elsif (-e $path) {
        die qq/ERROR: "$path" is not a directory: $!\n/  if !(-d _);
        # already exists, nothing to do
        return;
    }


[Index of Archives]     [Bugtraq]     [Yosemite News]     [Mhonarc Home]