Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iExA8-0002WI-Lt for mharc-grub-devel@gnu.org; Mon, 30 Sep 2019 11:00:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58161) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iExA4-0002Pq-CU for grub-devel@gnu.org; Mon, 30 Sep 2019 11:00:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iEx9y-0000Ap-LQ for grub-devel@gnu.org; Mon, 30 Sep 2019 11:00:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48140) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iEx9y-0000Ab-Cm for grub-devel@gnu.org; Mon, 30 Sep 2019 11:00:22 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 492F758 for ; Mon, 30 Sep 2019 15:00:21 +0000 (UTC) Received: by mail-wr1-f72.google.com with SMTP id w8so4653165wrm.3 for ; Mon, 30 Sep 2019 08:00:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MGGM0oZ8HLDNAVL/gweOMDbCxHy5d4PbLnE6/bpCqlU=; b=UfTXCwxhLYkFssWRvnxnZrUYmlf7q1qTioavzlN/+SSCJqVpmO1v0k+OY+4Ds1k7sc 4EG/Y/OUn0TlrH6i+g2M6eFkN/KF0ZNtYLJXpSMkGrDeOKPF1ixOX96dQociVRGIQCYV fEA3M9PFciVd/Il1ppeu+beQexB6zFsO6G+fF1XNgEpRsLinvSKBua3dcsAE7I8V+vJd jC8v4JZqL9kvsqwZP7jqmrVwaGDy2I/ERGtadJWb1JxqGKwLcJDiw4R2zXRe6Qhw2Kuz L1FPMm1JKBaNlUUB9i7tWoozUnKzfwFmQ6djlX6rDLeswDZoXPieoHwvYPzM5DUb9G7d tGvQ== X-Gm-Message-State: APjAAAWazL8aneS6Cw7VU/OJpiJ/CGz5UuG/tFZM1hXm8KQIpd0xXR0I 87pZcIuIlmcKp2uwHOWC3Bkducuf3NPpYFVpcxDmuTBu4c7v38Hb9jUACUnoE1LqbdH5JHiuY4r IEOY5TBHZE58= X-Received: by 2002:a1c:1d85:: with SMTP id d127mr18469618wmd.14.1569855619735; Mon, 30 Sep 2019 08:00:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxL7QW1r937f4I9qgEE0qQpr5SbuiZXl0cmVNDdsC5u29gbZIEijsVbKbdBrM0H1X8ZFQ7ZEA== X-Received: by 2002:a1c:1d85:: with SMTP id d127mr18469584wmd.14.1569855619368; Mon, 30 Sep 2019 08:00:19 -0700 (PDT) Received: from minerva.redhat.com ([90.168.169.92]) by smtp.gmail.com with ESMTPSA id s9sm15100000wme.36.2019.09.30.08.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2019 08:00:18 -0700 (PDT) From: Javier Martinez Canillas To: grub-devel@gnu.org Cc: Prarit Bhargava , Javier Martinez Canillas , Vladimir Serbinenko , Daniel Kiper Subject: [PATCH v2] Fix bad test on GRUB_DISABLE_SUBMENU. Date: Mon, 30 Sep 2019 17:00:16 +0200 Message-Id: <20190930150016.21041-1-javierm@redhat.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Sep 2019 15:00:30 -0000 From: Prarit Bhargava The GRUB_DISABLE_SUBMENU option is different than the others in the sense that it has to be set to "y" instead of "true" to be enabled. That causes a lot of confusion to users, some may wrongly set it to "true= " expecting that will work the same than with most options, and some may se= t it to "yes" since for other options the value to set is a word and not a single character. This patch changes all the grub.d scripts using the GRUB_DISABLE_SUBMENU option, so they check if it was set to "true" instead of "y", making it consistent with all the other options. But to keep backward compatibility for users that set the option to "y" i= n /etc/default/grub file, keep testing for this value. And also do it for "yes", since it is a common mistake made by users caused by this option being inconsistent with the others. Signed-off-by: Prarit Bhargava Signed-off-by: Javier Martinez Canillas --- Changes since v1 (suggested by Daniel Kiper): - Improve commit message to better explain why the change is needed. - Fix not only 10_linux.in but all the grub.d scripts using this option. - Add a comment explaining why the values 'y', 'yes' and true' are tested for this option. - Fix the documentation so it mentions that the value to set is 'true' instead of 'y'. docs/grub.texi | 2 +- util/grub.d/10_hurd.in | 10 +++++++++- util/grub.d/10_kfreebsd.in | 10 +++++++++- util/grub.d/10_linux.in | 10 +++++++++- util/grub.d/10_netbsd.in | 10 +++++++++- util/grub.d/20_linux_xen.in | 10 +++++++++- util/grub.d/30_os-prober.in | 10 +++++++++- 7 files changed, 55 insertions(+), 7 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi index 2fe0e1b83bb..c25ab7a5fe7 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1504,7 +1504,7 @@ Normally, @command{grub-mkconfig} will generate top= level menu entry for the kernel with highest version number and put all other found kernels or alternative menu entries for recovery mode in submenu. For entries re= turned by @command{os-prober} first entry will be put on top level and all othe= rs -in submenu. If this option is set to @samp{y}, flat menu with all entrie= s +in submenu. If this option is set to @samp{true}, flat menu with all ent= ries on top level will be generated instead. Changing this option will requir= e changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref= {fallback}) and @samp{default} (@pxref{default}) environment variables as well as sa= ved diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in index 59a9a48a2f4..3663d360eb1 100644 --- a/util/grub.d/10_hurd.in +++ b/util/grub.d/10_hurd.in @@ -156,7 +156,15 @@ is_top_level=3Dtrue while [ "x$kernels" !=3D "x" ] ; do kernel=3D`version_find_latest $kernels` =20 - if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D= xy ]; then + # The GRUB_DISABLE_SUBMENU option used to be different than others sin= ce it was + # mentioned in the documentation that has to be set to 'y' instead of = 'true' to + # enable it. This caused a lot of confusion to users that set the opti= on to 'y', + # 'yes' or 'true'. This was fixed but all of these values must be supp= orted now. + if [ "x${GRUB_DISABLE_SUBMENU}" =3D xyes ] || [ "x${GRUB_DISABLE_SUBME= NU}" =3D xy ]; then + GRUB_DISABLE_SUBMENU=3D"true" + fi + + if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D= xtrue ]; then hurd_entry "$kernel" simple submenu_indentation=3D"$grub_tab" =20 diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in index 9d8e8fd852c..199b20e1636 100644 --- a/util/grub.d/10_kfreebsd.in +++ b/util/grub.d/10_kfreebsd.in @@ -214,7 +214,15 @@ while [ "x$list" !=3D "x" ] ; do module_dir_rel=3D$(make_system_path_relative_to_its_root $module_dir= ) fi =20 - if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D= xy ]; then + # The GRUB_DISABLE_SUBMENU option used to be different than others sin= ce it was + # mentioned in the documentation that has to be set to 'y' instead of = 'true' to + # enable it. This caused a lot of confusion to users that set the opti= on to 'y', + # 'yes' or 'true'. This was fixed but all of these values must be supp= orted now. + if [ "x${GRUB_DISABLE_SUBMENU}" =3D xyes ] || [ "x${GRUB_DISABLE_SUBME= NU}" =3D xy ]; then + GRUB_DISABLE_SUBMENU=3D"true" + fi + + if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D= xtrue ]; then kfreebsd_entry "${OS}" "${version}" simple submenu_indentation=3D"$grub_tab" =20 diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index 4532266be68..e8b01c0d0c7 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -261,7 +261,15 @@ while [ "x$list" !=3D "x" ] ; do fi fi =20 - if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D= xy ]; then + # The GRUB_DISABLE_SUBMENU option used to be different than others sin= ce it was + # mentioned in the documentation that has to be set to 'y' instead of = 'true' to + # enable it. This caused a lot of confusion to users that set the opti= on to 'y', + # 'yes' or 'true'. This was fixed but all of these values must be supp= orted now. + if [ "x${GRUB_DISABLE_SUBMENU}" =3D xyes ] || [ "x${GRUB_DISABLE_SUBME= NU}" =3D xy ]; then + GRUB_DISABLE_SUBMENU=3D"true" + fi + + if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D= xtrue ]; then linux_entry "${OS}" "${version}" simple \ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" =20 diff --git a/util/grub.d/10_netbsd.in b/util/grub.d/10_netbsd.in index 874f59969ed..dc0cd1b17ac 100644 --- a/util/grub.d/10_netbsd.in +++ b/util/grub.d/10_netbsd.in @@ -157,7 +157,15 @@ for k in /netbsd $(ls -t /netbsd?* 2>/dev/null) ; do =20 gettext_printf "Found NetBSD kernel: %s\n" "$k" >&2 =20 - if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D= xy ]; then + # The GRUB_DISABLE_SUBMENU option used to be different than others sin= ce it was + # mentioned in the documentation that has to be set to 'y' instead of = 'true' to + # enable it. This caused a lot of confusion to users that set the opti= on to 'y', + # 'yes' or 'true'. This was fixed but all of these values must be supp= orted now. + if [ "x${GRUB_DISABLE_SUBMENU}" =3D xyes ] || [ "x${GRUB_DISABLE_SUBME= NU}" =3D xy ]; then + GRUB_DISABLE_SUBMENU=3D"true" + fi + + if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D= xtrue ]; then netbsd_entry "knetbsd" "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAUL= T}" submenu_indentation=3D"$grub_tab" =20 diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in index 96179ea613c..391942a5922 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -288,7 +288,15 @@ while [ "x${xen_list}" !=3D "x" ] ; do fi fi =20 - if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D = xy ]; then + # The GRUB_DISABLE_SUBMENU option used to be different than others sinc= e it was + # mentioned in the documentation that has to be set to 'y' instead of '= true' to + # enable it. This caused a lot of confusion to users that set the optio= n to 'y', + # 'yes' or 'true'. This was fixed but all of these values must be suppo= rted now. + if [ "x${GRUB_DISABLE_SUBMENU}" =3D xyes ] || [ "x${GRUB_DISABLE_SUBMEN= U}" =3D xy ]; then + GRUB_DISABLE_SUBMENU=3D"true" + fi + + if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D = xtrue ]; then linux_entry "${OS}" "${version}" "${xen_version}" simple \ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_= XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" =20 diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 515a68c7aa0..cf42f55e8b4 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -234,7 +234,15 @@ EOF prepare_boot_cache=3D"$(prepare_grub_to_access_device ${LBOOT} | grub= _add_tab)" fi =20 - if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D = xy ]; then + # The GRUB_DISABLE_SUBMENU option used to be different than others sinc= e it was + # mentioned in the documentation that has to be set to 'y' instead of '= true' to + # enable it. This caused a lot of confusion to users that set the optio= n to 'y', + # 'yes' or 'true'. This was fixed but all of these values must be suppo= rted now. + if [ "x${GRUB_DISABLE_SUBMENU}" =3D xyes ] || [ "x${GRUB_DISABLE_SUBMEN= U}" =3D xy ]; then + GRUB_DISABLE_SUBMENU=3D"true" + fi + + if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" !=3D = xtrue ]; then cat << EOF menuentry '$(echo "$OS $onstr" | grub_quote)' $CLASS --class gnu-linux -= -class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$bo= ot_device_id' { EOF --=20 2.21.0