From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by mail.openembedded.org (Postfix) with ESMTP id E7B5D750FA for ; Fri, 18 May 2018 17:33:06 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id f6-v6so15343803wmc.4 for ; Fri, 18 May 2018 10:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=03S5w4CJIh1yoZYB0c4LgB2k72zSPKobZq4Vd07kq8M=; b=U51lCLh04wEKZ4UGf/8jibV9/WPVhP8gzEnxYwO9IIAX3mzAcPLTZmx3I1BstWqis+ KbcXKHqt5CRJxGVKLnbRWTHPy71Hx7Qk4oHwg7A/TomUQFXbbiIoTX2rOHHtWC0qDrDs DEhFQTVxkAklFjMlLLCg3bpYqqKl23QCvJ7OhHwBuajsUbpArcWxnL6+ua5E9G+Q9Gpe skl6hgq6v38e+YFfA4UQWBeG9BcbNWypW5jL8ImUHPGJ6GNKbQ85ti2uVLhWQPsozhq0 OrqL4XR7YHdgpYJiHR7ADetcDgw81vR7bG7OOnmE1d5JooyPL2AYMaFRYvtumeHx3WLF qLog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=03S5w4CJIh1yoZYB0c4LgB2k72zSPKobZq4Vd07kq8M=; b=AJ2E+kwOQxcgUrkonF0jFP33oWBPnMeIbGa/SBPFUSFJoptnxGXYAu9xtvoszq0vKu FaZojf4hrQMEa/MnUZwbJHh9FZpMvy9uFXphS30RCi2p0j5qgi9M9w61miRAcnv8feTY DHNaAnyp1Ca+KEwe6DfSFW7/i4EhlSG+6ESei4fizChdlvyUAAOoYSu3uuzeZg02g0eF gU6QIJqrzL0tjSDZ5Aevri0na+c2wb+RvW+VW8+2WC6DbwXgkw3CcNWFEzzL5KmwCzuH 9ab7jPRGzq0vXl2E6vvcgY744sISO4ia6ODWogzvNd3yjH5vm+d/fgEd3DFboRWTGo+K 9eqA== X-Gm-Message-State: ALKqPwfB33s0XiFpD7eoaDHpD5y9nROmdUv9WFfYz7B+EyaUmy9ldeyb 91H87SENBZ6pB4Clt+4sWpReMiaM43Fl4wrIl2I= X-Google-Smtp-Source: AB8JxZoE4FTd5BDeefJW7SZmkbcMKCxVHYkqq/yqsXYAgH7w4/Rpj3ijAJ+E2LuZAmruYGfirVmO2wOV1IFUMLPRpzo= X-Received: by 2002:a1c:551:: with SMTP id 78-v6mr4944267wmf.60.1526664787241; Fri, 18 May 2018 10:33:07 -0700 (PDT) MIME-Version: 1.0 References: <1505723966-17120-1-git-send-email-mike.looijmans@topic.nl> <660382f7-55b7-39cc-ae2a-afab46301b3c@topic.nl> <34c855b7-3605-9c43-4a63-fdbdd39c2955@topic.nl> <411d4d88-f166-1c4e-2dc4-3009d157b071@topic.nl> <44b92914-6c05-d08f-1d94-bd041c6b7733@windriver.com> <20180518102840.GA1398@jama> <1bf23c38ed974d80868c72516d57c23c@XBOX02.axis.com> In-Reply-To: <1bf23c38ed974d80868c72516d57c23c@XBOX02.axis.com> From: Martin Jansa Date: Fri, 18 May 2018 19:32:55 +0200 Message-ID: To: Peter Kjellerstedt Cc: Mike Looijmans , Patches and discussions about the oe-core layer Subject: Re: [PATCH 1/2] base-files: profile: Do not assume that the 'command' command exists X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 May 2018 17:33:07 -0000 Content-Type: multipart/alternative; boundary="00000000000055afbc056c7e5804" --00000000000055afbc056c7e5804 Content-Type: text/plain; charset="UTF-8" Awesome, thanks! On Fri, May 18, 2018 at 6:51 PM Peter Kjellerstedt < peter.kjellerstedt@axis.com> wrote: > > -----Original Message----- > > From: Martin Jansa [mailto:martin.jansa@gmail.com] > > Sent: den 18 maj 2018 12:29 > > To: ChenQi > > Cc: Mike Looijmans ; openembedded- > > core@lists.openembedded.org; Peter Kjellerstedt > > ; Burton, Ross > > Subject: Re: [OE-core] [PATCH 1/2] base-files: profile: Do not assume > > that the 'command' command exists > > > > On Fri, Oct 13, 2017 at 06:07:16PM +0800, ChenQi wrote: > > > On 10/13/2017 05:53 PM, ChenQi wrote: > > > > On 09/18/2017 09:56 PM, Mike Looijmans wrote: > > > >> On 18-09-17 15:24, Mike Looijmans wrote: > > > >>> On 18-09-17 15:08, Burton, Ross wrote: > > > >>>> On 18 September 2017 at 12:31, Mike Looijmans > > > >>>> > > > wrote: > > > >>>> > > > >>>> This is basically the same change as I first sent a > > patch > > > >>>> for in > > > >>>> April, and > > > >>>> last pinged this Friday... The only real difference is > > that > > > >>>> this one > > > >>>> misses > > > >>>> passing error output from resize to /dev/null (which it > > > >>>> should do to > > > >>>> handle > > > >>>> the case where tty exists, but resize does not). > > > >>>> > > > >>>> > > > >>>> Yeah, indeed. > > > >>>> > > > >>>> > > > >>>> Apologies for missing that patch! > > > >>>> > > > >>>> Other problem is that "resize" outputs shell script on > > stdout > > > >>>> to be > > > >>>> executed, so the proper "total" invokation would be: > > > >>>> > > > >>>> /dev/tty[A-z]*) eval `resize 2>/dev/null` ;; > > > >>>> > > > >>>> The "eval" part is missing in your version... > > > >>>> > > > >>>> > > > >>>> Who is going to submit the One True patch with all the fixes in? > > I > > > >>>> promise to merge it. > > > >>> > > > >>> I'll send the one ring, eh, patch, in a few minutes. I'll merge > > the > > > >>> two into a single as well. > > > >> > > > >> On second thought, just use Peter's patch "as is". > > > >> > > > >> I've been experimenting with the "eval" part and it doesn't behave > > > >> well. Tends to confuse minicom, create garbage, and in particular > > > >> when run from "profile", it seems to result in counterproductive > > > >> COLUMNS=0 and LINES=0. > > > >> > > > >> I'm actually wondering why the call to "resize" is being done at > > all. > > > >> Just calling "resize" has no effect, since it outputs the results > > on > > > >> stdout as shell script, and that is being discarded. Looking at > > the > > > >> commit that introduced it: > > > >> > > > > > > > > Looking at the codes in busybox (console-tools/resize.c), I can see > > > > that tcsetattr is actually called. > > > > The output is due to: > > > > > > > > if (ENABLE_FEATURE_RESIZE_PRINT) > > > > printf("COLUMNS=%d;LINES=%d;export COLUMNS LINES;\n", > > > > w.ws_col, w.ws_row); > > > > > > > > I can confirm that calling 'resize' is needed. Otherwise, you might > > > > get input wrapping on the same line when typing long commands. > > > > > > > > I just tried busybox init based system and I also met '-sh: > > command: > > > > not found' error message. > > > > > > Sorry for the noise. Just noticed that oe-core has enabled 'command' > > for > > > busybox by default. It's my own busybox defconfig that hasn't enabled > > it. > > > > I was just hit by the same. resize and tty work fine, but command > > applet is missing in my images. > > > > Is enabling command applet in busybox now hard requirement for all the > > builds or is anyone still planing to send follow-up on this? > > > > At least to show some more meaningful error when it's not available? > > > > "you probably need to fix your busybox defconfig, because some old > > thread on oe-core ML says so" > > > > Cheers, > > Wow, here's an old discussion I had forgotten all about. I actually > do have an updated version of the patch that solves the problem by > running resize twice, once with stderr piped to /dev/null to > determine if the resize command exists, and once without stderr > piped to /dev/null to actually do the resize (since resize uses > stderr to determine the size of the tty). > > I'll send the updated patch in a minute. > > > > Best Regards, > > > Chen Qi > > > > > > > I think Peter's patch ([OE-core] [PATCHv2 1/1] base-files: profile: > > > > Avoid using "command" to determine if programs exist) is correct. > > > > > > > > Best Regards, > > > > Chen Qi > > > > > > > >> cc6360f4c4d9 (base-files: set dynamic COLUMNS via resize command) > > > >> > > > >> that already has no effect whatsoever. See the man page for > > resize: > > > >> https://linux.die.net/man/1/resize > > > >> > > > >> I also would consider running some program's output as shell > > script a > > > >> bit spooky, it looks like a security hole waiting to be exploited. > > > >> > > > >> > > > >> > > > >> Kind regards, > > > >> > > > >> Mike Looijmans > > > >> System Expert > > > >> > > > >> TOPIC Products > > > >> Materiaalweg 4, NL-5681 RJ Best > > > >> Postbus 440, NL-5680 AK Best > > > >> Telefoon: +31 (0) 499 33 69 79 > > > >> E-mail: mike.looijmans@topicproducts.com > > > >> Website: www.topicproducts.com > > > >> > > > >> Please consider the environment before printing this e-mail > > > > -- > > Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com > > //Peter > > --00000000000055afbc056c7e5804 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Awesome, thanks!=C2=A0

On Fri, May 18, 2018 at 6:51 PM Peter Kjellerstedt &l= t;peter.kjellerstedt@axis.co= m> wrote:
> -----Original= Message-----
> From: Martin Jansa [mailto:martin.jansa@gmail.com]
> Sent: den 18 maj 2018 12:29
> To: ChenQi <Qi.Chen@windriver.com>
> Cc: Mike Looijmans <mike.looijmans@topic.nl>; openembedded-
> core@= lists.openembedded.org; Peter Kjellerstedt
> <p= eter.kjellerstedt@axis.com>; Burton, Ross <ross.burton@intel.com>
> Subject: Re: [OE-core] [PATCH 1/2] base-files: profile: Do not assume<= br> > that the 'command' command exists
>
> On Fri, Oct 13, 2017 at 06:07:16PM +0800, ChenQi wrote:
> > On 10/13/2017 05:53 PM, ChenQi wrote:
> > > On 09/18/2017 09:56 PM, Mike Looijmans wrote:
> > >> On 18-09-17 15:24, Mike Looijmans wrote:
> > >>> On 18-09-17 15:08, Burton, Ross wrote:
> > >>>> On 18 September 2017 at 12:31, Mike Looijmans > > >>>> <mike.looijmans@topic.nl <mailto:mike.looijmans@topic.nl>&g= t;
> wrote:
> > >>>>
> > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0This is basical= ly the same change as I first sent a
> patch
> > >>>> for in
> > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0April, and
> > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0last pinged thi= s Friday... The only real difference is
> that
> > >>>> this one
> > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0misses
> > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0passing error o= utput from resize to /dev/null (which it
> > >>>> should do to
> > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0handle
> > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0the case where = tty exists, but resize does not).
> > >>>>
> > >>>>
> > >>>>=C2=A0 =C2=A0 =C2=A0Yeah, indeed.
> > >>>>
> > >>>>
> > >>>> Apologies for missing that patch!
> > >>>>
> > >>>>=C2=A0 =C2=A0 =C2=A0Other problem is that "r= esize" outputs shell script on
> stdout
> > >>>> to be
> > >>>>=C2=A0 =C2=A0 =C2=A0executed, so the proper "= ;total" invokation would be:
> > >>>>
> > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 /dev/tty[A-z]*) eval = `resize 2>/dev/null` ;;
> > >>>>
> > >>>>=C2=A0 =C2=A0 =C2=A0The "eval" part is = missing in your version...
> > >>>>
> > >>>>
> > >>>> Who is going to submit the One True patch with a= ll the fixes in?
> I
> > >>>> promise to merge it.
> > >>>
> > >>> I'll send the one ring, eh, patch, in a few minu= tes. I'll merge
> the
> > >>> two into a single as well.
> > >>
> > >> On second thought, just use Peter's patch "as i= s".
> > >>
> > >> I've been experimenting with the "eval" pa= rt and it doesn't behave
> > >> well. Tends to confuse minicom, create garbage, and in p= articular
> > >> when run from "profile", it seems to result in= counterproductive
> > >> COLUMNS=3D0 and LINES=3D0.
> > >>
> > >> I'm actually wondering why the call to "resize&= quot; is being done at
> all.
> > >> Just calling "resize" has no effect, since it = outputs the results
> on
> > >> stdout as shell script, and that is being discarded. Loo= king at
> the
> > >> commit that introduced it:
> > >>
> > >
> > > Looking at the codes in busybox (console-tools/resize.c), I = can see
> > > that tcsetattr is actually called.
> > > The output is due to:
> > >
> > >=C2=A0 =C2=A0 =C2=A0if (ENABLE_FEATURE_RESIZE_PRINT)
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("COLUMNS=3D%d;L= INES=3D%d;export COLUMNS LINES;\n",
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0w.ws_col, w.w= s_row);
> > >
> > > I can confirm that calling 'resize' is needed. Other= wise, you might
> > > get input wrapping on the same line when typing long command= s.
> > >
> > > I just tried busybox init based system and I also met '-= sh:
> command:
> > > not found' error message.
> >
> > Sorry for the noise. Just noticed that oe-core has enabled 'c= ommand'
> for
> > busybox by default. It's my own busybox defconfig that hasn&#= 39;t enabled
> it.
>
> I was just hit by the same. resize and tty work fine, but command
> applet is missing in my images.
>
> Is enabling command applet in busybox now hard requirement for all the=
> builds or is anyone still planing to send follow-up on this?
>
> At least to show some more meaningful error when it's not availabl= e?
>
> "you probably need to fix your busybox defconfig, because some ol= d
> thread on oe-core ML says so"
>
> Cheers,

Wow, here's an old discussion I had forgotten all about. I actually do have an updated version of the patch that solves the problem by
running resize twice, once with stderr piped to /dev/null to
determine if the resize command exists, and once without stderr
piped to /dev/null to actually do the resize (since resize uses
stderr to determine the size of the tty).

I'll send the updated patch in a minute.

> > Best Regards,
> > Chen Qi
> >
> > > I think Peter's patch ([OE-core] [PATCHv2 1/1] base-file= s: profile:
> > > Avoid using "command" to determine if programs exi= st) is correct.
> > >
> > > Best Regards,
> > > Chen Qi
> > >
> > >> cc6360f4c4d9 (base-files: set dynamic COLUMNS via resize= command)
> > >>
> > >> that already has no effect whatsoever. See the man page = for
> resize:
> > >> https://linux.die.net/man/1/resize
> > >>
> > >> I also would consider running some program's output = as shell
> script a
> > >> bit spooky, it looks like a security hole waiting to be = exploited.
> > >>
> > >>
> > >>
> > >> Kind regards,
> > >>
> > >> Mike Looijmans
> > >> System Expert
> > >>
> > >> TOPIC Products
> > >> Materiaalweg 4, NL-5681 RJ Best
> > >> Postbus 440, NL-5680 AK Best
> > >> Telefoon: +31 (0) 499 33 69 79
> > >> E-mail: mike.looijmans@topicproducts.com
> > >> Website: www.topicproducts.com
> > >>
> > >> Please consider the environment before printing this e-m= ail
>
> --
> Martin 'JaMa' Jansa=C2=A0 =C2=A0 =C2=A0jabber: Martin.Jansa@gmail.com

//Peter

--00000000000055afbc056c7e5804--