Re: [PATCH v2] tests: lint for run-away here-doc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

>> without failure (e.g. "cat" in the above example), which makes the
>> command appear to work, without eve executing the remainder of the
>
> s/eve/ever/

Oops.

>> +		if test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)"
>> +		then
>> +			error "bug in the test script: broken &&-chain or run-away HERE-DOC: $1"
>>  		fi
>
> Neat.  Why the double-LF?

The main part of "Neat" was your invention ;-).

Imagining how the string passed to eval looked, having two LFs was
the easiest way to ensure that there is a blank line before the new
"echo" (not just the last line in $1 and "echo" are on different
lines), which was more visually pleasing.  There was no any real
functional requirement.

> In some shells, the 3>&1 will last past the function call.
> Fortunately, the $() substitution creates a subshell so this doesn't
> affect anything later on.

Yes, a subshell solves quite lot of problems (while possibly
introducing others, though ;-).

> test_eval_inner_ contains a warning not to append anything after the
> commands to be evaluated, since whatever you append would pollute -x
> tracing output.  Fortunately, in this context we have already set
> trace= so the warning does not apply.
>
>
> Reviewed-by: Jonathan Nieder <jrnieder@xxxxxxxxx>

Thanks.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]