Re: why do i get "invalid day of month"

2000-06-11 Thread David T-G

Hi, all --

Bob, thanks a bunch for your patch; I think that it would be a pretty good
thing and don't immediately see a reason to use octal or hex nummbering
anyway (does anyone?)  Mikko, you must have way too much time on your
hands :-)

Thanks to all for the quick pointer to the real cause -- PEBKAC :-)


:-D
-- 
David T-G   * It's easier to fight for one's principles
(play) [EMAIL PROTECTED]  * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.bigfoot.com/~davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
The "new millennium" starts at the beginning of 2001.  There was no year 0.
Note: If bigfoot.com gives you fits, try sector13.org in its place. *sigh*


 PGP signature


Re: why do i get "invalid day of month"

2000-06-09 Thread Bob Bell

On Fri, Jun 09, 2000 at 05:50:51PM +0300, Mikko Hnninen <[EMAIL PROTECTED]> wrote:
> I wonder if it would be possible to make Mutt always assume decimal, as
> I doubt anyone will be specifying dates in either octal or hex. :-)
> 
> It's kind of cool though, a limit of  ~r 011/6/0x7d0-  actually works.
> :-)

The attached patch (patch-1.3.2.bbell.pattern.1) can be applied to
to force base 10 parsing of dates.  It does not force base 10 everywhere.
I believe this patch is desirable as dates are often represented with
leading zeroes.

Looking at the (unpatched) code, there is a mix of using base 10
or not:
color.c:318:*col = strtol (s, &eptr, 10);
color.c:566:  *ql = strtol(buf->data + 6, &eptr, 10);
handler.c:1245:   strtol (length, NULL, 10));
hdrline.c:244:  min_width = strtol (prefix, &p, 10);
hdrline.c:248:max_width = strtol (prefix, &p, 10);
init.c:1091:  val = strtol (tmp->data, &t, 0);
pattern.c:269:  pat->min = strtol (s->dptr + 1, &tmp, 0) + 1; /* exclusive range */
pattern.c:272:  pat->min = strtol (s->dptr, &tmp, 0);
pattern.c:306:pat->max = strtol (tmp, &tmp, 0);
pattern.c:334:  t->tm_mday = strtol (s, &p, 0);
pattern.c:348:  t->tm_mon = strtol (p, &p, 0) - 1;
pattern.c:360:  t->tm_year = strtol (p, &p, 0);
pattern.c:375:  int offset = strtol (s, &ps, 0);

My patch patch-1.3.2.bbell.pattern.1 fixes pattern.c lines 334,
348, and 360 to work on dates only.  If you want to throw octal and
hexadecimal parsing out the window entirely, you can apply
patch-1.3.2.bbell.strtol.1 instead.  This is a little more consistent,
though you potentially lose some power.

I'll leave the decision up to someone else :-)

-- 
Bob BellCompaq Computer Corporation
Software Engineer   110 Spit Brook Rd - ZKO3-3/U14
TruCluster GroupNashua, NH 03062-2698
[EMAIL PROTECTED] 603-884-0595


--- old/mutt-1.3.2/pattern.cTue May  9 11:23:01 2000
+++ mutt-1.3.2/pattern.cFri Jun  9 11:50:55 2000
@@ -331,7 +331,7 @@ static const char *getDate (const char *
   time_t now = time (NULL);
   struct tm *tm = localtime (&now);
 
-  t->tm_mday = strtol (s, &p, 0);
+  t->tm_mday = strtol (s, &p, 10);
   if (t->tm_mday < 1 || t->tm_mday > 31)
   {
 snprintf (err->data, err->dsize, _("Invalid day of month: %s"), s);
@@ -345,7 +345,7 @@ static const char *getDate (const char *
 return p;
   }
   p++;
-  t->tm_mon = strtol (p, &p, 0) - 1;
+  t->tm_mon = strtol (p, &p, 10) - 1;
   if (t->tm_mon < 0 || t->tm_mon > 11)
   {
 snprintf (err->data, err->dsize, _("Invalid month: %s"), p);
@@ -357,7 +357,7 @@ static const char *getDate (const char *
 return p;
   }
   p++;
-  t->tm_year = strtol (p, &p, 0);
+  t->tm_year = strtol (p, &p, 10);
   if (t->tm_year < 70) /* year 2000+ */
 t->tm_year += 100;
   else if (t->tm_year > 1900)


diff -rup old/mutt-1.3.2/init.c mutt-1.3.2/init.c
--- old/mutt-1.3.2/init.c   Sat May 20 03:30:46 2000
+++ mutt-1.3.2/init.c   Fri Jun  9 11:57:27 2000
@@ -1088,7 +1088,7 @@ static int parse_set (BUFFER *tmp, BUFFE
   s->dptr++;
 
   mutt_extract_token (tmp, s, 0);
-  val = strtol (tmp->data, &t, 0);
+  val = strtol (tmp->data, &t, 10);
 
   if (!*tmp->data || *t || (short) val != val)
   {
diff -rup old/mutt-1.3.2/pattern.c mutt-1.3.2/pattern.c
--- old/mutt-1.3.2/pattern.cTue May  9 11:23:01 2000
+++ mutt-1.3.2/pattern.cFri Jun  9 11:57:56 2000
@@ -266,10 +266,10 @@ int eat_range (pattern_t *pat, BUFFER *s
 if (*s->dptr == '>')
 {
   pat->max = M_MAXRANGE;
-  pat->min = strtol (s->dptr + 1, &tmp, 0) + 1; /* exclusive range */
+  pat->min = strtol (s->dptr + 1, &tmp, 10) + 1; /* exclusive range */
 }
 else
-  pat->min = strtol (s->dptr, &tmp, 0);
+  pat->min = strtol (s->dptr, &tmp, 10);
 if (toupper (*tmp) == 'K') /* is there a prefix? */
 {
   pat->min *= 1024;
@@ -303,7 +303,7 @@ int eat_range (pattern_t *pat, BUFFER *s
   if (isdigit ((unsigned char) *tmp))
   {
 /* range maximum */
-pat->max = strtol (tmp, &tmp, 0);
+pat->max = strtol (tmp, &tmp, 10);
 if (toupper (*tmp) == 'K')
 {
   pat->max *= 1024;
@@ -331,7 +331,7 @@ static const char *getDate (const char *
   time_t now = time (NULL);
   struct tm *tm = localtime (&now);
 
-  t->tm_mday = strtol (s, &p, 0);
+  t->tm_mday = strtol (s, &p, 10);
   if (t->tm_mday < 1 || t->tm_mday > 31)
   {
 snprintf (err->data, err->dsize, _("Invalid day of month: %s"), s);
@@ -345,7 +345,7 @@ static const char *getDate (const char *
 return p;
   }
   p++;
-  t->tm_mon = strtol (p, &p, 0) - 1;
+  t->tm_mon = strtol (p, &p, 10) - 1;
   if (t->tm_mon < 0 || t->tm_mon > 11)
   {
 snprintf (err->data, err->dsize, _("Invalid month: %s"), p);
@@ -357,7 +357,7 @@ static const char *getDate (const char *
 return p;
   }
   p++;
-  t->tm_year = strtol (p, &p, 0);
+  t->tm_year = strtol (p, &p, 10);
   if (t->tm_year < 70) /* year 2000+ */

Re: why do i get "invalid day of month"

2000-06-09 Thread Mikko Hänninen

Chr. v. Stuckrad <[EMAIL PROTECTED]> wrote on Fri, 09 Jun 2000:
> Mutt may be stumbling upon an octal digit '9'
> which is illegal by reading the Number '09'
> which is 'in octal' beginning with '0'.

Yes, this must be it.  I tried 01/09/1999- as the limit, and Mutt then
complained of invalid month.

I wonder if it would be possible to make Mutt always assume decimal, as
I doubt anyone will be specifying dates in either octal or hex. :-)

It's kind of cool though, a limit of  ~r 011/6/0x7d0-  actually works.
:-)


Mikko
-- 
// Mikko Hänninen, aka. Wizzu  //  [EMAIL PROTECTED]  //  http://www.iki.fi/wiz/
// The Corrs list maintainer  //   net.freak  //   DALnet IRC operator /
// Interests: roleplaying, Linux, the Net, fantasy & scifi, the Corrs /
Ten years since I went out of my mind; I won't go back.



Re: why do i get "invalid day of month"

2000-06-09 Thread Lars Hecking

Chr. v. Stuckrad writes:
> This 'leaving out the '0' might explain it :-)
> 
> Mutt may be stumbling upon an octal digit '9'
> which is illegal by reading the Number '09'
> which is 'in octal' beginning with '0'.
> (Standard conversion in C-library).
 
 I was just about to post this, but you beat me to it :)

 It certainly fits David's observation that everything
 worked fine until 7th June ...




Re: why do i get "invalid day of month"

2000-06-09 Thread Chr. v. Stuckrad

This 'leaving out the '0' might explain it :-)

Mutt may be stumbling upon an octal digit '9'
which is illegal by reading the Number '09'
which is 'in octal' beginning with '0'.
(Standard conversion in C-library).

I did not look in the sources though,
but I had that problem a few times in programs :-)

Stucki

On Fri, Jun 09, 2000 at 05:28:07PM +0300, Mikko Hänninen wrote:
> David T-G <[EMAIL PROTECTED]> wrote on Fri, 09 Jun 2000:
> >   push "l ~N ~r 09/06/2000-\n"
> 
> >   Invalid day of month: 09/06/2000-
...

> Leaving out the 0 before the 9 ("9/06/2000") helps, Mutt doesn't
> complain anymore.
...


-- 
Christoph von Stuckrad   * *  | talk to  | <[EMAIL PROTECTED]> \
Freie Universitaet Berlin|/_* | nickname | Tel(days):+49 30 838-75 459 |
Fachbereich Mathematik, EDV  |\ * | 'stucki' | Tel(else):+49 30 77 39 6600 |
Arnimallee 2-6/14195 Berlin  * *  |  on IRC  | Fax(alle):+49 30 838-75454 /



Re: why do i get "invalid day of month"

2000-06-09 Thread Mikko Hänninen

David T-G <[EMAIL PROTECTED]> wrote on Fri, 09 Jun 2000:
>   push "l ~N ~r 09/06/2000-\n"

>   Invalid day of month: 09/06/2000-

Reproduced here.  (Mutt 1.1.9)  I didn't try it with push, just a
regular limit command.

Leaving out the 0 before the 9 ("9/06/2000") helps, Mutt doesn't
complain anymore.

> TIA for any suggestions, including the real answer...

No idea why it does that...


Mikko
-- 
// Mikko Hänninen, aka. Wizzu  //  [EMAIL PROTECTED]  //  http://www.iki.fi/wiz/
// The Corrs list maintainer  //   net.freak  //   DALnet IRC operator /
// Interests: roleplaying, Linux, the Net, fantasy & scifi, the Corrs /
"The trouble with political jokes is that they get elected."



why do i get "invalid day of month"

2000-06-09 Thread David T-G

Hi, folks --

A while back I asked about automatic limiting by date and for help with
pushing in a limit command when calling mutt from a script.  Well, I have
all of that worked out -- or thought I did, at least.

My little script goes through the procmail logs and generates a list of
folders to open, and also checks the date flag file to see when this
particular log was started so that it can construct the muttrc.date file
for limiting.  Now, all of this has been working just fine up until a day
or two ago, when I started getting the error above upon firing up mutt.
Note that this happens whether or not I have any messages that should
match the criteria; it's not *that* message that I get in this case.

The generated muttrc file looks like

  source /xtra/home/davidtg/.mutt/muttrc
  push "l ~N ~r 09/06/2000-\n"

and it obviously sources my real muttrc and then pushes in the limit
command.  At first, when this popped up yesterday, I thought that the
problem was because I was trying to limit to the same day -- and, sure
enough, resetting it to 07/06 worked like a charm.  Then 08 Jun tipped
over into 09 Jun and I found that 08 Jun was *still* a problem; hmmm.
Well, now it's well into 09 Jun and I still get that error message -- and
I get it with 08/06, too, and have to go back to 07/06.  The actual error
string is

  Invalid day of month: 09/06/2000-

but changing the '9' to a '7' works like a charm.

I'm thoroughly confused :-)


TIA for any suggestions, including the real answer...

:-D
-- 
David T-G   * It's easier to fight for one's principles
(play) [EMAIL PROTECTED]  * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.bigfoot.com/~davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
The "new millennium" starts at the beginning of 2001.  There was no year 0.
Note: If bigfoot.com gives you fits, try sector13.org in its place. *sigh*


 PGP signature