[U-Boot] [PATCH v4 6/7] gpt: Support for new "gpt" command

Stephen Warren swarren at wwwdotorg.org
Tue Nov 27 00:49:34 CET 2012


On 11/26/2012 06:08 AM, Piotr Wilczek wrote:
> 
> Stephen Warren wrote at Saturday, November 24, 2012 7:01 PM:
>> On 11/21/2012 04:22 AM, Piotr Wilczek wrote:
>>> Dear Stephen,
>>>
>>>> Stephen Warren wrote at Monday, November 19, 2012 10:35 PM:
>>>> On 11/09/2012 03:48 AM, Piotr Wilczek wrote:
>>>>> New command - "gpt" is supported. It restores the GPT partition table.
>>>>> It looks into the "partitions" environment variable for partitions definition.
>>>>> It can be enabled at target configuration file with CONFIG_CMD_GPT.
>>>>> Simple UUID generator has been implemented. It uses the the
>>>>> gd->start_addr_sp for entrophy pool. Moreover the pool address is used as crc32 seed.

>>>>> +/**
>>>>> + * extract_env(): Convert string from '&{env_name}' to 'env_name'
>>>>
>>>> s/&/$/
>>>>
>>>> It's doing more than that; it locates that syntax within an arbitrary
>>>> string and ignores anything before "${" or after "}". Is that
>>>> intentional?
>>>
>>> Yes, it was. The u-boot's shell expands to one only, so it allow to
>>> pass any partition parameter as env when the partitions list itself
>> is passed as env.
>>
>> OK. The issue here is that the comment doesn't exactly describe what
>> the code is doing.
>>
>> Also, what if the user wrote "foo${var}bar"; I can't recall if the code
>> handles that correct; is the result of that just "${var}", or do "foo"
>> and "bar" actually make it into the result string?
> 
> The 'bar' will be dropped, but to drop 'foo' a small modification is needed.

Rather than modify the code to drop "foo", why not modify it so that
"bar" and "foo" are included in the result? That seem more like what the
user desired, and is consistent with what any other shell or scripting
language would do. If not, please return an error in this case so that
bad syntax can be fixed.


More information about the U-Boot mailing list