#3197 exec ">>" does "a"-style opening, not "APPEND"

obsolete: 8.5a3
closed-fixed
9
2005-07-28
2005-07-27
No

when I do:
exec myprog >> logfile
this happens:

open("logfile", O_WRONLY|O_CREAT|O_LARGEFILE, 0666) = 5
_llseek(5, 0, [0], SEEK_END) = 0

This is just a bad thing. Everyone used to shell-syntax
expects the file to be opened with the "O_APPEND" flag,
such that two concurrent processes outputting to the
same file will not overwrite each others output, but always
append.

Discussion

  • Donal K. Fellows

    • priority: 5 --> 9
     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902

    If O_APPEND is available (can we count on it?) we SHOULD use it.

     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902

    O_APPEND looks universally available (or at least we already
    use it without having configure check for it) so absolutely
    no reason to not use it at all.

     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902

    Fixed in HEAD and 8.4 branch; test is a little fragile on
    very heavily loaded systems, but I don't know of any better
    way to test it easily.

    Note that Windows is not fixed, and cannot be fixed due to
    fundamental lamenesses in the Win32 API (i.e. no equivalent
    flag on file handles is available). Blame Microsoft.

     
  • Donal K. Fellows

    • assigned_to: andreas_kupries --> dkf
    • status: open --> closed-fixed
     

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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks