On Sun, Jan 12, 2014 at 3:11 AM, Theodoros V. Kalamatianos <thk...@gmail.com
> wrote:

> Hi,
>
> I have bumped into a rather strange issue:
>
> $ set -- ''; printf "=%s=\n" "$@" x
> ==
> =x=
> $ set -- ''; printf "=%s=\n" "${@:1}" x
> =x=
>
> Notice how in the second version the empty positional parameter is no
> longer displayed. Also compare with this version:
>
> $ set -- '' ''; printf "=%s=\n" "${@:1}" x
> =x=
> ==
> ==
>
> Now both empty arguments appear nornally. Also this check verifies that
> this is not a `printf' issue:
>
> $ set -- ''; set -- "${@:1}"; echo "$#"
> 0
>
> It seems that the issue has something to do with expanding a slice with a
> single empty element:
>
> $ set -- '' ''; printf "=%s=\n" "${@:1:1}" x
> =x=
>
> The same issue also happens with arrays:
>
> $ A=('' ''); printf "=%s=\n" "${A[@]:0}" x
> ==
> ==
> =x=
> $ A=('' ''); printf "=%s=\n" "${A[@]:0:1}" x
> =x=
> $ A=('' ''); printf "=%s=\n" "${A[@]:1}" x
> =x=
>
> I encountered this on bash-4.2.037, as provided by the Mageia 3 Linux
> distribution, but according to a contact on IRC, this issue also affects
> the latest patch (4.2.045).
>
> I would be happy to provide any information that you may need.
>
>
> Best regards,
>
> Theodoros V. Kalamatianos
>
> patch 32 seems to have caused this

Reply via email to