robinbowes/flac2mp3 — pull request #7 by carlasplund (2013-01-11 01:11:02+00:00)
Title: Pull request (7 of 8): Race condition: temp filnames in Tag::MP3::ID3v2

Fixed race condition bug in MP3::Tag::ID3v2, which has severely broken
temp file generation code in the original version (see
https://rt.cpan.org/Public/Bug/Display.html?id=66768). In my experience,
a few percent of the ID3v2 tag writes were affected by this bug (tags
not written to file), which is pretty bad.

This is a customized CPAN module. For some reason, the "MP3::Tag"
maintainer seems unwilling to fix the bug (downplaying it's importance),
and particularly unwilling to have anything to do with the "File::Temp"
module.

Thanks to Jason Rhinelander for identifying the cause and for posting a
very useful patch on CPAN (on which patch this bug fix is based).

Multi-CPU transcoding and tagging on MSWin is still a bit ropey. I added
a hack (lines 676-679) which solves some, but not all stability problems
on that platform.
The thing is that MP3::Tag will sometimes be unable to rename temp files
during heavy I/O operation (multiple parallel threads with lame and/or
flac running), thus skipping the file in question. In contrast, parallel
code works flawlessly on MSWin when actual flac-lame transcoding is
replaced by sleep() or counting loops. No such problems were encountered
on Linux platforms.