Re: cd's Extraneous Arguments.

2016-04-16 Thread Ralph Corderoy
Hi Chet,

> > `cd foo bar xyzzy' changes directory to foo, complaining if it
> > doesn't exist.  It doesn't complain about the unwanted extra
> > arguments.  This can cause problems;  `cd *04' ends up in 2015-04,
> > not 2016-04.
>
> If you want this behavior, you can build bash with CD_COMPLAINS
> defined (adding it to CFLAGS is the easiest way).

Thanks, I didn't know of CD_COMPLAINS.  But I'm not trying to get this
fixed for just me, deviating from my distribution's bash, I think it
should be fixed in bash's normal configuration so other users aren't
caught out by it, and the damage that can follow.

What's the argument for why CD_COMPLAINS behaviour isn't the default?

The documentation doesn't match the current behaviour, matching instead
POSIX in saying there's zero or one directories.

Cheers, Ralph.



[patch] /* XXX - possibly run Coproc->name through word expansion? */

2016-04-16 Thread Piotr Grzybowski
Hi,

 for some time I wanted to do:

WORKERS_COUNT=8;
for((i=0;i<${WORKERS_COUNT};i++)); do
 coproc worker$i { worker_code; };
done;

 and since lately I got an actual real, production, case where I had to run
given number of workers and issue jobs for them (exactly: run N encoders in
M co-processes and pass the list of files to encode for each worker on its
stdin), I got the attached patch. It does the following:

- expand the name given to coproc
- if it expands to a legal identifier create the coproc

 As I have found just now, it addresses the comment:

/* XXX - possibly run Coproc->name through word expansion? */

 and also fixes the apparent problem with the creation of co-processes with
wicked names, which is currently possible, e.g.:

coproc `well this is strange name` { sleep 64; }
set | grep "this is"

 I would also love to see the coproc built-in to support the listing of
co-processes by name, with:

coproc -list

which needs a bit of cleaning in the co-process model.
 What do you think?

cheers,
pg

P.S.
 the names of the list and the word: l and w, respectively, are not in the
lines of very good practices, probably I should have chosen something
better.


0001-coproc-name-word-expansion.patch
Description: Binary data