From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1X2idA-0001by-Ob for mharc-grub-devel@gnu.org; Thu, 03 Jul 2014 11:09:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2i9n-0006Pm-82 for grub-devel@gnu.org; Thu, 03 Jul 2014 10:38:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2i9f-0003JS-AS for grub-devel@gnu.org; Thu, 03 Jul 2014 10:38:39 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:43366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2i9f-0003J4-45 for grub-devel@gnu.org; Thu, 03 Jul 2014 10:38:31 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s63EcSwx018574 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 3 Jul 2014 14:38:29 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s63EcSci021722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 3 Jul 2014 14:38:28 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s63EcStq005718 for ; Thu, 3 Jul 2014 14:38:28 GMT Received: from sheep.uk.oracle.com (/10.167.241.51) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 03 Jul 2014 07:38:27 -0700 Message-ID: <53B56AE2.9010902@oracle.com> Date: Thu, 03 Jul 2014 15:38:26 +0100 From: John Haxby User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: Odd problem with submenus References: <53B2E8F7.2000405@oracle.com> <20140702210715.0cecc33b@opensuse.site> In-Reply-To: <20140702210715.0cecc33b@opensuse.site> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=KOI8-R X-Source-IP: acsinet21.oracle.com [141.146.126.237] Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by aserp1040.oracle.com id s63EcSwx018574 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jul 2014 15:09:00 -0000 On 02/07/14 18:07, Andrey Borzenkov wrote: > =F7 Tue, 01 Jul 2014 17:59:35 +0100 > John Haxby =D0=C9=DB=C5=D4: >=20 >> > Hello, >> >=20 >> > I have a warning generated by grub2-mkconfig that shows up on variou= s >> > systems that I'm not sure what to do about. Well, I know I can igno= re >> > it, but I'm not sure what do do about not getting the warning in the >> > first place. >> >=20 >> > On this machine here, I have >> >=20 >> > menuentry 'Fedora, with Linux 3.14.9-200.fc20.x86_64' --class ... >> >=20 >> > and grub2-set-default 'Fedora, with ...' is OK, but then >> >=20 >> > and I also have GRUB_DISABLE_SUBMENU=3Dtrue i /etc/default/grub, so >> >=20 >> > $ grub2-mkconfig -o /boot/grub2/grub.cfg >> > ... >> > Warning: Please don't use old title `Fedora, with Linux >> > 3.14.9-200.fc20.x86_64' for GRUB_DEFAULT, use `Advanced options for >> > Fedora>Fedora, with Linux 3.14.9-200.fc20.x86_64' (for versions befo= re >> > 2.00) or >> > `gnulinux-advanced-d87b5f54-5bfb-45bd-b300-f4b1db6d5dfb>gnulinux-3.1= 4.9-200.fc20.x86_64-advanced-d87b5f54-5bfb-45bd-b300-f4b1db6d5dfb' >> > (for 2.00 or later) >> >=20 >> > Exhorting me to use a submenu default when there are no submenus is >> > clearly wrong, so in /etc/grub.d/10_linux (and the other >> > platform-specific files) there's: >> >=20 >>> > > if [ x"$title" =3D x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previou= s Linux versions>$title" =3D x"$GRUB_ACTUAL_DEFAULT" ]; then >>> > > replacement_title=3D"$(echo "Advanced options for ${OS}= " | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" >>> > > quoted=3D"$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" >>> > > title_correction_code=3D"${title_correction_code}if [ \= "x\$default\" =3D '$quoted' ]; then default=3D'$(echo "$replacement_title= " | grub_quote)'; fi;" >>> > > grub_warn "$(gettext_printf "Please don't use old title= \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (f= or 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-= advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" >>> > > fi >> >=20 >> > It's easy enough to add a test for GRUB_DISABLE_SUBMENU here but I'm= at >> > a loss to know why this clause is needed at all. I know it means th= at >> > if I have submenus enabled then I can just set the default to be the >> > title of a submenu and not worry about the "Advanced options ..." bi= t, >> > but it looks to me as though it was just a transition thing which is >> > really no longer needed. >> >=20 > You never know it; there is no reason to break working configuration. >=20 >> > Is this really no longer needed or am I missing something? I'm happ= y to >> > submit a patch either way. >> >=20 >=20 > Yes, please, make it conditionally add submenu title to > replacement_title based on GRUB_DISABLE_SUBMENU. Please also fix all > scripts (the bug is not limited to linux). Happy to oblige. Actually, there are two problems. The various GRUB_DISABLE_* options all check for "true" with the exception of GRUB_DISABLE_SUBMENU which checks for "y". This is likely to cause some confusion, not least because Fedora and RHEL7 are both using "true". I'll work on two patches ... My long-time preferred solution for things like this[1], though is to define functions like this: case x"$DISABLE_GRUB_SUBMENU" in xy*|xtrue|x1) disable_grub_submenu () { return 0; } ;; *) disable_grub_submenu () { return 1; } ;; esac And then I can do if disable_grub_submenu; then ... which I think is easier to read and gets all of the confusion about what constitutes truth into a single place. jch [1] since before bash, probably