reassign 374565 bash
tag 374565 upstream
thanks
On Sat, Jun 24, 2006 at 03:46:43PM +0200, Frédéric Bothamy wrote:
> * Justin Pryzby <[EMAIL PROTECTED]> [2006-06-23 14:24] :
> > On Fri, Jun 23, 2006 at 01:27:18AM +0200, Fr??d??ric Bothamy wrote:
> > > * Justin Pryzby <[EMAIL PROTECTED]> [2006-06-21 08:47] :
> > > > On Wed, Jun 21, 2006 at 02:25:31AM +0200, Fr??d??ric Bothamy wrote:
> > >
> > > [...]
> > >
> > > > > pn openoffice.org2-core <n?ant>
> > > > > (aucune description n'est disponible)
> > > > >
> > > > > /usr/bin/dlocate: line 55: 26638 Done egrep "$1"
> > > > > $DPKGLIST
> > > > > 26639 Erreur de segmentation | while read stat name ver descr;
> > > > > do
> > > > > printf "%-2s %-${fieldw}.${fieldw}s %-${fieldw}.${fieldw}s
> > > > > %-${fieldd}.${fieldd}s\\n" "$stat" "$name" "$ver" "$descr";
> > > > > done
> > > > >
> > > > > Program exited normally.
> > > > > (gdb)
> > > > >
> > > > > Do you have another idea?
> > > > Is egrep the one segfaulting? You can do the same as before to build
> > > > a "grep" deb with debugging symbols, then just dpkg -i
> > > > ../grep_....deb. apt-get {--re,}install grep later if you wish.
> > > >
> > > > It isn't completely clear to me how gdb would handle debugging the
> > > > grep; you might have to change the shell script to use
> > > >
> > > > 'gdb egrep "$1" $DPKGLIST'
> > > >
> > > > instead, or just dump "$1" and $DPKGLIST to a file to fiddle with it
> > > > manually.
> > >
> > > Hello Justin,
> > >
> > > Thanks for your help.
> > >
> > > I have tried to see if this was a problem with egrep and I have replaced
> > > the egrep in the dlocate script with a simple "cat $DPKGLIST". The
> > > segfault also occurs. But it does not occur if I use a "head $DPKGLIST".
> > What is the contents of $DPKGLIST? you should
> > echo "$DPKGLIST" >/tmp/testgrep
> >
> > The quotes are important. It occurs to me that, without quotes, you
> > could end up with $DPKGLIST being its own command, eg. if it contains
> > any of: ;`& or such characters.. But this is perhaps also intentional
> > (and ` is still evaluated within "" quotes).
>
> Sorry, I realize that I have quite unclear. $DPKGLIST is
> /var/lib/dlocate/dpkg-list, this file contains the output of:
>
> LINES=40 COLUMNS=200 dpkg -l "*" | sed -e '1,5d' -e 's/ */ /g'
>
> using the current locale.
>
> > > I have found that the problem only occurs if I send 276 lines (or more)
> > > of text to the "| while ...".
> > Interesting..
> >
> > > If I try to execute the dlocate script with "sh -x" at the beginning
> > > of the script, I need 373 lines to get the segmentation error.
> > >
> > > If I execute the lines of the script at the command prompt, I get an
> > > error with 22504. Here is the exact command that I used:
> > 22504 is the number of lines of input, the line number, or a PID?
>
> Argh, my fault again for being very unclear :-(. 22504 is the number
> of lines which is causing a segmentation error in this cas.
>
> > > $ echo $COLUMNS
> > > 150
> > > $ ((fieldw=(COLUMNS-24)/4))
> > > $ ((fieldd=COLUMNS-fieldw*2-6))
> > > $ cat dpkg-list_fr | while read stat name ver descr; do printf "%-2s
> > > %-${fieldw}.${fieldw}s %-${fieldw}.${fieldw}s %-${fieldd}.${fieldd}s\\n"
> > > "$stat" "$name" "$ver" "$descr"; done
> > Does this crash cat, printf, or what? You can get rid of the cat by
> > rewriting as:
> >
> > while read .. .. .. ..; do ..; done <dpkg-list_fr
> >
> > I suspect this is a bash problem with wide characters or such.
>
> You are right. I have used the following procedure to debug my problem
> (I try to be more precise than before):
>
> [EMAIL PROTECTED]:~/debian/bash/bash-3.1/build-bash$ gdb ./bash
> GNU gdb 6.4.90-debian
> Copyright (C) 2006 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for details.
> This GDB was configured as "i486-linux-gnu"...Using host libthread_db
> library "/usr/lib/debug/libthread_db.so.1".
>
> (gdb) r
> Starting program: /home/fred/debian/bash/bash-3.1/build-bash/bash
> [EMAIL PROTECTED]:~/debian/bash/bash-3.1/build-bash$ COLUMNS=$(stty -a 2>&- |
> sed -ne '/columns/s/.*columns \([0-9]*\)[^0-9].*/\1/p');
> [EMAIL PROTECTED]:~/debian/bash/bash-3.1/build-bash$
> ((fieldw=(COLUMNS-24)/4));
> [EMAIL PROTECTED]:~/debian/bash/bash-3.1/build-bash$
> ((fieldd=COLUMNS-fieldw*2-6));
> [EMAIL PROTECTED]:~/debian/bash/bash-3.1/build-bash$ while read stat name ver
> descr; do printf "%-2s %-${fieldw}.${fieldw}s %-${fieldw}.${fieldw}s
> %-${fieldd}.${fieldd}s\\n" "$stat" "$name" "$ver" "$descr"; done <
> /home/fred/dlocate/dpkg-list_fr
> [...]
>
> pn libregexp-shellish-perl <néant> (aucune
> description n'est disponible)
> pn libregexx-dev <néant> (aucune
> description n'est disponible)
> pn libregexx1 <néant> (aucune
> description n'est disponible)
> pn libregexx1c102 <néant> (aucune
> description n'est disponible)
> pn libreiser4-dev <néant> (aucune
> description n'est disponible)
>
> Program received signal SIGSEGV, Segmentation fault.
So this really is a bash bug.
> *__GI_wcschr (wcs=0x8354000, wc=233) at wcschr.c:29
... about wide characters. :)
> Notes:
> - the file /home/fred/dlocate/dpkg-list_fr is a dlocate dpkg-list
> file (I can send it to you if you want, it's about 133 kB bzip2-ed)
Please send a copy to the bug log.
> Hopefully this can give you a better idea of the real problem with wide
> characters.
Thanks for the debugging work. I'll leave the rest to the bash maintainers.
Justin