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 by chance?  (Even then, what was the objective?
Any umask that includes owner bits is just not rational.)



Loop on mysql output with bash

2018-03-12 Thread Boubaker Idir
Hello everybody, I need to do a loop on my mysql output (packetid) and put it 
everytime on the second SELECT command, to have a result for each packetid and 
put it everytime on text file. can you help me please? Thank you so much


#!/bin/bash
array=$(mysql -u root -pMyPassword -s -N 

Loop on mysql output with bash

2018-03-12 Thread Boubaker Idir
Hello everybody, I need to do a loop on my mysql output (packetid) and put it 
everytime on the second SELECT command, to have a result for each packetid and 
put it everytime on text file. can you help me please? Thank you so much


#!/bin/bash
array=$(mysql -u root -pMyPassword -s -N 

Loop on mysql output with bash

2018-03-12 Thread Boubaker Idir
Hello everybody, I need to do a loop on my mysql output (packetid) and put it 
everytime on the second SELECT command, to have a result for each packetid and 
put it everytime on text file. can you help me please? Thank you so much


#!/bin/bash
array=$(mysql -u root -pMyPassword -s -N 

Re: Loop on mysql output with bash

2018-03-12 Thread Chet Ramey
On 3/12/18 12:42 PM, Boubaker Idir wrote:
> Hello everybody, I need to do a loop on my mysql output (packetid) and put it 
> everytime on the second SELECT command, to have a result for each packetid 
> and put it everytime on text file. can you help me please? Thank you so much

This might be better suited for the help-b...@gnu.org mailing list.

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



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 here-docs, then
create the here-doc in memory. 


Have '<' read from a file-position pointer in the memory buffer.
- Would allow "seeking" if that's an issue.
- for _many_ here-docs, size is relatively small -- so would preclude many
 small file IO ops for small here-docs.  This may be more important for
 here-docs below the media's sector size (w/4K sectors: more common), 
or on a

 RAID, less than strip size.
- a basic file-w/sequential read facility is not difficult to write;
- no security issues or race-windows of a file temporarily on disk
- no name collisions or lookups

For small systems, even allowing 8-64K in memory could help many usages 
w/small

H-docs, but on systems w/many GigaBytes of memory -- all H-doc usage could
come from memory.

In cases where the heredoc had to be accessible from multiple processes, 
could use shared-memory if available.


In all cases, fall-back could be to current solution(s).

As a comparison, 'vim' would use temp files to handle large-file editing.
With shift to systems having more memory -- most files can be fully 
edited in

memory.

Right now, my linux system has 5.3G available in tmp, compared to 149G
available in free memory.

What would be the downside(s) of such an implementation?





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 here strings that breaks this
expectation.