Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Greg Wooledge
On Mon, Oct 06, 2014 at 04:04:25PM -0700, Linda Walsh wrote: > Greg Wooledge wrote: > >netdev_pat=... # (and other variable assignments) > >(cd "$sysnet" && > >for ifname in ...; do > >hwaddr=$(<"$ifname"/address) > >act_hw2if[$hwaddr]="$ifname" > >act_if2hw[$ifname]="$hwaddr" > >done)

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Dan Douglas
On Monday, October 06, 2014 02:00:47 PM Linda Walsh wrote: > > Greg Wooledge wrote: > > On Mon, Oct 06, 2014 at 12:38:21PM -0700, Linda Walsh wrote: > >> According to Chet , only way to do a multi-var assignment in bash is > >> > >> read a b c d <<<$(echo ${array[@]}) It's best to avoid turning

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Chet Ramey
On 10/6/14, 3:14 PM, Linda Walsh wrote: > In running a startup script, I am endeavoring not to use tmp files > where possible, As part of this, I sent the output of a command > to stdout where I read it using the "variable read" syntax: > >while read ifname hwaddr; do >printf "ifname=%

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Chet Ramey
On 10/6/14, 3:38 PM, Linda Walsh wrote: > Greg Wooledge wrote: >> On Mon, Oct 06, 2014 at 12:14:57PM -0700, Linda Walsh wrote: >>>done <<<"$(get_net_IFnames_hwaddrs)" >> >>> Where am I using a HERE doc? >> >> <<< and << both create temporary files. > > > According to Chet , only way to do a m

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Chet Ramey
On 10/6/14, 5:00 PM, Linda Walsh wrote: >> You are working in a severely constrained environment. > That isn't the problem: the assignment using a tmp file is: >> strace -p 48785 -ff > Process 48785 attached > read(0, "\r", 1)= 1 > write(2, "\n", 1)

Re: Fwd: bash not using pipes or /tmp @ boot?

2014-10-07 Thread Chet Ramey
On 10/6/14, 6:03 PM, Linda Walsh wrote: > Not sure how but this went off into space, sorta... > > Greg Wooledge wrote: >> On Mon, Oct 06, 2014 at 12:14:57PM -0700, Linda Walsh wrote: >>>done <<<"$(get_net_IFnames_hwaddrs)" >> >>> Where am I using a HERE doc? >> >> <<< and << both create tempor

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Chet Ramey
On 10/7/14, 2:07 AM, Linda Walsh wrote: > I thought I was getting rid of this bogus problem (which shouldn't > be a problem anyway -- since it's just another pipe but with parent receiving > the data instead of child receiving it) by storing it in a variable > transfer form > <<<($VAR)... cuz was

Re: Bash-4.3 Official Patch 30

2014-10-07 Thread Chet Ramey
On 10/6/14, 6:16 PM, John E. Malmberg wrote: >>> Do you mean return ""; ? >> >> Yes, good catch. It doesn't make a difference: clang and gcc both accept >> it as written and it behaves as desired. However, I'll change it for the >> next version. > > Changing it to return 0 instead of '\0' would

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Chet Ramey
On 10/7/14, 8:55 AM, Dan Douglas wrote: >> Um... it used a socket.. to transfer it, then it uses a tmp file on top >> of that?! : > > That's the wrong process. AF_NETLINK is the interface used by iproute2 for > IPC > with the kernel. Bash doesn't use netlink sockets. It's syslog. Some vendor

"export -p" output not suitable for input when env vars contain non-identifiers

2014-10-07 Thread Stephane Chazelas
2014-09-30 17:06:22 +0100, Stephane Chazelas: [...] > $ env -i $'a\necho test\na=b' bash -c 'export -p' > declare -x OLDPWD > declare -x PWD="/home/stephane" > declare -x SHLVL="1" > declare -x a > echo test > a [...] Just reiterating in case that had gone unnoticed earlier: $ env 'a;echo OOPS;:

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Linda Walsh
Chet Ramey wrote: On 10/7/14, 8:55 AM, Dan Douglas wrote: Um... it used a socket.. to transfer it, then it uses a tmp file on top of that?! : That's the wrong process. AF_NETLINK is the interface used by iproute2 for IPC with the kernel. Bash doesn't use netlink sockets. It's syslog. Som

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Greg Wooledge
On Tue, Oct 07, 2014 at 09:54:21AM -0700, Linda Walsh wrote: > Chet Ramey wrote: > >It's syslog. Some vendors integrated patches that log all shell commands > >to syslog. > > > No... that wasn't syslog, it was strace in another terminal where I attached > the bacsh that was doing the various types

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Linda Walsh
Greg Wooledge wrote: OK, then use a function to give you an escapable block: declare -A ... create_maps() { cd "$sysnet" || return for ifname in ...; do hwaddr=$(<"$ifname"/address) act_hw2if[$hwaddr]="$ifname" act_hw2if[$ifname]="$hwaddr" done } create_maps

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Greg Wooledge
On Tue, Oct 07, 2014 at 10:45:53AM -0700, Linda Walsh wrote: > I appreciate the options, but the option I want is the parent staying > "put", and only sending children out to change dir's. Say some new > version of init wants to isolate init processes by putting them in their > own dir and t

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Pierre Gaston
On Tue, Oct 7, 2014 at 8:45 PM, Linda Walsh wrote: > > > Greg Wooledge wrote: > >> OK, then use a function to give you an escapable block: >> >> declare -A ... >> create_maps() { >> cd "$sysnet" || return >> for ifname in ...; do >> hwaddr=$(<"$ifname"/address) >> act_hw2i

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Chet Ramey
On 10/7/14, 1:45 PM, Linda Walsh wrote: > There is no fundamental reason why, say, process substitution needs to > use /dev/fd or /proc/anything -- and couldn't operate exactly like piped > processes do now. On my first implementation of multiple IPC programs, > I've used semaphores, message queu

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Linda Walsh
Chet Ramey wrote: On 10/7/14, 1:45 PM, Linda Walsh wrote: There is no fundamental reason why, say, process substitution needs to use /dev/fd or /proc/anything -- and couldn't operate exactly like piped processes do now. On my first implementation of multiple IPC programs, I've used semaphore

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Linda Walsh
Pierre Gaston wrote: That's where you are wrong, there is no reason for *your* use case, but the basic idea behind process substitution is to be able to use a pipe in a place where you normally need a file name. Well, that's not what I needed it for. I needed to read from a child process tha

Re: Bash-4.3 Official Patch 30

2014-10-07 Thread Ángel González
Chet Ramey wrote: > On 10/6/14, 6:16 PM, John E. Malmberg wrote: > > >>> Do you mean return ""; ? > >> > >> Yes, good catch. It doesn't make a difference: clang and gcc both accept > >> it as written and it behaves as desired. However, I'll change it for the > >> next version. > > > > Changing

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-07 Thread Chet Ramey
On 10/7/14, 5:35 PM, Linda Walsh wrote: > > > Chet Ramey wrote: >> On 10/7/14, 1:45 PM, Linda Walsh wrote: >> >>> There is no fundamental reason why, say, process substitution needs to >>> use /dev/fd or /proc/anything -- and couldn't operate exactly like piped >>> processes do now. On my first

Re: Bash-4.3 Official Patch 30

2014-10-07 Thread Chet Ramey
On 10/7/14, 6:31 PM, Ángel González wrote: >>> Changing it to return 0 instead of '\0' would probably be more clear. >>> No need to return a pointer to a static empty string. >> >> It depends on how you want the function to work. It is nice to >> differentiate between the cases where there is no

Re: "export -p" output not suitable for input when env vars contain non-identifiers

2014-10-07 Thread Chet Ramey
On 10/7/14, 12:28 PM, Stephane Chazelas wrote: > Since those environment variables cannot be mapped to shell > variables, they should not be included in the output of "export > -p". Thanks. This will be fixed in the next release of bash. > I can see there are a number of bugs at savannah > (htt

bash using unknown tmp - library based? static link on linux? (was Re: bash not using pipes or /tmp @ boot?)

2014-10-07 Thread Linda Walsh
Chet Ramey wrote: On 10/6/14, 6:03 PM, Linda Walsh wrote: Not sure how but this went off into space, sorta... Greg Wooledge wrote: On Mon, Oct 06, 2014 at 12:14:57PM -0700, Linda Walsh wrote: done <<<"$(get_net_IFnames_hwaddrs)" Where am I using a HERE doc? <<< and << both create tempor