<div dir="ltr">Awesome, thanks! <br></div><br><div class="gmail_quote"><div dir="ltr">On Fri, May 18, 2018 at 6:51 PM Peter Kjellerstedt &lt;<a href="mailto:peter.kjellerstedt@axis.com">peter.kjellerstedt@axis.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">&gt; -----Original Message-----<br>
&gt; From: Martin Jansa [mailto:<a href="mailto:martin.jansa@gmail.com" target="_blank">martin.jansa@gmail.com</a>]<br>
&gt; Sent: den 18 maj 2018 12:29<br>
&gt; To: ChenQi &lt;<a href="mailto:Qi.Chen@windriver.com" target="_blank">Qi.Chen@windriver.com</a>&gt;<br>
&gt; Cc: Mike Looijmans &lt;<a href="mailto:mike.looijmans@topic.nl" target="_blank">mike.looijmans@topic.nl</a>&gt;; openembedded-<br>
&gt; <a href="mailto:core@lists.openembedded.org" target="_blank">core@lists.openembedded.org</a>; Peter Kjellerstedt<br>
&gt; &lt;<a href="mailto:peter.kjellerstedt@axis.com" target="_blank">peter.kjellerstedt@axis.com</a>&gt;; Burton, Ross &lt;<a href="mailto:ross.burton@intel.com" target="_blank">ross.burton@intel.com</a>&gt;<br>
&gt; Subject: Re: [OE-core] [PATCH 1/2] base-files: profile: Do not assume<br>
&gt; that the &#39;command&#39; command exists<br>
&gt; <br>
&gt; On Fri, Oct 13, 2017 at 06:07:16PM +0800, ChenQi wrote:<br>
&gt; &gt; On 10/13/2017 05:53 PM, ChenQi wrote:<br>
&gt; &gt; &gt; On 09/18/2017 09:56 PM, Mike Looijmans wrote:<br>
&gt; &gt; &gt;&gt; On 18-09-17 15:24, Mike Looijmans wrote:<br>
&gt; &gt; &gt;&gt;&gt; On 18-09-17 15:08, Burton, Ross wrote:<br>
&gt; &gt; &gt;&gt;&gt;&gt; On 18 September 2017 at 12:31, Mike Looijmans<br>
&gt; &gt; &gt;&gt;&gt;&gt; &lt;<a href="mailto:mike.looijmans@topic.nl" target="_blank">mike.looijmans@topic.nl</a> &lt;mailto:<a href="mailto:mike.looijmans@topic.nl" target="_blank">mike.looijmans@topic.nl</a>&gt;&gt;<br>
&gt; wrote:<br>
&gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt;&gt;         This is basically the same change as I first sent a<br>
&gt; patch<br>
&gt; &gt; &gt;&gt;&gt;&gt; for in<br>
&gt; &gt; &gt;&gt;&gt;&gt;         April, and<br>
&gt; &gt; &gt;&gt;&gt;&gt;         last pinged this Friday... The only real difference is<br>
&gt; that<br>
&gt; &gt; &gt;&gt;&gt;&gt; this one<br>
&gt; &gt; &gt;&gt;&gt;&gt;         misses<br>
&gt; &gt; &gt;&gt;&gt;&gt;         passing error output from resize to /dev/null (which it<br>
&gt; &gt; &gt;&gt;&gt;&gt; should do to<br>
&gt; &gt; &gt;&gt;&gt;&gt;         handle<br>
&gt; &gt; &gt;&gt;&gt;&gt;         the case where tty exists, but resize does not).<br>
&gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt;&gt;     Yeah, indeed.<br>
&gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt;&gt; Apologies for missing that patch!<br>
&gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt;&gt;     Other problem is that &quot;resize&quot; outputs shell script on<br>
&gt; stdout<br>
&gt; &gt; &gt;&gt;&gt;&gt; to be<br>
&gt; &gt; &gt;&gt;&gt;&gt;     executed, so the proper &quot;total&quot; invokation would be:<br>
&gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt;&gt;        /dev/tty[A-z]*) eval `resize 2&gt;/dev/null` ;;<br>
&gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt;&gt;     The &quot;eval&quot; part is missing in your version...<br>
&gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt;&gt; Who is going to submit the One True patch with all the fixes in?<br>
&gt; I<br>
&gt; &gt; &gt;&gt;&gt;&gt; promise to merge it.<br>
&gt; &gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt;&gt; I&#39;ll send the one ring, eh, patch, in a few minutes. I&#39;ll merge<br>
&gt; the<br>
&gt; &gt; &gt;&gt;&gt; two into a single as well.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; On second thought, just use Peter&#39;s patch &quot;as is&quot;.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; I&#39;ve been experimenting with the &quot;eval&quot; part and it doesn&#39;t behave<br>
&gt; &gt; &gt;&gt; well. Tends to confuse minicom, create garbage, and in particular<br>
&gt; &gt; &gt;&gt; when run from &quot;profile&quot;, it seems to result in counterproductive<br>
&gt; &gt; &gt;&gt; COLUMNS=0 and LINES=0.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; I&#39;m actually wondering why the call to &quot;resize&quot; is being done at<br>
&gt; all.<br>
&gt; &gt; &gt;&gt; Just calling &quot;resize&quot; has no effect, since it outputs the results<br>
&gt; on<br>
&gt; &gt; &gt;&gt; stdout as shell script, and that is being discarded. Looking at<br>
&gt; the<br>
&gt; &gt; &gt;&gt; commit that introduced it:<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Looking at the codes in busybox (console-tools/resize.c), I can see<br>
&gt; &gt; &gt; that tcsetattr is actually called.<br>
&gt; &gt; &gt; The output is due to:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;     if (ENABLE_FEATURE_RESIZE_PRINT)<br>
&gt; &gt; &gt;         printf(&quot;COLUMNS=%d;LINES=%d;export COLUMNS LINES;\n&quot;,<br>
&gt; &gt; &gt;             w.ws_col, w.ws_row);<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I can confirm that calling &#39;resize&#39; is needed. Otherwise, you might<br>
&gt; &gt; &gt; get input wrapping on the same line when typing long commands.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I just tried busybox init based system and I also met &#39;-sh:<br>
&gt; command:<br>
&gt; &gt; &gt; not found&#39; error message.<br>
&gt; &gt;<br>
&gt; &gt; Sorry for the noise. Just noticed that oe-core has enabled &#39;command&#39;<br>
&gt; for<br>
&gt; &gt; busybox by default. It&#39;s my own busybox defconfig that hasn&#39;t enabled<br>
&gt; it.<br>
&gt; <br>
&gt; I was just hit by the same. resize and tty work fine, but command<br>
&gt; applet is missing in my images.<br>
&gt; <br>
&gt; Is enabling command applet in busybox now hard requirement for all the<br>
&gt; builds or is anyone still planing to send follow-up on this?<br>
&gt; <br>
&gt; At least to show some more meaningful error when it&#39;s not available?<br>
&gt; <br>
&gt; &quot;you probably need to fix your busybox defconfig, because some old<br>
&gt; thread on oe-core ML says so&quot;<br>
&gt; <br>
&gt; Cheers,<br>
<br>
Wow, here&#39;s an old discussion I had forgotten all about. I actually <br>
do have an updated version of the patch that solves the problem by <br>
running resize twice, once with stderr piped to /dev/null to <br>
determine if the resize command exists, and once without stderr <br>
piped to /dev/null to actually do the resize (since resize uses <br>
stderr to determine the size of the tty).<br>
<br>
I&#39;ll send the updated patch in a minute.<br>
<br>
&gt; &gt; Best Regards,<br>
&gt; &gt; Chen Qi<br>
&gt; &gt;<br>
&gt; &gt; &gt; I think Peter&#39;s patch ([OE-core] [PATCHv2 1/1] base-files: profile:<br>
&gt; &gt; &gt; Avoid using &quot;command&quot; to determine if programs exist) is correct.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Best Regards,<br>
&gt; &gt; &gt; Chen Qi<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;&gt; cc6360f4c4d9 (base-files: set dynamic COLUMNS via resize command)<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; that already has no effect whatsoever. See the man page for<br>
&gt; resize:<br>
&gt; &gt; &gt;&gt; <a href="https://linux.die.net/man/1/resize" rel="noreferrer" target="_blank">https://linux.die.net/man/1/resize</a><br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; I also would consider running some program&#39;s output as shell<br>
&gt; script a<br>
&gt; &gt; &gt;&gt; bit spooky, it looks like a security hole waiting to be exploited.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; Kind regards,<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; Mike Looijmans<br>
&gt; &gt; &gt;&gt; System Expert<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; TOPIC Products<br>
&gt; &gt; &gt;&gt; Materiaalweg 4, NL-5681 RJ Best<br>
&gt; &gt; &gt;&gt; Postbus 440, NL-5680 AK Best<br>
&gt; &gt; &gt;&gt; Telefoon: +31 (0) 499 33 69 79<br>
&gt; &gt; &gt;&gt; E-mail: <a href="mailto:mike.looijmans@topicproducts.com" target="_blank">mike.looijmans@topicproducts.com</a><br>
&gt; &gt; &gt;&gt; Website: <a href="http://www.topicproducts.com" rel="noreferrer" target="_blank">www.topicproducts.com</a><br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; Please consider the environment before printing this e-mail<br>
&gt; <br>
&gt; --<br>
&gt; Martin &#39;JaMa&#39; Jansa     jabber: <a href="mailto:Martin.Jansa@gmail.com" target="_blank">Martin.Jansa@gmail.com</a><br>
<br>
//Peter<br>
<br>
</blockquote></div>