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