Fri 02 Jan 2009 02:17:45 AM UTC, original submission:
Using MHonArc to produce a web archive of an mbox with a command similar to
mhonarc foo.mbox -rcfile foo.rc -outdir archives/2009/
(where archives/2009 does not yet exist) fails when it reaches the first email with an attachment, with an error message similar to
ERROR: Unable to rename "archives/2009/dir<random string>" to "archives/2009/msg00047":
However, checking the archives/2009 directory reveals that the msg00047 directory does exist, and in fact if the same mhonarc command is rerun it passes that message successfully - but then fails on the next message with an attachment (and so on). Also, the directory is created with the wrong permissions (it is not world-readable, so Apache can't read the attachments).
I tracked down the problem to the dir_create() function in mhfile.pl (see attached patch). If the rename of $tmpdir to $path succeeds, the loop continues until TEMP_MAX_TRIES is exceeded. The attached patch exits the loop after the first successful rename().
BTW, since chmod() is run on the new directory at the end of that function, perhaps the last 'return' statement should be removed? (And maybe the second-to-last should become a 'last', but that one I'm not so sure about.)
|