Is this an IFS bug in getopts?

2011-04-26 Thread Steven W. Orr
GNU bash, version 4.0.35(1)-release (x86_64-redhat-linux-gnu) I ran a program that was supposed to die with an error message that said: Invalid format: example: 2.103.269.28-1-3 Instead, it died with: i -- Invalid format: example: 2.103.269.28-1-3 I traced the problem back to a call to getopt

Re: Is this an IFS bug in getopts?

2011-04-26 Thread DJ Mills
On Tue, Apr 26, 2011 at 11:42 AM, Steven W. Orr wrote: > GNU bash, version 4.0.35(1)-release (x86_64-redhat-linux-gnu) > > I ran a program that was supposed to die with an error message that said: > > Invalid format: example: 2.103.269.28-1-3 > > Instead, it died with: > > i -- Invalid format: ex

Re: Is this an IFS bug in getopts?

2011-04-26 Thread Steven W. Orr
On 4/26/2011 12:02 PM, DJ Mills wrote: On Tue, Apr 26, 2011 at 11:42 AM, Steven W. Orr wrote: GNU bash, version 4.0.35(1)-release (x86_64-redhat-linux-gnu) I ran a program that was supposed to die with an error message that said: Invalid format: example: 2.103.269.28-1-3 Instead, it died wi

Re: Is this an IFS bug in getopts?

2011-04-26 Thread Greg Wooledge
On Tue, Apr 26, 2011 at 12:41:49PM -0400, Steven W. Orr wrote: > >>It turns out that when I > >>called getopts, I had set IFS='-'. I assume you mean "when I called die". > die() > { > typeset opt > typeset opt_s=1 > typeset opt_i=0 > typeset err_opts= > OPTIND=1 > while ge

Re: Is this an IFS bug in getopts?

2011-04-26 Thread Anshul Narula
Its not related to getopts Run the following(with set -x probably): foo() { echo "$1" ;} foo -i oIFS=$IFS IFS=- foo -i IFS=$oIFS foo() { echo $1 ;} foo -i IFS=- foo -i If you run your code with set -x, you would notice that the real cause is that $err_opts is not quoted. You set IFS and are b

Re: Segfaults on some libtool invocations due to sbrk() assumptions

2011-04-26 Thread Chet Ramey
> The attached patch fixes the crashes by simply removing the > caching, which is useless anyway since libc already avoids calling the > kernel system call when sbrk is given 0. Thanks for the patch. It's dangerous to assume the whole world is Linux or glibc. Chet -- ``The lyf so short, the

Re: Segfaults on some libtool invocations due to sbrk() assumptions

2011-04-26 Thread Roman Rakus
On 04/26/2011 09:38 PM, Chet Ramey wrote: The attached patch fixes the crashes by simply removing the caching, which is useless anyway since libc already avoids calling the kernel system call when sbrk is given 0. Thanks for the patch. It's dangerous to assume the whole world is Linux or glibc.