Some globstar patterns produce duplicate entries and a null filename

2012-12-01 Thread Ulf Magnusson
GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)

Take the following example, assumed to be run in an empty directory:

$ mkdir a
$ echo **
a
$ echo **/**
 a a
$ echo **/**/**
 a a a

I would expect the result to be just 'a' in all cases.

You also get back a null filename, as shown by

$ for f in **/**/**; do echo "'$f'"; done
''
'a'
'a'
'a'

/Ulf



Re: Some globstar patterns produce duplicate entries and a null filename

2012-12-02 Thread Ulf Magnusson
On Sun, Dec 2, 2012 at 4:58 PM, Roman Rakus  wrote:
> On 12/01/2012 04:41 PM, Ulf Magnusson wrote:
>>
>> GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)
>>
>> Take the following example, assumed to be run in an empty directory:
>>
>> $ mkdir a
>> $ echo **
>> a
>> $ echo **/**
>>   a a
>> $ echo **/**/**
>>   a a a
>>
>> I would expect the result to be just 'a' in all cases.
>>
>> You also get back a null filename, as shown by
>>
>> $ for f in **/**/**; do echo "'$f'"; done
>> ''
>> 'a'
>> 'a'
>> 'a'
>>
>> /Ulf
>>
> I can't reproduce it on my Fedora with bash 4.2.10 nor 4.2.39. Tried turn on
> and off extglob shell option.
> Can you please resend your report with `bashbug' script? Or at least say
> which linux distribution you are using?
>
> RR
>

Ubuntu 12.04. My configuration is
https://github.com/ulfalizer/Configuration-files/blob/master/bash,
which I 'source' from the standard Ubuntu ~/.bash. I noticed the bug
while implementing the _super_glob function.

bashbug information:

Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include
-I../bash/lib  -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Wformat-security
-Werror=format-security -Wall
uname output: Linux Huvuddator 3.2.0-32-generic-pae #51-Ubuntu SMP Wed
Sep 26 21:54:23 UTC 2012 i686 i686 i386 GNU/Linux
Machine Type: i686-pc-linux-gnu

/Ulf



Re: Some globstar patterns produce duplicate entries and a null filename

2012-12-02 Thread Ulf Magnusson
On Sun, Dec 2, 2012 at 5:40 PM, Ulf Magnusson  wrote:
> On Sun, Dec 2, 2012 at 4:58 PM, Roman Rakus  wrote:
>> On 12/01/2012 04:41 PM, Ulf Magnusson wrote:
>>>
>>> GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)
>>>
>>> Take the following example, assumed to be run in an empty directory:
>>>
>>> $ mkdir a
>>> $ echo **
>>> a
>>> $ echo **/**
>>>   a a
>>> $ echo **/**/**
>>>   a a a
>>>
>>> I would expect the result to be just 'a' in all cases.
>>>
>>> You also get back a null filename, as shown by
>>>
>>> $ for f in **/**/**; do echo "'$f'"; done
>>> ''
>>> 'a'
>>> 'a'
>>> 'a'
>>>
>>> /Ulf
>>>
>> I can't reproduce it on my Fedora with bash 4.2.10 nor 4.2.39. Tried turn on
>> and off extglob shell option.
>> Can you please resend your report with `bashbug' script? Or at least say
>> which linux distribution you are using?
>>
>> RR
>>
>
> Ubuntu 12.04. My configuration is
> https://github.com/ulfalizer/Configuration-files/blob/master/bash,
> which I 'source' from the standard Ubuntu ~/.bash. I noticed the bug
> while implementing the _super_glob function.
>
> bashbug information:
>
> Machine: i686
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
> -DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include
> -I../bash/lib  -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector
> --param=ssp-buffer-size=4 -Wformat -Wformat-security
> -Werror=format-security -Wall
> uname output: Linux Huvuddator 3.2.0-32-generic-pae #51-Ubuntu SMP Wed
> Sep 26 21:54:23 UTC 2012 i686 i686 i386 GNU/Linux
> Machine Type: i686-pc-linux-gnu
>
> /Ulf

Left out some bashbug information:

Bash Version: 4.2
Patch Level: 24
Release Status: release

/Ulf



Re: Some globstar patterns produce duplicate entries and a null filename

2012-12-02 Thread Ulf Magnusson
On Sun, Dec 2, 2012 at 5:42 PM, Ulf Magnusson  wrote:
> On Sun, Dec 2, 2012 at 5:40 PM, Ulf Magnusson  wrote:
>> On Sun, Dec 2, 2012 at 4:58 PM, Roman Rakus  wrote:
>>> On 12/01/2012 04:41 PM, Ulf Magnusson wrote:
>>>>
>>>> GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)
>>>>
>>>> Take the following example, assumed to be run in an empty directory:
>>>>
>>>> $ mkdir a
>>>> $ echo **
>>>> a
>>>> $ echo **/**
>>>>   a a
>>>> $ echo **/**/**
>>>>   a a a
>>>>
>>>> I would expect the result to be just 'a' in all cases.
>>>>
>>>> You also get back a null filename, as shown by
>>>>
>>>> $ for f in **/**/**; do echo "'$f'"; done
>>>> ''
>>>> 'a'
>>>> 'a'
>>>> 'a'
>>>>
>>>> /Ulf
>>>>
>>> I can't reproduce it on my Fedora with bash 4.2.10 nor 4.2.39. Tried turn on
>>> and off extglob shell option.
>>> Can you please resend your report with `bashbug' script? Or at least say
>>> which linux distribution you are using?
>>>
>>> RR
>>>
>>
>> Ubuntu 12.04. My configuration is
>> https://github.com/ulfalizer/Configuration-files/blob/master/bash,
>> which I 'source' from the standard Ubuntu ~/.bash. I noticed the bug
>> while implementing the _super_glob function.
>>
>> bashbug information:
>>
>> Machine: i686
>> OS: linux-gnu
>> Compiler: gcc
>> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
>> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
>> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
>> -DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include
>> -I../bash/lib  -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector
>> --param=ssp-buffer-size=4 -Wformat -Wformat-security
>> -Werror=format-security -Wall
>> uname output: Linux Huvuddator 3.2.0-32-generic-pae #51-Ubuntu SMP Wed
>> Sep 26 21:54:23 UTC 2012 i686 i686 i386 GNU/Linux
>> Machine Type: i686-pc-linux-gnu
>>
>> /Ulf
>
> Left out some bashbug information:
>
> Bash Version: 4.2
> Patch Level: 24
> Release Status: release
>
> /Ulf

Oh - you need to enable 'globstar', not 'extglob'. :)

/Ulf



Document argument reuse behavior in 'help printf'?

2012-12-05 Thread Ulf Magnusson
Only the manual mentions that "the format is reused as necessary to
consume all of the arguments"; it would be nice if this was in 'help
printf' too.

/Ulf