public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] Inconsistency between $filesize and commands which accept numeric params
Date: Tue, 04 Nov 2014 21:53:02 +0100	[thread overview]
Message-ID: <20141104205302.495EE38334F@gemini.denx.de> (raw)
In-Reply-To: <1415116135.11486.51.camel@hellion.org.uk>

Dear Ian,

In message <1415116135.11486.51.camel@hellion.org.uk> you wrote:
>
> > > /*
> > >  * Parse the user's input, partially heuristic.  Valid formats:
> > >  * <0x00112233 4 05>	- an array of cells.  Numbers follow standard
> > >  *			C conventions.
> > >  * [00 11 22 .. nn] - byte stream
> > >  * "string"	- If the the value doesn't start with "<" or "[", it is
> > >  *			treated as a string.  Note that the quotes are
> > >  *			stripped by the parser before we get the string.
> > > 
> > > which is inconsistent with the "U-Boot uses hex input base by default"
> > > mantra.
> > 
> > Because this is FDT centric and not U-Boot centric, yes?
> 
> I guess?

Well, we probably should not use this FDT centric decoding function
directly on arguments passed from the U-Boot command line.

> >   Since <decimal
> > numbers> is a valid thing to do in an entry here.  I think the right
> > answer is the more hacky sounding one of when you script using 'fdt set'
> > you need to be mindful of the constraints on input that are imposed upon
> > us by FDT.  <hex> is invalid but <0xhex> is what is expected.
> 
> The 0x prefix hack/trick is what I'm actually doing, but the maintainer
> of our test system wanted some assurances that u-boot wasn't going to
> change under our feet if someone fixed a bug.

I think this is a hack that is bound to break.  Today you use
$filesize, tomorrow you may find you need to perform some operations
on this (say, rounding up in some way), and you may end up with a
variable that already contains a "0x" prefix, and your code will fail
beause 0x0x... gets misinterpreted.

> Sounds like you are saying this is all working as designed, and there is
> no bug, but I'll let Wolfgang and you thrash that out ;-).

Tom: this is a bug ;-)

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The rule on staying alive as a program manager is to give 'em a  num-
ber or give 'em a date, but never give 'em both at once.

  reply	other threads:[~2014-11-04 20:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30 13:57 [U-Boot] Inconsistency between $filesize and commands which accept numeric params Ian Campbell
2014-10-30 15:21 ` Wolfgang Denk
2014-10-30 15:32   ` Ian Campbell
2014-11-04 15:44     ` Tom Rini
2014-11-04 15:48       ` Ian Campbell
2014-11-04 20:53         ` Wolfgang Denk [this message]
2014-11-04 20:58           ` Tom Rini
2014-11-04 21:20             ` Wolfgang Denk
2014-11-04 22:02               ` Tom Rini
2014-11-04 22:11                 ` Wolfgang Denk
2014-11-04 22:54                   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141104205302.495EE38334F@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox