#184 Stale tmp files laying around


common/mp4v2/mp4file.cpp: TempFileName() should place the file in the same dir as the original file, since rename(2) won't cross device boundaries.
The following happened to me on SnowLeopard after moving my music library to an external HDD and working with that:

?0%0[steffen@sherwood tmp]$ ll /Volumes/DISK2S4/music.db/out.mp4 tmp*
ls: /Volumes/DISK2S4/music.db/out.mp4: No such file or directory
ls: tmp*: No such file or directory
?1%0[steffen@sherwood tmp]$ dd if=input.wav|faac --mpeg-vers 4 -ws --tns -q 80 -o /Volumes/DISK2S4/music.db/out.mp4 -
Freeware Advanced Audio Coder
FAAC 1.28

Quantization quality: 80
Bandwidth: 13600 Hz
Object type: Low Complexity(MPEG-4) + TNS + M/S
Container format: MPEG-4 File Format (MP4)
Encoding - to /Volumes/DISK2S4/music.db/out.mp4
frame | bitrate | elapsed/estim | play/CPU | ETA
150/188 ( 79%)| 103.1 | 0.1/0.1 | 30.02x | 0.0 1490+1 records in
1490+1 records out
763348 bytes transferred in 0.228054 secs (3347224 bytes/sec)
188/188 (100%)| 102.5 | 0.1/0.1 | 30.87x | 0.0

MP4 format optimization... Done!
?0%0[steffen@sherwood tmp]$ ll /Volumes/DISK2S4/music.db/out.mp4 tmp*
64 -rw-r--r-- 1 steffen staff 56931 22 Mar 14:00 /Volumes/DISK2S4/music.db/out.mp4
56 -rw-r--r-- 1 steffen staff 56931 22 Mar 14:00 tmp5615.mp4


  • Steffen (Daode) Nurpmeso

    • status: open --> open-fixed
  • Steffen (Daode) Nurpmeso

    Sorry folks, i have no damnit experience with this .. tracker.
    I hope the patch makes it through to you.
    Yes, i really needed it.
    It's an one hour hack with no knowledge of the codebase,
    but should work somewhat.
    It's at least a nice starter. Is it.

  • Steffen (Daode) Nurpmeso

    However: with random IDs i would also change the getpid() loop.
    Just in case you're unlucky.

  • Steffen (Daode) Nurpmeso

    So i've uploaded a second version as a complete git(1) changeset
    which is a bit more polished than the first one, and addresses the
    getpid(2) "problem", too.
    It is still terribly racy, but for that to be fixed the entire code flow
    had to be changed, and i'm not familiar with that.
    This version will do it for me, now and though.
    But it's really ugly, looking at code with so terrible races..

  • Steffen (Daode) Nurpmeso

    • status: open-fixed --> pending-fixed
  • Steffen (Daode) Nurpmeso

    • status: pending-fixed --> open-fixed
  • Steffen (Daode) Nurpmeso

    Well, you may not like it, but this patch still fails for STDIO, but which doesn't matter since STDIO is broken in faac(1), and still ... and unless i'm too stupid to 'configure && make'. Well i'm stupid, but not THAT stupid, ok?

    I still don't want to look deeper in this physician stuff, but the following at least circumvents what is wrong. It's plain wrong beside that, but i like using faac(1) (*still*):

    @@ -789,6 +789,8 @@ int main(int argc, char *argv[])
    infile->channels = rawChans;
    infile->samplebytes = rawBits / 8;
    infile->samplerate = rawRate;
    +if(infile->samples ==0)
    +infile->samples=0x7FFFFFFF - 2048;
    infile->samples /= (infile->channels * infile->samplebytes);

    Thank you.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks