[LEDE-DEV] [patch master 10/15] quote literal {

Jan-Tarek Butt tarek at ring0.de
Sat Oct 1 17:03:19 PDT 2016


Hi

On 10/01/16 10:57, Oswald Buddenhagen wrote:
> On Sat, Oct 01, 2016 at 12:30:22AM +0200, Lars Kruse wrote:
>> Am Fri, 30 Sep 2016 22:02:24 +0200 schrieb Jan-Tarek Butt <tarek at ring0.de>:
>>
>>> ---
>>>  scripts/getver.sh | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/scripts/getver.sh b/scripts/getver.sh
>>> index f8b4ed3..27f246e 100755
>>> --- a/scripts/getver.sh
>>> +++ b/scripts/getver.sh
>>> @@ -25,8 +25,8 @@ try_git() {
>>>  		;;
>>>  	*)
>>>  		BRANCH="$(git rev-parse --abbrev-ref HEAD)"
>>> -		ORIGIN="$(git rev-parse --verify --symbolic-full-name "${BRANCH}"@{u} 2>/dev/null)"
>>> -		[ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name master@{u} 2>/dev/null)"
>>> +		ORIGIN="$(git rev-parse --verify --symbolic-full-name "${BRANCH}"@'{'u'}' 2>/dev/null)"
>>> +		[ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name master@'{'u'}' 2>/dev/null)" REV="$(git rev-list ${REBOOT}.."$GET_REV" | wc -l | awk '{print $1}')" 
>>>  		if [ -n "$ORIGIN" ]; then
>>
>> out of curiosity: does this prevent a potential problem or is it just a
>> clarification for better readability?
>>
> bash doesn't do anything with braces if there is no comma between them,
> so this is a no-op. given the separate quoting of each brace, i'd
> venture that this patch serves mostly to confuse the reader.

Here is a explenation from

Curly brackets are normally used as syntax in parameter expansion,
command grouping and brace expansion. However, if they don't appear
alone at the start of an expression or as part of a parameter or
brace expansion, the shell silently treats them as literals.

in the above case that sould not do problems but I thougt safty first
and indetly every one can now see that @{u} is not a spcial bash command.

cheers
Tarek

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20161002/629e0192/attachment.sig>


More information about the Lede-dev mailing list