[Top][All Lists]

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

Re: Avoiding file-based constraints for tmp files (ws Re: [minor] umask

From: Robert Elz
Subject: Re: Avoiding file-based constraints for tmp files (ws Re: [minor] umask 400 causes here-{doc, string} failure)
Date: Fri, 16 Mar 2018 15:56:08 +0700

    Date:        Thu, 15 Mar 2018 08:37:39 -0400
    From:        Greg Wooledge <address@hidden>
    Message-ID:  <address@hidden>

  | That said, I think a lot of scripts *do* bend this rule and rely on
  | the here-document creating a seekable temp file, because this has been
  | the common practice across many different shells for a long time.

The script itself is hardly going to care, it is more the application that
is given the here-doc on stdin..

If a here doc was passed to some other fd, and the application run
with /dev/fd/3 (or whichever) as an arg, it might be a bigger issue.
But I doubt that there are many scripts that do things like that.

As a general rule, applications that believe they can seek stdin
(where here docs usually are presented) are poorly designed,
if not outright broken, as it means that it isn't possible to run them as

        ... | application

and in general, I don't think there are very many such applications.

Further, there are shells (I believe all ash derived shells, at least) which
do not use files for here docs (which is why it is unspecified in POSIX).
I don't recall ever seeing a bug report, or anything (that matters, obviously
anyone can deliberately write code that would fail) that suffers because of


reply via email to

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