From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mail.openembedded.org (Postfix) with ESMTP id 6B86E6FFD4 for ; Tue, 29 Nov 2016 21:47:31 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 29 Nov 2016 13:47:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,570,1473145200"; d="scan'208,217";a="37106000" Received: from lsandov1-mobl2.zpn.intel.com (HELO [10.219.5.38]) ([10.219.5.38]) by fmsmga006.fm.intel.com with ESMTP; 29 Nov 2016 13:47:32 -0800 To: Cal Sullivan , openembedded-core@lists.openembedded.org References: <1480444188-27310-1-git-send-email-leonardo.sandoval.gonzalez@linux.intel.com> <2a1fd093-8b07-1e04-4167-f52c0698446e@linux.intel.com> From: Leonardo Sandoval Message-ID: Date: Tue, 29 Nov 2016 15:53:09 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Cc: clarson@kergoth.com Subject: Re: [PATCH] sysvinit-inittab: fix getty device removal 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: Tue, 29 Nov 2016 21:47:33 -0000 Content-Type: multipart/alternative; boundary="------------40C07929C756E426FD802D3F" --------------40C07929C756E426FD802D3F Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit On 11/29/2016 03:08 PM, Cal Sullivan wrote: > Oops, accidentally dropped CCs. See my reply below. > > On 11/29/2016 01:05 PM, Cal Sullivan wrote: >> >> >> On 11/29/2016 12:52 PM, Leonardo Sandoval wrote: >>> >>> >>> >>> On 11/29/2016 02:15 PM, Christopher Larson wrote: >>>> >>>> On Tue, Nov 29, 2016 at 11:29 AM, >>>> >>> > wrote: >>>> >>>> From: Leonardo Sandoval >>>> >>> > >>>> >>>> getty devices were not being removed in some cases because >>>> device name >>>> was not at the end of the line, for example a ttyS1 device: >>>> >>>> S1:12345:respawn:/bin/start_getty 115200 ttyS1 vt102 >>>> >>>> Removing this limitation allows sed to remove any line containing >>>> the device. >>>> >>>> Signed-off-by: Leonardo Sandoval >>>> >>> > >>>> --- >>>> meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb >>>> | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git >>>> a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb >>>> >>>> b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb >>>> >>>> index c219cbf..dd30f43 100644 >>>> --- a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb >>>> >>>> +++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb >>>> >>>> @@ -62,7 +62,7 @@ if [ "x$D" = "x" ] && [ -e /proc/consoles ]; then >>>> k=`echo ${i} | sed s/^.*\://g` >>>> if [ -z "`grep ${j} /proc/consoles`" ]; then >>>> if [ -z "${k}" ] || [ -z "`grep ${k} >>>> /proc/consoles`" ] || [ ! -e /dev/${j} ]; then >>>> - sed -i /^.*${j}$/d /etc/inittab >>>> + sed -i /^.*${j}/d /etc/inittab >>>> >>>> >>>> This doesn’t check for the end of a word, so it’d match a partial >>>> as well. Would that be a problem? i.e. ttyS1 vs ttyS10. >>> >>> That is the intention, that line removal is not tied to finding the >>> device at the end of the line. With proposed patch, it removes the >>> device, no matter where is located. >>> >> Right, but look at this hypothetical example: >> >> S1:12345:respawn:/bin/start_getty 115200 ttyS1 vt102 >> S10:12345:respawn:/bin/start_getty 115200 ttyS10 >> >> Both would match, when you only want the top to match. This is >> untested but likely more what we want: >> >> sed -i /^.*${j}[\ $]/d /etc/inittab >> >> That way we either match up to a space (end of word) or end of line. Got it, that can be possible. Sending a v2 >> >> --- >> Cal >> >>> >>>> -- >>>> Christopher Larson >>>> clarson at kergoth dot com >>>> Founder - BitBake, OpenEmbedded, OpenZaurus >>>> Maintainer - Tslib >>>> Senior Software Engineer, Mentor Graphics >>> >>> >>> >> > --------------40C07929C756E426FD802D3F Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit



On 11/29/2016 03:08 PM, Cal Sullivan wrote:
Oops, accidentally dropped CCs. See my reply below.

On 11/29/2016 01:05 PM, Cal Sullivan wrote:


On 11/29/2016 12:52 PM, Leonardo Sandoval wrote:



On 11/29/2016 02:15 PM, Christopher Larson wrote:

On Tue, Nov 29, 2016 at 11:29 AM, <leonardo.sandoval.gonzalez@linux.intel.com> wrote:
From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>

getty devices were not being removed in some cases because device name
was not at the end of the line, for example a ttyS1 device:

S1:12345:respawn:/bin/start_getty 115200 ttyS1 vt102

Removing this limitation allows sed to remove any line containing
the device.

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
---
 meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
index c219cbf..dd30f43 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
@@ -62,7 +62,7 @@ if [ "x$D" = "x" ] && [ -e /proc/consoles ]; then
                k=`echo ${i} | sed s/^.*\://g`
                if [ -z "`grep ${j} /proc/consoles`" ]; then
                        if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then
-                               sed -i /^.*${j}$/d /etc/inittab
+                               sed -i /^.*${j}/d /etc/inittab

This doesn’t check for the end of a word, so it’d match a partial as well. Would that be a problem? i.e. ttyS1 vs ttyS10.

That is the intention, that line removal is not tied to finding the device at the end of the line. With proposed patch, it removes the device, no matter where is located.

Right, but look at this hypothetical example:

S1:12345:respawn:/bin/start_getty 115200 ttyS1 vt102
S10:12345:respawn:/bin/start_getty 115200 ttyS10

Both would match, when you only want the top to match. This is untested but likely more what we want:

sed -i /^.*${j}[\ $]/d /etc/inittab

That way we either match up to a space (end of word) or end of line.

Got it, that can be possible. Sending a v2


---
Cal


--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics






--------------40C07929C756E426FD802D3F--