<div dir="auto"><div><div class="gmail_extra"><div class="gmail_quote">On May 9, 2017 7:02 PM, "John Luke Gibson" <<a href="mailto:eaterjolly@gmail.com">eaterjolly@gmail.com</a>> wrote:</div></div></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Like, the first file initiated by the main make file is<br>
support/setlocalversion which looks to just check a whole bunch of<br>
un-special variables which weren't set in the make script and had no<br>
opportunity to be set by any other files I know of (on my system the<br>
variables show as empty not having run anything from buildroot, but I<br>
can't imagine head would be set to such a specific git command on<br>
accident as the one it checks for). Then the if one of the conditions<br>
were some how filled, then all it does is print weird strings like<br>
this:<br>
<br>
printf '%s%s' -g $head<br>
<br>
Like this is the if statement:<br>
<br>
if head=`git rev-parse --verify --short HEAD 2>/dev/null`<br><br>
</blockquote></div></div></div><div dir="auto">That "=" is assignment, and those "`"s are output substitution. It tries executing that git command, storing the output in the shell variable head.</div><div dir="auto">If git succeeds (returns zero), the then clause is executed; if git fails (returns non-zero), the else clause (if present) is executed.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Mind you all this is printed to a variable in the make script called<br>
BR2_Version_Full which does nothing in the make script but get printed<br>
if a person asks the version, the script calls target-finalize or<br>
legal-info-prepare (which it looks like it does unconditionally in<br>
both cases). Like am I really that deep in over my head </blockquote></div></div></div><div dir="auto">Apparently, but that's how we learn, right? :)</div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">or does this<br>
script really have a bug where if someone sets head to some weird<br>
obscure git command it prints that very command in it's legal info?<br></blockquote></div></div></div><div dir="auto">No.</div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Like how does that happen that way on accident? It looks like it might<br>
serve some obscure purpose if it ran the command (which from I can<br>
tell with bash, setting some $(shell x) might do that,</blockquote></div></div></div><div dir="auto">"$(foo)" and "`foo`" are essentially the same. They both run foo, and substitute the output.</div></div>