RE: incompatible open modes

From: Ata, John (John.Ata_at_DigitalNet.com)
Date: 07/31/03

  • Next message: Jamie Lokier: "Re: TSCs are a no-no on i386"
    Date:	Thu, 31 Jul 2003 14:29:12 -0400
    To: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
    
    

    Hi Andries,

    If that's what's been decided... I presume for backwards compatability,
    but it does seem rather odd though. After all, it seems like O_RDONLY
    is supposed to safeguard someone from accidently overwriting a file.
    Otherwise why not automatically open everything read/write? Going down
    the same path, what's next: automatically write enabling a file which
    has been openend for O_RDONLY the next time someone performs a write
    operation on it? ;-)

    Take care,
    John

    -----Original Message-----
    From: Andries Brouwer [mailto:aebr@win.tue.nl]
    Sent: Thursday, July 31, 2003 1:36 PM
    To: Zack Brown
    Cc: Ata, John; Linux Kernel Mailing List
    Subject: Re: incompatible open modes

    > On Thu, Jul 31, 2003 at 12:09:14PM -0400, Ata, John wrote:

    > > the manpage on "open" states that if a file is opened
    "O_RDONLY|O_TRUNC",
    > > the O_TRUNC is either ignored or an error is returned. The 2.4
    kernel
    > > appears to cheerfully truncate the file on open. I wondered
    which
    > > behavior is actually intended.
    > >
    > > O_TRUNC
    > > If the file already exists and is a regular file and the
    open
    > > mode allows writing (i.e., is O_RDWR or O_WRONLY) it will
    be
    > > truncated to length 0.
    > > Otherwise the effect of O_TRUNC is unspecified.
    > > (On many Linux versions it will be ignored; on other versions
    > > it will return an error.)

    This was just recently discussed, and it became clear that the
    parenthetical
    remark only led to confusion. It has been deleted. Instead

           The (undefined) effect of O_RDONLY | O_TRUNC various among
           implementations. On many systems the file is actually
           truncated.

    has been added.

    Andries

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Jamie Lokier: "Re: TSCs are a no-no on i386"

    Relevant Pages

    • Re: Q about pagecache data never written to disk
      ... The calling convention looks very very odd also; ... one of the results whenever there are multiple concurrent callers of it ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: new dev model (was Re: Default cache_hot_time value back to 10ms)
      ... Mainline is suffering too - lots of people I know running 2.6 on production ... systems have noted a marked increase in problems, crashes, odd things. ... I can try to gather the general reports I hear from people - it might well ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: swsusp: revert to 2.6.0-test3 state
      ... > of how kernel development is to be accomplished. ... Patrick decided 6 is odd for him and Linus failed to stop that :-(. ... ...vgf orggre jura vgf serr. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Possible dcache BUG
      ... > Whereas the error was always at an odd address, and in the 2nd LSbyte, ... There has been no more Oops, but with memburn eating ... > I've peaked at nearly a gig of swap, and 754 megs in swap right now. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.0-test2-mm5
      ... > Odd, odd. ... Attached are the full boot messages before the crash plus lspci -vvv ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
      (Linux-Kernel)