Re: Another new 4.0 feature? functions can't return '1', (()) can't eval to 0?

2011-08-10 Thread Linda Walsh
This may be some 'cockpit error', but this is what I'm seeing right now and AFAICT, bash is broken. I have this statement: next line is line #300 have_dep -v base_mp_diff base_vg osnap_lv osnap_vg && { nextents="$(get_nextents_for_space_on_vg_w_minfree \

Re: equivalent of Linux readlink -f in pure bash?

2011-08-10 Thread Bernd Eggink
On 09.08.2011 15:50, Steven W. Orr wrote: On 8/9/2011 5:29 AM, Bernd Eggink wrote: On 09.08.2011 03:44, Jon Seymour wrote: Has anyone ever come across an equivalent to Linux's readlink -f that is implemented purely in bash? You can find my version here: http://sudrala.de/en_d/shell-getlink.h

usenet to email gateway

2011-08-10 Thread Stephane Chazelas
Hiya, not sure who to report that to, but it looks like the usenet to mailing-list gateway at least for gnu.bash.bug is not working properly. That is, messages posted to the newsgroup are not sent to the corresponding mailing list. Compare for instance http://thread.gmane.org/gmane.comp.shells.ba

Re: Coproc usage ... not understanding

2011-08-10 Thread Greg Wooledge
On Tue, Aug 09, 2011 at 05:47:09PM -0700, Linda Walsh wrote: > Bob Proulx wrote: > >This may be a good point to mention this reference: > > > > http://www.pixelbeat.org/programming/stdio_buffering/ > Does it only work with gnu programs? I.e. how would they know to > not buffer Sou

Re: Coproc usage ... not understanding

2011-08-10 Thread Bob Proulx
Greg Wooledge wrote: > Linda Walsh wrote: > > Bob Proulx wrote: > > >This may be a good point to mention this reference: > > > > > > http://www.pixelbeat.org/programming/stdio_buffering/ > > > Does it only work with gnu programs? I.e. how would they know to > > not buffer > > Sounds l

Re: Coproc usage ... not understanding

2011-08-10 Thread Greg Wooledge
On Wed, Aug 10, 2011 at 10:07:20AM -0600, Bob Proulx wrote: > The unbuffer expect script sets up a tty around the called program so > that instead of a pipe the program detects a tty. > The stdbuf utility works by setting up an LD_PRELOAD library > libstdbuf.so that replaces the libc calls and int

test -nt not sane

2011-08-10 Thread Curtis Doty
Or maybe I'm not groking. When one compares against a b0rk symlink, the result of -nt (newer than) is true--when it isn't! mkdir directory ln -s noexist symlink touch -hr directory symlink test directory -nt symlink &&echo yes ||echo no They have identical mtimes (as set by touch)--i.e

Re: test -nt not sane

2011-08-10 Thread Greg Wooledge
On Wed, Aug 10, 2011 at 11:53:52AM -0700, Curtis Doty wrote: > touch -hr directory symlink touch: illegal option -- h Hmm, what is that? Let's check a GNU/Linux box: -h, --no-dereference affect each symbolic link instead of any referenced file (useful only o

Re: test -nt not sane

2011-08-10 Thread Sam Steingold
> * Curtis Doty [2011-08-10 11:53:52 -0700]: > > They have identical mtimes (as set by touch)--i.e. the directory is > *not* newer than the symlink--but it still outputs "yes". Why? mtime for a symlink comes from stat(), not stat(). anything is newer than a non-existent object. -- Sam Steingold

Re: test -nt not sane

2011-08-10 Thread Chet Ramey
On 8/10/11 2:53 PM, Curtis Doty wrote: > Or maybe I'm not groking. When one compares against a b0rk symlink, the > result of -nt (newer than) is true--when it isn't! > > mkdir directory > ln -s noexist symlink > touch -hr directory symlink > > test directory -nt symlink &&echo yes ||echo

Re: test -nt not sane

2011-08-10 Thread Greg Wooledge
On Wed, Aug 10, 2011 at 03:25:49PM -0400, Chet Ramey wrote: > The man page says: > file1 -nt file2 > True if file1 is newer (according to modification date) than > file2, or if file1 exists and file2 does not. Ah. The "help test" page is shorter: FILE1 -nt FILE2 True if f

Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Linda Walsh
Chet Ramey wrote: Yes. It's a case of not saving and restoring enough state across possibly- recursive calls to the shell parser. (The assignment statement is the key in this case.) > So, I compared subst.c files from bash-4.1-9 and bash-4.2-10 and was > able > to build a patch that it

Re: Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Eric Blake
On 08/10/2011 03:59 PM, Linda Walsh wrote: Is this a fluke, due to the above changes NOT being 4.1? Or is this construction going to break in 4.2: '$((( )))' According to POSIX, this construction should be parsed as an arithmetic substitution $(()) where the expression is (expr), if at all p

Brace expansion padding inconsistencies

2011-08-10 Thread gregry .
Brace expansion using incrementers sometimes produces unexpected results with regard to padding. Note the following 4 examples not using incrementers: bash> echo {0..9} 0 1 2 3 4 5 6 7 8 9 bash> echo {00..9} 00 01 02 03 04 05 06 07 08 09 bash> echo {0..09} 00 01 02 03 04 05 06 07 08 09 bash> ech

Warning (HTML included to show prog shipped w/syntax highlighting).

2011-08-10 Thread Linda W
When I have the construct, in 4.1: 1 #!/bin/bash 2 30 31 # trace control for subs 32 declare -ix Allow_Trace=$((( 33 _D_LowLevel | 34 _D_Provides | 35 _D_ 36 ))) 37 38 declare -ix Trace_off

Re: usenet to email gateway

2011-08-10 Thread Karl Berry
not sure who to report that to I've asked the FSF sysadmins. I can see from the mailing list configuration that the gateway is intended to be operational, but don't know how to debug what it happening from there. Best, Karl

Re: Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Chet Ramey
On 8/10/11 5:59 PM, Linda Walsh wrote: > > Chet Ramey wrote: >> >> Yes. It's a case of not saving and restoring enough state across >> possibly- >> recursive calls to the shell parser. (The assignment statement is the >> key >> in this case.) >> >> > So, I compared subst.c files from bash-4

Re: Warning (HTML included to show prog shipped w/syntax highlighting).

2011-08-10 Thread Chet Ramey
On 8/10/11 6:23 PM, Linda W wrote: > > > When I have the construct, in 4.1: > > > 1 #!/bin/bash > 2 30 31 # trace control for subs > 32 declare -ix Allow_Trace=$((( > 33 _D_LowLevel | > 34 _D_Provides | > 35 _D_ 36

Re: Brace expansion padding inconsistencies

2011-08-10 Thread Chet Ramey
On 8/10/11 4:43 PM, gregry . wrote: > bash> echo {0..9..2} > 0 2 4 6 8 > bash> echo {00..9..2} > 00 02 04 06 08 > bash> echo {0..09..2} > 0 2 4 6 8 > bash> echo {00..09..2} > 0 2 4 6 8 > > The first two are as expected, but the last two have unexpected addi

Re: Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Linda Walsh
Eric Blake wrote: On 08/10/2011 03:59 PM, Linda Walsh wrote: Is this a fluke, due to the above changes NOT being 4.1? Or is this construction going to break in 4.2: '$((( )))' According to POSIX, this construction should be parsed as an arithmetic substitution $(()) where the expression is

Re: Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Linda Walsh
Chet Ramey wrote: Is this a fluke, due to the above changes NOT being 4.1? Or is this construction going to break in 4.2: '$((( )))' What does `break' mean? It's already written in a manner more confusing and obscure than necessary. What value do you think the extra set of p

Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Dennis Williamson
> > I thought the $( ) was necessary to make the inner (()) an arithmetic > expression...  Does it execute in a sub process? > No, $( ) is for process substitution, $(( )) is for an arithmetic context. I normally (in Bash), use (( )) outside the whole expression since it gives me complete freedom

Re: Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Chet Ramey
On 8/10/11 8:57 PM, Linda Walsh wrote: > Chet Ramey wrote: > >>> >>> >>>Is this a fluke, due to the above changes NOT being 4.1? Or is >>>this construction going to break in 4.2: >>> >>>'$((( )))' >> >> What does `break' mean? It's already written in a manner more >> confusing a

Re: Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Chet Ramey
On 8/10/11 8:44 PM, Linda Walsh wrote: > > It sounded to me like $(( )) would be translated into "$( () )", > turning off arithmetic expansion. Did I read that incorrectly? Yes. You missed the content of the resolution and changed language in the standard: "The syn

Re: Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Clark J. Wang
On Thu, Aug 11, 2011 at 5:59 AM, Linda Walsh wrote: > > Bash is becoming very unstable -- programs that work in 3.1 won't > necessarily work in 3.2, those in 3.2 aren't compat with 4.0, 4.0 is > different than 4.1, and now 4.2 is different than 4.1. > > How can people write stable scripts in an e

Re: saving bash.....

2011-08-10 Thread Linda Walsh
Chet Ramey wrote: > If not, then wouldn't > $((( ))) be turned into $( (( )) ), meaning the arith returns a > status, > and not the calculation. (I've tested this, and this is the case. This is demonstrably false. --- No... you've only proven that you should have a bit of 'compassion' for

Re: equivalent of Linux readlink -f in pure bash?

2011-08-10 Thread Clark J. Wang
On Wed, Aug 10, 2011 at 6:00 PM, Bernd Eggink wrote: > On 09.08.2011 15:50, Steven W. Orr wrote: > > *) You reset OPTIND to 1 but you didn't declare it local. This will >> cause any caller of getlink which uses getopts to reset its variable >> to 1. (I mention this because it cost me a couple of