[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Infinite loop generating terminfo.5 with bash 2.05
From: |
Samuel Mikes |
Subject: |
Re: Infinite loop generating terminfo.5 with bash 2.05 |
Date: |
Wed, 29 Aug 2001 16:10:41 -0600 (MDT) |
>> Hi there,
>>
>> I got an infinite loop while running MKterminfo.sh; read kept
>> returning '.ad'. Below is the change I made to work around it.
>> My system is:
Thomas> that's odd (is it a bug in bash? - I'm using bash 2.04 which
Thomas> is ok, though I recall that early bash2's were badly broken).
Thomas> Or maybe it's a problem with the sed script that feeds it.
Thomas> I'd first check to see what the sed script produces in
Thomas> $unsorted, to see if that's the problem.
$unsorted was finite. :) Here's the tail end of both unsorted and
sorted, from a suspended make:
address@hidden:/mnt/hdc3/src/ncurses-5.2/man$ tail -3 unsorted2494
set_pglen_inch slength sL T{YI Set page length to #1 hundredth of
an inchT}
.TE
.ad
address@hidden:/mnt/hdc3/src/ncurses-5.2/man$ tail sorted2494
.ad
.ad
.ad
.ad
.ad
.ad
.ad
.ad
.ad
.ad
It's definitely consistent behavior in bash (different file,
different version) -- at least on my box. Apparently, read doesn't
change the value of 'data' unless it's successful, so the 'test -z'
never succeeds. See below:
address@hidden:/tmp$ cat > test-bash
foo
bar
baz
address@hidden:/tmp$ while true; do read data; test -z "$data" && break; done <
test-bash
<interrupted by ^C>
address@hidden:/tmp$ while read data; do test -z "$data" && break; done <
test-bash
address@hidden:/tmp$
The similar test with an 'echo -n $data' in the loop yields
foobarbazbazbaz... for case 1, and foobarbaz in case 2.
>> GNU bash, version 2.05.0(1)-release (i486-pc-linux-gnulibc1) Linux
>> kernel 2.0.36 (Slackware dist)
I also tested both my test files and MKterminfo.sh with an old
version of bash (1.13.1), and got the same results as with 2.05.
Could it be something in the C library? The one I have is
antique.
--
Sam Mikes
address@hidden