develooper Front page | perl.perl5.porters | Postings from July 2019

[perl #134221] open(FH, "+>>", undef) doesn't set O_APPEND

Thread Next
From:
Tony Cook via RT
Date:
July 2, 2019 05:46
Subject:
[perl #134221] open(FH, "+>>", undef) doesn't set O_APPEND
Message ID:
rt-4.0.24-21877-1562046359-783.134221-15-0@perl.org
On Sun, 23 Jun 2019 18:50:24 -0700, e@80x24.org wrote:
> I love using open(FH, MODE, undef) to create unlinked temporary
> files with minimal typing.
> 
> But I was surprised when using "+>>" as the MODE did not set
> O_APPEND on the temporary file handle (or warn about the ">>"
> being ignored.  I want to use O_APPEND so I can easily append to
> it from one callback while while using sendfile or pread+SSL_write
> to write to a socket.
> 
> I'm using this as a lazy write buffer for reading the output of
>   process (e.g. git-http-backend/git-archive) while sending to
> a client which may not be able to keep up with the output speed.

I've attached a partial solution, that works on Linux (and presumably other POSIX-ish systems) and Win32.

From what I remember of a discussion with Craig back when working on the in-place editing re-work, the code currently guarded by !defined(VMS) should also work on VMS, except for the default to /tmp/.

Tony

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=134221

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About