bug-bash
[Top][All Lists]
Advanced

[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: Greg Wooledge
Subject: Re: Avoiding file-based constraints for tmp files (ws Re: [minor] umask 400 causes here-{doc,string} failure)
Date: Thu, 15 Mar 2018 08:37:39 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Wed, Mar 14, 2018 at 06:45:15PM -0700, L A Walsh wrote:
> Is relying on HERE-doc implementation something that is portable?  Is it
> required by POSIX?  Still a few things to remember...

POSIX says "no":

  It is unspecified whether the file descriptor is opened as a regular
  file, a special file, or a pipe. Portable applications cannot rely on
  the file descriptor being seekable (see XSH lseek).

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_04

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.



reply via email to

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