Subject: bin/2158: [/usr/bin/more] prompt bug (if-less endif and unbalanced paren)
To: None <gnats-bugs@NetBSD.ORG>
From: None <enami@ba2.so-net.or.jp>
List: netbsd-bugs
Date: 03/02/1996 23:24:16
>Number: 2158
>Category: bin
>Synopsis: if-less endif and unbalanced paren in /usr/bin/more prompt
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Mar 2 10:05:00 1996
>Last-Modified:
>Originator: enami tsugutomo
>Organization:
a hacker in japan.
>Release: NetBSD current Mar 1.
>Environment:
System: NetBSD king-show 1.1A NetBSD 1.1A (KINGSHOW) #4: Sat Mar 2 00:16:51 JST 1996 enami@pavlov:/a/NetBSD/src/sys/arch/i386/compile/KINGSHOW i386
>Description:
When `more' is invoked with stdin, it prints unbalanced paren like
this:
(byte XXX
And there is if-less endif in m_proto[].
>How-To-Repeat:
Do following command,
cat <large-file-enough-to-more-work> | more
and then you may see (byte NNN in last line
Note that close paren is not displayed.
>Fix:
contents of m_proto[] in prompt.c is wrong.
The open paren is before if (?pB), but close paren is inside it.
and there is if-less end if in m_proto[]. Here is a pretty printed
figure of if/endif of m_proto[]. I don't know whether open paren
is mispalce or close paren is mispaced.
?f%f
. (this endif matches ?f)
?m(file %i of %m)
. (this endif matches ?m)
. (?????? - no matching if)
?e(END)
?x- Next\\
: %x
. (this endif matches ?x)
:( (open paren before `if pB')
?pB%pB\\%) (close paren inside `if pB')
:byte %bB
?s/%s
. (this endif matches ?s)
. (this endif matches ?pB)
. (this endif matches ?e)
%t
Sample work around.
*** prompt.c 1996/03/02 13:57:11 1.1
--- prompt.c 1996/03/02 14:12:21
***************
*** 57,63 ****
static char s_proto[] =
"?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\\: %x..%t";
static char m_proto[] =
! "?f%f .?m(file %i of %m) ..?e(END) ?x- Next\\: %x.:(?pB%pB\\%):byte %bB?s/%s...%t";
static char M_proto[] =
"?f%f .?n?m(file %i of %m) ..?ltline %lt?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\\: %x.:?pB%pB\\%..%t";
static char e_proto[] =
--- 57,63 ----
static char s_proto[] =
"?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\\: %x..%t";
static char m_proto[] =
! "?f%f .?m(file %i of %m) .?e(END) ?x- Next\\: %x.:(?pB%pB\\%:byte %bB?s/%s..).%t";
static char M_proto[] =
"?f%f .?n?m(file %i of %m) ..?ltline %lt?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\\: %x.:?pB%pB\\%..%t";
static char e_proto[] =
enami.
>Audit-Trail:
>Unformatted: