bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "here strings" and tmpfiles


From: Chet Ramey
Subject: Re: "here strings" and tmpfiles
Date: Thu, 11 Apr 2019 15:25:57 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 4/11/19 12:02 AM, Jason A. Donenfeld wrote:
> Hi Chet,

Hi.

> I hope that can shed light on the motivation a bit. Pass got hit by
> this a bit ago:
> https://git.zx2c4.com/password-store/commit/?id=367efa5846492e1b0898aad8a2c26ce94163ba24

I note that the pipe-for-small-enough-heredocs works for this case.

> Anyway, the more interesting thing is discussing what a proper fix
> would be. Do you see anything conceptually wrong with the NONBLOCK
> approach I suggested? In theory, would that work? 

I'd prefer the fork-a-child-and-let-it-do-the-writing approach. The
question is where to place it on a list of issues.

> Another thing I was
> curious about is - what about internally treating "x <<y" as "echo y |
> x"? Are these somehow not quite equivalent because x is in a subshell
> in one but not the other, or something like that? And if that's so,
> would my NONBLOCK suggestion incur similar issues?

They're quite semantically different -- subshells, pipes, different
expansion semantics, among others -- and result in additional, possibly
unexpected, issues.

For instance, consider what happens in your script when someone runs
it on a bash version that has been compiled for strict posix conformance,
including xpg_echo being on by default.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]