bug? report

From: Jim Carroll <jim@dont-contact.us>
Date: Fri, 31 Jan 1997 15:46:58 -0500

Subject: Re: re; unknown error messages

On Thu, 23 Jan 1997, Jim Carroll wrote:

> While trying to retrieve the URL: ftp://ftp.stairways.com/stairways
>
> The following FTP error was encountered:
>
> 4.122.19.78, port 1981: (22) Invalid argument

 
 Last week, I reported this problem I was having with the ftpget program
 (version squid-ftpget/1.1.5).
 
 The problem turned out to be with this particular line of code in ftpget:

 line ~1548:
 
    n = sscanf(server_reply_msg, "%[^0-9]%d,%d,%d,%d,%d,%d",
    junk, &h1, &h2, &h3, &h4, &p1, &p2);

 The code looked fine to me, so I simplified the example, and emailed a bug
 report off to our C compiler vendors support staff (Watcom).
 
 They answered back that the ANSI C standard was a little vague on how to
 handle the '-' construct. Here is the ANSI section I was quoted:

> The ANSI C Standard says: ( under fscanf, section 4.9.6.2 )
> "... If a - character is in the scanlist and is not the first, nor the
> second where the first character is a ^, nor the last character,
> the behavior is implementation-defined."

 Watcom has chosen a different interpretation of this statement than squid
 expects. Here is how they interpret the statement:
 
> This is actually being interpreted as:
> any characters not including the characters: '0', '-', '9'.

 Now I don't want to start a religious war on the interpretation of
 sscanf(), or which ANSI interpretation is better. I propose a minor
 modification to the squid code to squelch the problem:

    n = sscanf(server_reply_msg, "%[^0123456789]%d,%d,%d,%d,%d,%d",
    junk, &h1, &h2, &h3, &h4, &p1, &p2);

 There is no loss of efficiency and it is a little more specific as to what
 it does. I don't know who is the keeper of the main archive, but I thought
 this might make a useful (if very minor) modification.
   

---
Jim C., President       | C a r r o l l - N e t, Inc.
201-488-1332 voice      | New Jersey's Premier Internet Service Provider
201-487-5717 dialup     |
http://www.carroll.com  | Ask about our Business Web Services
Received on Fri Jan 31 1997 - 13:03:16 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:34:13 MST