Re: [MERGE] Honor octal and hex prefixes in squid.conf integers

From: Amos Jeffries <squid3@dont-contact.us>
Date: Thu, 3 Apr 2008 16:26:58 +1300 (NZDT)

> Hello,
>
> A umask port from Squid2 discovered that Squid3 parses squid.conf
> file integers as decimal numbers while Squid2 honors 0 and 0x prefixes
> (indicating octal and hex numbers). The later functionality is needed
> for things like unmask that are traditionally specified using octal
> format.
>
> The change to honor other integer bases was introduced in Squid2 before
> 2005/05/17. I failed to track the commit that did it, unfortunately. The
> cache_cf.c file was changed in Squid2 HEAD as the result of this:
>
>> revision 1.422
>> date: 2005/05/17 16:56:37; author: hno; state: Exp; lines: +285 -209
>> Reset Squid-2 HEAD to the current state of Squid-2.5 to reduce
>> confustion
>>
>> the old Squid-2 HEAD is available as the branch OLD_SQUID_2_6 if needed.
>
>
> My patch changes Squid3 behavior to match that of Squid2.

bb: approve

>
> The alternative is to add a new "base_integer" type to squid.conf. That
> type would honor prefixes while the current "int" type will not.
> However, if Squid2 did not significant problem with flexible integer
> parsing, Squid3 should be OK as well. Also, such a subtle difference
> between the two configurations would make upgrading more difficult for
> those rare cases where an admin used a non-decimal integer in squid.conf
> for things other than umask (on purpose or by accident).

I agree with you on such a difference causing problems. I don;t think we
need it.

>
> I doubt bzr managed to generate a proper bundle, even though I did
> follow instructions and did _not_ commit before running the two commands
> below. I have no idea why bzr send did not work and --verbose does not
> produce more info.
>
> bzr diff -r submit: | less
> bzr send --mail-to=squid-dev@squid-cache.org

Hmm, what is the output of:
    bzr info

>
> To compensate, I am quoting the one-line patch below.
>
> Thank you,
>
> Alex.
>
> === modified file 'src/Parsing.cc'
> --- src/Parsing.cc 2007-08-13 23:20:50 +0000
> +++ src/Parsing.cc 2008-04-02 15:51:03 +0000
> @@ -89,7 +89,8 @@
> if (token == NULL)
> self_destruct();
>
> - if (sscanf(token, "%d", &i) != 1)
> + // %i honors 0 and 0x prefixes, which are important for things like
> umask
> + if (sscanf(token, "%i", &i) != 1)
> self_destruct();
>
> return i;
>
>
Received on Wed Apr 02 2008 - 21:27:02 MDT

This archive was generated by hypermail 2.2.0 : Wed Apr 30 2008 - 12:00:07 MDT