Re: [minor] umask 400 causes here-{doc,string} failure

2018-10-29 Thread Greg Wooledge
On Sun, Oct 28, 2018 at 09:30:00PM -0400, Chet Ramey wrote: > That doesn't work for the same reason as discussed in > http://lists.gnu.org/archive/html/bug-bash/2018-03/msg00074.html. > It's unlikely that someone will set his umask to 400 and expect no ill > effects, but I suppose it's better not t

Re: [minor] umask 400 causes here-{doc,string} failure

2018-10-28 Thread Chet Ramey
On 10/28/18 6:05 PM, Martijn Dekker wrote: > Unless I'm missing something, there should be no reason for an internal > temp file to have any permissions other than 0600 (user readable/writable), > so it seems to me that an fchmod call straight after creating the file and > before returning the fd

Re: [minor] umask 400 causes here-{doc,string} failure

2018-10-28 Thread Martijn Dekker
Op 11-03-18 om 17:31 schreef Ilkka Virta: On 11.3. 17:17, Stephane Chazelas wrote: $ bash -c 'umask 400; cat <<< test' bash: cannot create temp file for here-document: Permission denied Those shells use temporary files to store the content of the here-documents as the Bourne shell initially d

Re: Avoiding file-based constraints for tmp files (ws Re: [minor] umask 400 causes here-{doc, string} failure)

2018-03-16 Thread Robert Elz
Date:Thu, 15 Mar 2018 08:37:39 -0400 From:Greg Wooledge Message-ID: <20180315123739.vd7zdj37irnt4...@eeg.ccf.org> | 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

Re: Avoiding file-based constraints for tmp files (ws Re: [minor] umask 400 causes here-{doc,string} failure)

2018-03-15 Thread Greg Wooledge
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 f

Re: Avoiding file-based constraints for tmp files (ws Re: [minor] umask 400 causes here-{doc,string} failure)

2018-03-14 Thread L A Walsh
Eduardo Bustamante wrote: On Mon, Mar 12, 2018 at 2:05 PM, L A Walsh wrote: [...] What would be the downside(s) of such an implementation? There's code out there that relies on several properties of regular files, one of them for example, that you can seek on them. I recommend again

Re: [minor] umask 400 causes here-{doc,string} failure

2018-03-13 Thread Joerg Schilling
Stephane Chazelas wrote: > Note: sent to bash, zsh and Schily Bourne shell dev mailing > lists (not mksh as my email provider apparently doesn't play > well with mirbsd.org's expensive greylisting, please feel free > to forward there if you don't use gmail). > > That's from: > https://unix.stacke

Re: Avoiding file-based constraints for tmp files (ws Re: [minor] umask 400 causes here-{doc,string} failure)

2018-03-12 Thread Eduardo Bustamante
On Mon, Mar 12, 2018 at 2:05 PM, L A Walsh wrote: [...] > What would be the downside(s) of such an implementation? There's code out there that relies on several properties of regular files, one of them for example, that you can seek on them. I recommend against any change to here documents and he

Avoiding file-based constraints for tmp files (ws Re: [minor] umask 400 causes here-{doc,string} failure)

2018-03-12 Thread L A Walsh
Stephane Chazelas wrote: $ bash -c 'umask 400; cat <<< test' bash: cannot create temp file for here-document: Permission denied ... I can think of several ways to address it: --- Another way to address it (with env-based limits for instance + sum): If using less than env-mem limits for her

Re: [minor] umask 400 causes here-{doc,string} failure

2018-03-12 Thread Greg Wooledge
On Sun, Mar 11, 2018 at 03:17:42PM +, Stephane Chazelas wrote: > I can think of several ways to address it: > > 1- do nothing and blame the user as the user explicitly asked > for files to be unreadable This one gets my vote. That umask is just entirely wrong. Did the user really mean 0377

Re: [minor] umask 400 causes here-{doc,string} failure

2018-03-11 Thread Ilkka Virta
On 11.3. 17:17, Stephane Chazelas wrote: $ bash -c 'umask 400; cat <<< test' bash: cannot create temp file for here-document: Permission denied Those shells use temporary files to store the content of the here-documents as the Bourne shell initially did, and open them in read-only mode to make