[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Empty strings disappear from array splice
From: |
marc . coiffier |
Subject: |
Re: Empty strings disappear from array splice |
Date: |
Thu, 22 Jan 2015 03:04:27 -0800 (PST) |
User-agent: |
G2/1.0 |
Le mercredi 21 janvier 2015 00:24:27 UTC+1, Eduardo A. Bustamante López a écrit
:
> On Tue, Jan 20, 2015 at 01:39:02PM -0800, marc.coiffier@gmail.com wrote:
> > > Seems to be either a Debian-specific bug, or a bug that was fixed in a
> > > later patch than Debian is using.
> >
> > Great ! Thank you for the quick response.
> >
> > If you have time for a followup question, do you know who I should contact
> > to get these patches pushed to Debian ? I am writing a completion helper
> > library (based on parser combinators) and it needs this feature to function
> > correctly, so it would mean a lot to me if I could make it work
> > out-of-the-box on most distros.
>
> dualbus@hp ~ % apt-cache show bash|grep ^Maintainer:
> Maintainer: Matthias Klose <doko@debian.org>
> Maintainer: Matthias Klose <doko@debian.org>
>
> Also:
>
> # debian unstable (sid)
> dualbus@hp ~ % /bin/bash -c 'echo "$BASH_VERSION"; arr1=( "" "" ); arr2=(
> "${arr1[@]:1}" ); declare -p arr1 arr2'
> 4.3.30(1)-release
> declare -a arr1='([0]="" [1]="")'
> declare -a arr2='([0]="")'
>
> # debian stable (wheezy)
> dualbus@dualbus ~ % /bin/bash -c 'echo "$BASH_VERSION"; arr1=( "" "" );
> arr2=( "${arr1[@]:1}" ); declare -p arr1 arr2'
> 4.2.37(1)-release
> declare -a arr1='([0]="" [1]="")'
> declare -a arr2='()'
>
> And:
>
> # v- you want this
> dualbus@hp ~ % w3m -dump
> 'https://bugs.debian.org/cgi-bin/pkgreport.cgi?dist=stable;package=bash' |
> head
> Debian Bug report logs: Bugs in package bash (version 4.2+dfsg-0.1+deb7u3) in
> stable
> Maintainers for bash are Matthias Klose <doko@debian.org>.
Thanks (silly me, I didn't even think to look into the Maintainer field)
> You may want to refer to the following packages that are part of the same
> source: bash-builtins, bash-doc, bash-static.
>
> You might like to refer to the bash package page, to the Package Tracking
> System, or to the source package src:bash's bug page.
I'll give it a try, although my use case is pretty specific so I don't think
many people stumbled onto it (I mean, who counts empty strings in an array ?)
> Please do consider that it's highly likely that you won't get them to update
> that for you, since that fix could break stuff, and that's the whole point of
> stable, to not break things. Use a work-around, that's the sanest way.
I'd argue that breakage would be minimal by fixing this bug, because it would
mean that the broken programs not only knew of the bug, but **depended** on it
when it clearly goes against documented behaviour. That doesn't seem very
likely.
Plus, sanity was never my most defining quality so I guess I have no choice but
to try :-D
> A for loop, for example.
In case they don't release the patch for wheezy, I guess I could implement a
workaround, but since I use the splice feature in inner loops, I'm afraid of
the impact on performance going from a builtin feature to an interpreted
subloop.
Anyway, thanks for the advice and help, and a great day to you :-)