From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1d2Ukr-00051B-6U for mharc-grub-devel@gnu.org; Sun, 23 Apr 2017 23:33:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2Ukp-000515-9T for grub-devel@gnu.org; Sun, 23 Apr 2017 23:33:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2Ukm-0005Fc-5t for grub-devel@gnu.org; Sun, 23 Apr 2017 23:33:35 -0400 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:34648) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d2Ukl-0005FK-Um for grub-devel@gnu.org; Sun, 23 Apr 2017 23:33:32 -0400 Received: by mail-lf0-x234.google.com with SMTP id t144so66979196lff.1 for ; Sun, 23 Apr 2017 20:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=DrUoh1Tgmsd9YZRxoJIpkVhMMvFy1pHqmopZr/aax5Q=; b=kpy7FX6rOSrzxIn+3AU+f1lbnd4QNXGgYUo557wTdOTdv8OSsoUQcU1gLDiKqd1gBC XmY/GXhT8/X50o+8FtL7YK9xgo/rofkJ6ib2CoEmzMWSpc8u8JtfEUmQnUSVsQ9WvEKY ArWmacDMeq5XGotwDeMHPAX3jMnhfE8uk3RRId/dUcIykL2JiOpRBgT4/uJOuxf0AmXX XbS7BkELdJo6qOq7KM1oa/iF8silg98vDGhEDybyO76+0AjnTcVB8OkpWfABgBnEvdNc RJfOfY17h2CZY9Dhq+/lZWshmAhCc8e/WfsQbpgeMsIGbnHrxTRZx3cE/ccP9446EY1/ Nulw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=DrUoh1Tgmsd9YZRxoJIpkVhMMvFy1pHqmopZr/aax5Q=; b=M+meHlUj66rWT+NYhe2odemMQRAwcLXK0dGWLh0fwOxTDAko44CY/NsT5A3tKC31G4 tuCqnfH+kotUWdA8af0Xq8/SMwPF7q2RetB2ezodxCejamSDGDMWq3c2X+DXp4InbBuU uK9Y9duiygCxVmmhs/lro67V2PlOijJ31bWMtG7q3ZYh6PrMteUkmy4zieW7VaWnXBDU 1miXBZPjUQGhSETD7Zj8xRYwJwN40PAseX6Nd2yx/a4bY1/qiofTCO7+hYzTQlsWNz/l wLd7IxlvlpyWU51TCIYshQH1vf8CyBKcyvPMfLffskqGKFUjwZPOtGPlRKtfa2Xwb3VE a6Fg== X-Gm-Message-State: AN3rC/7x4qNpH1lwERtgw6Bdqs5rCffrk7JNhzse8P8xBByD1Sl4Xh5k dbWi+F99lfRs6CFU X-Received: by 10.46.69.133 with SMTP id s127mr8393320lja.44.1493004810281; Sun, 23 Apr 2017 20:33:30 -0700 (PDT) Received: from [192.168.1.5] (ppp109-252-90-38.pppoe.spdop.ru. [109.252.90.38]) by smtp.gmail.com with ESMTPSA id t85sm2294255lfi.59.2017.04.23.20.33.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Apr 2017 20:33:29 -0700 (PDT) Subject: Re: grub-install deleting long UEFI entries bug ? To: grub-devel@gnu.org References: <58FBFB47.80603@gmail.com> <58FD0F98.5080508@gmail.com> From: Andrei Borzenkov Message-ID: Date: Mon, 24 Apr 2017 06:33:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <58FD0F98.5080508@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::234 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, 24 Apr 2017 03:33:36 -0000 23.04.2017 23:33, adrian15 пишет: > El 23/04/17 a las 10:45, Andrei Borzenkov escribió: >> 23.04.2017 11:21, adrian15 adrian15 пишет: >>> 2017-04-23 6:36 GMT+02:00 Andrei Borzenkov : >>> >>>> 23.04.2017 03:54, adrian15 пишет: >>>>> grub-install seems to be deleting long UEFI entries >>>>> >>>>> (*) What the bug is >>>>> >>>>> * Add an UEFI entry with this label (Remove the single quotes): >>>>> '(Rescapp added) \EFI\ubuntu\MokManager.efi' >>>>> >>>>> Example: >>>>> >>>>> efibootmgr -c \ >>>>> -d /dev/sda \ >>>>> -p 2 \ >>>>> -L '(Rescapp added) \EFI\ubuntu\MokManager.efi' \ >>>>> -l '\EFI\ubuntu\MokManager.efi' >>>>> >>>>> * Run grub-install /dev/sda or maybe just grub-install >>>>> >>>>> I expect the newly added uefi entry to be there. >>>>> What I find is that the entry has been lost or deleted! >>>>> >>>> >>>> What is value of GRUB_DISTRIBUTOR in /etc/default/grub? >>>> >>> >>> After evaluating the bash expression the GRUB_DISTRIBUTOR value is Ubuntu. >>> >> >> Yes, historically grub did case insensitive substring search. This >> probably is wrong, we should just take everything after boot number >> literally. > > I see, like removing what you are about to add I guess. > The problem that I see is that efibootmgr output (even if --verbose > switch) it's not machine readable. > We are using plain "efibootmgr" without --verbose and output is variable name followed by either '*' or space followed by space followed by description if present. Unless description contains newline, it looks straightforward to parse. > I guess efibootmgr itself would need an specific switch in order to > produce output suitable for scripts. It would need somehow escape newline > Another option is include some of > the efibootmgr functionality/libraries into grub itself. > Yes, I have half-done patch but as I see now it is probably not really needed unless we actually have case of description containing newlines. >>> >>> 2) Then there's: >>> >>> if (grub_memcmp (line, "Boot", sizeof ("Boot") - 1) != 0 >>> || line[sizeof ("Boot") - 1] < '0' >>> || line[sizeof ("Boot") - 1] > '9') >>> continue; >>> >>> which might be wrong because of 0 and 9 and maybe not because of the array >>> indexes. >>> >>> Let's go into details about that. >>> >>> 2.1) Boot0000 First entry >>> BootA000 Second entry >>> >>> Shouldn't the look for A to F hexadecimal letters too? >>> >> >> Yes. Patches are welcome for both problems. Second one is actually bug >> fix so should be independent. >> >>> And... > > Well, I think just checking 0 to 9 in the first character is a good > compromise. > > Some outputs have: BootCurrent . So 'BootC' can be found in e.g. > 'BootC001' too. So that would be adding another problem because > 'BootCurrent' would be considered as a right entry. > This simply means that we have to check for exactly 4 hexadecimal numbers, not shortcut this.