bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

'mail -H' generates a range error when there are no messages (w/ patch)


From: Matthew Whitworth
Subject: 'mail -H' generates a range error when there are no messages (w/ patch)
Date: Fri, 28 Jun 2002 12:23:14 -0700

Invoking mail with the -H option generates a "range error" error
message when there are no messages in the folder being queried.

Here is a backtrace of me invoking 'mail --nosum -H', which finds no
messages in my system inbox:

--

address@hidden:~$ gdb --quiet /usr/local/bin/mail
(gdb) set args --nosum -H
(gdb) b yyerror
Breakpoint 1 at 0x804e6fa: file msgset.y, line 226.
(gdb) run
Starting program: /usr/local/stow/mailutils/bin/mail --nosum -H
[New Thread 1024 (LWP 9302)]
mail (mailutils) 0.0.9d, Copyright (C) 2001 Free Software Foundation, Inc.
mail is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
Send bug reports to <address@hidden>.
[Switching to Thread 1024 (LWP 9302)]

Breakpoint 1, yyerror (s=0x805655f "range error") at msgset.y:226
226       fprintf (stderr, "%s: ", xargv[0]);
(gdb) bt
#0  yyerror (s=0x805655f "range error") at msgset.y:226
#1  0x0804eb66 in msgset_range (low=1, high=0) at msgset.y:404
#2  0x0804e178 in yyparse () at msgset.y:93
#3  0x0804ea22 in msgset_parse (argc=2, argv=0x805c3f8, mset=0xbffffa68)
    at msgset.y:331
#4  0x0805167a in util_msglist_command (func=0x804c070 <mail_from>, argc=2, 
    argv=0x805c3f8, set_cursor=0) at util.c:159
#5  0x0804c094 in mail_from (argc=2, argv=0x805c3f8) at from.c:28
#6  0x08051615 in util_do_command (c=0x8055d20 "from *") at util.c:131
#7  0x0804d5f5 in main (argc=3, argv=0x805a8a8) at mail.c:444
(gdb) c
Continuing.
from: range error near end

Program exited normally.
(gdb) quit

--

The problem is that yyparse() interprets '*' as "from 1 to total".
When a mailbox is empty, total = 0 and yyparse() invokes
msgset_range(low=1, high=0), which generates the range error.

I have produced a simple one line patch which returns an empty list
rather than invoking msgset_range() when total = 0.

--

Index: msgset.y
===================================================================
RCS file: /cvsroot/mailutils/mailutils/mail/msgset.y,v
retrieving revision 1.10
diff -r1.10 msgset.y
93c93
<            result = msgset_range (1, total);
---
>            result = (total > 0) ? msgset_range (1, total) : NULL;

--

Thank you,

Matthew



reply via email to

[Prev in Thread] Current Thread [Next in Thread]