* Configure mangles hex values
@ 2005-01-24 22:16 Nick Pollitt
2005-01-24 22:41 ` Nick Pollitt
0 siblings, 1 reply; 5+ messages in thread
From: Nick Pollitt @ 2005-01-24 22:16 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: kaos, Kernel Mailing List
When doing a make oldconfig, the hex function strips the leading '0x' from hex
values. The '0x' is needed in the final autoconf.h, and its absence causes
the following problem.
If I start with a hex value in my config file like this:
CONFIG_LOWMEM_SIZE=0x40000000
When I run make oldconfig, it strips out the '0x' leaving this:
CONFIG_LOWMEM_SIZE=40000000
Then if I run make xconfig, this is not considered a valid hex value, so it
replaces my value with the default:
CONFIG_LOWMEM_SIZE=0x20000000
The following patch removes the lines that strip the 0x from the hex value.
It also checks the result for the leading 0x and inserts it if necessary.
--- scripts/Configure.orig 2005-01-24 13:31:55.000000000 -0800
+++ scripts/Configure 2005-01-24 13:34:20.000000000 -0800
@@ -378,15 +378,18 @@
function hex () {
old=$(eval echo "\${$2}")
def=${old:-$3}
- def=${def#*[x,X]}
while :; do
readln "$1 ($2) [$def] " "$def" "$old"
- ans=${ans#*[x,X]}
- if expr "$ans" : '[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
- define_hex "$2" "0x$ans"
+ if expr "$ans" : '0x[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
+ define_hex "$2" "$ans"
break
else
- help "$2"
+ if expr "$ans" : '[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
+ define_hex "$2" "0x$ans"
+ break
+ else
+ help "$2"
+ fi
fi
done
}
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Configure mangles hex values
2005-01-24 22:16 Configure mangles hex values Nick Pollitt
@ 2005-01-24 22:41 ` Nick Pollitt
2005-01-25 9:20 ` Marcelo Tosatti
0 siblings, 1 reply; 5+ messages in thread
From: Nick Pollitt @ 2005-01-24 22:41 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: kaos, Kernel Mailing List
Sorry about previous message.
The hex function in scripts/Configure strips the leading 0x from hex values.
The 0x needs to be there in autoconf.h, and stripping it out causes the
following problematic scenario:
If I start with a hex value in my config file like this:
CONFIG_LOWMEM_SIZE=0x40000000
and then run make oldconfig, it strips out the '0x' so I end up with this:
CONFIG_LOWMEM_SIZE=40000000
Then if I run make xconfig, it doesn't think this is a valid hex value, so it
replaces my value with the default:
CONFIG_LOWMEM_SIZE=0x20000000
The following patch removes the lines that strip out 0x, and inserts the 0x if
appropriate.
--- scripts/Configure.orig 2005-01-24 13:31:55.000000000 -0800
+++ scripts/Configure 2005-01-24 13:34:20.000000000 -0800
@@ -378,15 +378,18 @@
function hex () {
old=$(eval echo "\${$2}")
def=${old:-$3}
- def=${def#*[x,X]}
while :; do
readln "$1 ($2) [$def] " "$def" "$old"
- ans=${ans#*[x,X]}
- if expr "$ans" : '[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
- define_hex "$2" "0x$ans"
+ if expr "$ans" : '0x[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
+ define_hex "$2" "$ans"
break
else
- help "$2"
+ if expr "$ans" : '[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
+ define_hex "$2" "0x$ans"
+ break
+ else
+ help "$2"
+ fi
fi
done
}
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Configure mangles hex values
2005-01-24 22:41 ` Nick Pollitt
@ 2005-01-25 9:20 ` Marcelo Tosatti
2005-01-25 17:25 ` Nick Pollitt
0 siblings, 1 reply; 5+ messages in thread
From: Marcelo Tosatti @ 2005-01-25 9:20 UTC (permalink / raw)
To: Nick Pollitt; +Cc: kaos, Kernel Mailing List
Hi Nick,
Curiosity: What was the reason for stripping the leading 0x?
On Mon, Jan 24, 2005 at 02:41:56PM -0800, Nick Pollitt wrote:
> Sorry about previous message.
>
> The hex function in scripts/Configure strips the leading 0x from hex values.
> The 0x needs to be there in autoconf.h, and stripping it out causes the
> following problematic scenario:
>
> If I start with a hex value in my config file like this:
> CONFIG_LOWMEM_SIZE=0x40000000
> and then run make oldconfig, it strips out the '0x' so I end up with this:
> CONFIG_LOWMEM_SIZE=40000000
> Then if I run make xconfig, it doesn't think this is a valid hex value, so it
> replaces my value with the default:
> CONFIG_LOWMEM_SIZE=0x20000000
>
> The following patch removes the lines that strip out 0x, and inserts the 0x if
> appropriate.
>
> --- scripts/Configure.orig 2005-01-24 13:31:55.000000000 -0800
> +++ scripts/Configure 2005-01-24 13:34:20.000000000 -0800
> @@ -378,15 +378,18 @@
> function hex () {
> old=$(eval echo "\${$2}")
> def=${old:-$3}
> - def=${def#*[x,X]}
> while :; do
> readln "$1 ($2) [$def] " "$def" "$old"
> - ans=${ans#*[x,X]}
> - if expr "$ans" : '[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
> - define_hex "$2" "0x$ans"
> + if expr "$ans" : '0x[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
> + define_hex "$2" "$ans"
> break
> else
> - help "$2"
> + if expr "$ans" : '[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
> + define_hex "$2" "0x$ans"
> + break
> + else
> + help "$2"
> + fi
> fi
> done
> }
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Configure mangles hex values
2005-01-25 9:20 ` Marcelo Tosatti
@ 2005-01-25 17:25 ` Nick Pollitt
2005-01-26 1:10 ` Keith Owens
0 siblings, 1 reply; 5+ messages in thread
From: Nick Pollitt @ 2005-01-25 17:25 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: kaos, Kernel Mailing List
Hello. I'm thinking that the 0x was stripped for purely cosmetic reasons
rather than anything functional. I had originally thought that the readln
function might need the formatting, but taking a closer look at it now I
don't see any need.
Nick
On Tuesday 25 January 2005 1:20 am, Marcelo Tosatti wrote:
> Hi Nick,
>
> Curiosity: What was the reason for stripping the leading 0x?
>
> On Mon, Jan 24, 2005 at 02:41:56PM -0800, Nick Pollitt wrote:
> > Sorry about previous message.
> >
> > The hex function in scripts/Configure strips the leading 0x from hex
> > values. The 0x needs to be there in autoconf.h, and stripping it out
> > causes the following problematic scenario:
> >
> > If I start with a hex value in my config file like this:
> > CONFIG_LOWMEM_SIZE=0x40000000
> > and then run make oldconfig, it strips out the '0x' so I end up with
> > this: CONFIG_LOWMEM_SIZE=40000000
> > Then if I run make xconfig, it doesn't think this is a valid hex value,
> > so it replaces my value with the default:
> > CONFIG_LOWMEM_SIZE=0x20000000
> >
> > The following patch removes the lines that strip out 0x, and inserts the
> > 0x if appropriate.
> >
> > --- scripts/Configure.orig 2005-01-24 13:31:55.000000000 -0800
> > +++ scripts/Configure 2005-01-24 13:34:20.000000000 -0800
> > @@ -378,15 +378,18 @@
> > function hex () {
> > old=$(eval echo "\${$2}")
> > def=${old:-$3}
> > - def=${def#*[x,X]}
> > while :; do
> > readln "$1 ($2) [$def] " "$def" "$old"
> > - ans=${ans#*[x,X]}
> > - if expr "$ans" : '[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
> > - define_hex "$2" "0x$ans"
> > + if expr "$ans" : '0x[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
> > + define_hex "$2" "$ans"
> > break
> > else
> > - help "$2"
> > + if expr "$ans" : '[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then
> > + define_hex "$2" "0x$ans"
> > + break
> > + else
> > + help "$2"
> > + fi
> > fi
> > done
> > }
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-01-26 1:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-24 22:16 Configure mangles hex values Nick Pollitt
2005-01-24 22:41 ` Nick Pollitt
2005-01-25 9:20 ` Marcelo Tosatti
2005-01-25 17:25 ` Nick Pollitt
2005-01-26 1:10 ` Keith Owens
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.