Received: from list by lists.gnu.org with archive (Exim 4.71) id 1e410p-0003rP-ML for mharc-grub-devel@gnu.org; Mon, 16 Oct 2017 04:44:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e410n-0003q6-5Z for grub-devel@gnu.org; Mon, 16 Oct 2017 04:44:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e410i-00079v-Of for grub-devel@gnu.org; Mon, 16 Oct 2017 04:44:36 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:51966) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e410i-00079H-Fu for grub-devel@gnu.org; Mon, 16 Oct 2017 04:44:32 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v9G8iSkQ028437 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Oct 2017 08:44:29 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v9G8iRYT010285 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Oct 2017 08:44:28 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v9G8iQ01013262; Mon, 16 Oct 2017 08:44:26 GMT Received: from olila.local.net-space.pl (/10.175.236.220) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 Oct 2017 01:44:26 -0700 Date: Mon, 16 Oct 2017 10:44:22 +0200 From: Daniel Kiper To: Eric Snowberg Cc: The development of GNU GRUB , "Vladimir 'phcoder' Serbinenko" Subject: Re: [PATCH] parser: Remove escape from the state transitions Message-ID: <20171016084422.GL7593@olila.local.net-space.pl> References: <1496182072-146693-1-git-send-email-eric.snowberg@oracle.com> <20171006144735.GB2075@router-fw-old.local.net-space.pl> <2118C79B-07C9-4C38-9BEF-99A9AFDF68DB@oracle.com> <20171009114819.GL4307@olila.local.net-space.pl> <28709149-26A7-47D9-AE0E-B7AA728E77FC@oracle.com> <20171012114334.GT7593@olila.local.net-space.pl> <3ADCC89C-9FE6-47E3-BD78-2EEDC96454C8@oracle.com> <20171013093657.GC7593@olila.local.net-space.pl> <7A17621E-0B35-44B4-A71F-1522848AE445@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <7A17621E-0B35-44B4-A71F-1522848AE445@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0021.oracle.com [156.151.31.71] Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by userp1040.oracle.com id v9G8iSkQ028437 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 156.151.31.81 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Oct 2017 08:44:38 -0000 On Fri, Oct 13, 2017 at 08:53:23AM -0600, Eric Snowberg wrote: > > On Oct 13, 2017, at 3:36 AM, Daniel Kiper w= rote: > > On Thu, Oct 12, 2017 at 08:38:51AM -0600, Eric Snowberg wrote: > >>> On Oct 12, 2017, at 5:43 AM, Daniel Kiper = wrote: > >>> On Mon, Oct 09, 2017 at 09:23:44AM -0600, Eric Snowberg wrote: > >>>>> On Oct 9, 2017, at 5:48 AM, Daniel Kiper wrote: > >>>>> On Fri, Oct 06, 2017 at 09:37:54AM -0600, Eric Snowberg wrote: > >>>>>>> On Oct 6, 2017, at 8:47 AM, Daniel Kiper = wrote: > >>>>>>> On Tue, May 30, 2017 at 04:07:52PM -0600, Eric Snowberg wrote: > >>>>>>>> Remove GRUB_PARSER_STATE_ESC with state GRUB_PARSER_STATE_TEXT= from > >>>>>>>> the list of not allowed characters. > >>>>>>> > >>>>>>> Once again, NACK for this patch. I explained why earlier but... > >>>>>>> > >>>>>>>> This fixes a problem where a properly escaped comma is in the = disk path. > >>>>>>>> > >>>>>>>> For example: /pci@306/pci@1/LSI,mrsas@0/disk@0:a > >>>>>>>> > >>>>>>>> During grub install, the search.fs_uuid is correctly stored in= the > >>>>>>>> core.img. > >>>>>>>> > >>>>>>>> As seen here: > >>>>>>>> > >>>>>>>> 001e380: 7365 6172 6368 2e66 735f 7575 6964 2039 search.fs_uu= id 9 > >>>>>>>> 001e390: 6462 6137 6333 362d 6431 6432 2d34 6163 dba7c36-d1d2= -4ac > >>>>>>>> 001e3a0: 642d 6135 3037 2d30 3634 6132 3462 3538 d-a507-064a2= 4b58 > >>>>>>>> 001e3b0: 3666 3420 726f 6f74 2069 6565 6531 3237 6f4 root iee= e127 > >>>>>>>> 001e3c0: 352f 2f70 6369 4033 3036 2f70 6369 4031 5//pci@306/p= ci@1 > >>>>>>>> 001e3d0: 2f4c 5349 5c2c 6d72 7361 7340 302f 6469 /LSI\,mrsas@= 0/di > >>>>>>>> 001e3e0: 736b 4030 3a61 200a 7365 7420 7072 6566 sk@0:a .set = pref > >>>>>>>> 001e3f0: 6978 3d28 2472 6f6f 7429 272f 6772 7562 ix=3D($root)= '/grub > >>>>>>>> 001e400: 3227 0a00 0000 0000 0000 0003 0000 0010 2'..........= .... > >>>>>>>> 001e410: 2f67 7275 6232 0000 /grub2.. > >>>>>>>> > >>>>>>>> Before this change the following args would be sent to > >>>>>>>> grub_cmd_do_search: > >>>>>>>> > >>>>>>>> key: 9dba7c36-d1d2-4acd-a507-064a24b586f4 > >>>>>>>> var: root > >>>>>>>> hint: ieee1275//pci@306/pci@1/LSI,mrsas@0/disk@0:a > >>>>>>> > >>>>>>> ...because hint should be quoted in core.img using double quote= s or even single quotes... > >>>>>>> Or every control char should be escaped. Normal shell rules app= ly here. > >>>>>> > >>>>>> Hints are written during the install into the core.img. Once the= system > >>>>>> boots, the parser is used to retrieve information from the core.= img. > >>>>>> Currently the parser will strip double quotes, single quotes and= escapes. > >>>>>> So I don=E2=80=99t understand how you recommend fixing this then. > >>>>> > >>>>> Could you send me or point a script which creates embedded config= for you? > >>>> > >>>> There is no script. > >>>> > >>>> As I explained in the patch. If your boot device name has a comma= , which > >>>> it does with a Megaraid, you can not boot GRUB. > >>>> > >>>> Install as follows: > >>>> > >>>> $ grub-install =E2=80=94force /dev/sda1 > >>>> > >>>> By default it creates a core.img with what I provided in the git c= omment: > >>>> > >>>> 001e380: 7365 6172 6368 2e66 735f 7575 6964 2039 search.fs_uuid 9 > >>>> 001e390: 6462 6137 6333 362d 6431 6432 2d34 6163 dba7c36-d1d2-4ac > >>>> 001e3a0: 642d 6135 3037 2d30 3634 6132 3462 3538 d-a507-064a24b58 > >>>> 001e3b0: 3666 3420 726f 6f74 2069 6565 6531 3237 6f4 root ieee127 > >>>> 001e3c0: 352f 2f70 6369 4033 3036 2f70 6369 4031 5//pci@306/pci@1 > >>>> 001e3d0: 2f4c 5349 5c2c 6d72 7361 7340 302f 6469 /LSI\,mrsas@0/di > >>>> 001e3e0: 736b 4030 3a61 200a 7365 7420 7072 6566 sk@0:a .set pref > >>>> 001e3f0: 6978 3d28 2472 6f6f 7429 272f 6772 7562 ix=3D($root)'/gr= ub > >>>> 001e400: 3227 0a00 0000 0000 0000 0003 0000 0010 2'.............. > >>>> 001e410: 2f67 7275 6232 0000 /grub2.. > >>>> > >>>> As you can see, everything is escaped as GRUB expects. > >>>> > >>>> Now during boot, the parser is used. Without my patch, it will st= rip the \,. > >>> > >>> AIUI you mean it strips '\'. If yes then it is correct behavior. An= d it > >>> should stay as is. If you wish to leave '\' you have to quote hint. > >>> Hence probably you have to fiddle with grub-install code or whateve= r > >>> creates the hint.Or the hint consumer code to properly consume ',' = alone. > >>> > >>>> So it changes the hint from: > >>>> > >>>> ieee1275//pci@306/pci@1/LSI,mrsas@0/disk@0:a > >>>> to > >>>> ieee1275//pci@306/pci@1/LSI\,mrsas@0/disk@0:a > >>>> > >>>> Later on, when it tries to use this disk, it incorrectly truncates > >>>> the device name since the comma isn=E2=80=99t escaped and tries to= do the > >>>> grub_disk_open with ieee1275//pci@306/pci@1/LSI. > >>> > >>> I am not sure who strips everything after the ','. Whoever it is it= is > >>> not the parser for sure. There is a chance that you should look for > >>> problem here. > >> > >> As I pointed out in the past, this is what strips everything after t= he > >> =E2=80=98,=E2=80=99 during boot. This is called after the parser has= stripped the =E2=80=98\=E2=80=99. > >> > >> grub-core/kern/disk.c > >> > >> /* Return the location of the first ',', if any, which is not > >> escaped by a '\'. */ > >> static const char * > >> find_part_sep (const char *name) > >> > >> Changing this would impact every platform. Also, it was my understan= ding > >> that disks were to follow this encoding style for commas. Since it = is > >> an easy way to find the disk partition. Your recommending this be ch= anged now? > >> And you would approve such a patch? > > > > Nope, I told you that you should check where it happens. And if it is= done by > > purpose then you should not touch it. And it looks that it is. So, as= I told > > you earlier you have to quote the hint. Otherwise, '\' will be always= stripped > > by the parser. This is its normal behavior if string is not quoted. > > It seems like there are two parts of GRUB that are not compatible with = one I do not think so. > another if a disk name contains a comma. There is a parser which strip= s > the escaped commas and there is the base disk driver that expects them. It does this because string is not quoted. I am not sure why are you surprised here. Once again: just quote the string properly and your problem is gone. > If you do not believe this is the case, please provide an example of ho= w I have never ever said that I do not believe this is the case. I say that your fix is unacceptable and you should find other way to fix the issue. Even I said how to fix it. > this disk can be quoted properly to work with both the parser and the > disk driver during boot: > > /pci@306/pci@1/LSI,mrsas@0/disk@0,0 I am a bit surprised that you are not able to quote a string but I will give you some examples: "/pci@306/pci@1/LSI\,mrsas@0/disk@0\,0" '/pci@306/pci@1/LSI\,mrsas@0/disk@0\,0' /pci@306/pci@1/LSI\\,mrsas@0/disk@0\\,0 Daniel