From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1d2OCQ-0005Nr-Vm for mharc-grub-devel@gnu.org; Sun, 23 Apr 2017 16:33:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36864) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2OCO-0005NR-Np for grub-devel@gnu.org; Sun, 23 Apr 2017 16:33:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2OCL-0002zb-HY for grub-devel@gnu.org; Sun, 23 Apr 2017 16:33:36 -0400 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:35357) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d2OCL-0002zN-AS for grub-devel@gnu.org; Sun, 23 Apr 2017 16:33:33 -0400 Received: by mail-wr0-x229.google.com with SMTP id z52so39337777wrc.2 for ; Sun, 23 Apr 2017 13:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-transfer-encoding; bh=/KXIkfbsK0shW/6U9c2bBI9gB+z/dsJ1Zj1+xVfAl84=; b=QIhrDdbpHHZVUX3VSyDaZHbAQ5tDhuGBjKaJojwOeA0s0uxWjyuhFchGFjRoyY0DfU re2aKoFedJVm0gUYDIxG85dfTBT9rwNhxRcFvavXaxeOWxA3ZSt/qFUfsKYamaRR2Bpu hx1J749JsSo3L2gEeJwouBMVN1e/8sBsech/trHCbkFY3phBHpBL2FBd/DAkrPeTQx3G iv0f1VXT3U2awxiT8kjncPO6GSiq+cxjT7y2P2woIDIubT8i74U6T0Yb0lmWob67VYdW tTf4zUBNL850KV2JeB0Xxsi4xrDNZfb7YtlAsR3i8o+G7QrNVyceaVTf3jWGVy9MBXkB 6Mqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-transfer-encoding; bh=/KXIkfbsK0shW/6U9c2bBI9gB+z/dsJ1Zj1+xVfAl84=; b=Nlj1HwX/+KPnkYGibu977XPrxKsa5ek3dbXKEzo5o8fNXbieqa554/OZliGLpTWQMQ D3WgL5Rh2Vh+VsDQRjdpDaLlwSC0XGeuyRhEH85fvXiLOs2wcsBxp1ffFU6GTipN7n/X JStEP7SZy6zxyvoBOZqL9B91f+YGDIWrAPrxketcmq+5IG9KCNSiqK2HWOotuW7TQiyt aKDkySrEL3Hoc/8aIyT/vKqrA0FEai4L3MHEx0jiT1W89kZPNWFsKVyI/zslaK5jc743 AT97UI86bjY9InmFFpS2WnFsT0AvaYcSe9zVKE5ZuW4n/YtaflqsgLPVEXgxewLp2iX5 Tvpw== X-Gm-Message-State: AN3rC/6HKYhECAn7nOT5GFKQ3rTc2iFOU7GaQqHRXe7cS/rIVwyZQLQW zi+PNyLjxXt9eOxu X-Received: by 10.223.147.225 with SMTP id 88mr3146699wrp.146.1492979611801; Sun, 23 Apr 2017 13:33:31 -0700 (PDT) Received: from [192.168.10.45] (48.red-83-32-58.dynamicip.rima-tde.net. [83.32.58.48]) by smtp.gmail.com with ESMTPSA id 75sm11381859wmp.2.2017.04.23.13.33.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Apr 2017 13:33:31 -0700 (PDT) Message-ID: <58FD0F98.5080508@gmail.com> Date: Sun, 23 Apr 2017 22:33:28 +0200 From: adrian15 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: grub-install deleting long UEFI entries bug ? References: <58FBFB47.80603@gmail.com> In-Reply-To: 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:400c:c0c::229 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: Sun, 23 Apr 2017 20:33:38 -0000 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. I guess efibootmgr itself would need an specific switch in order to produce output suitable for scripts. Another option is include some of the efibootmgr functionality/libraries into grub itself. Maybe there's something on upstream's efibootmgr. Not a clue about that. I have only checked Debian stretch's efibootmgr. I might ask about it in debian-efi mailing list. > ... >> 1) First of all this matches all the line: >> >> if (!strcasestr (line, efi_distributor)) >> continue; >> >> That means that if you add a custom label which matches the efi distributor >> then it gets removed. I think that's what happened to me. I would prefer >> something more precise that would check the complete efi file path agains >> e.g. EFI/vendor/ . >> >> 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. Just checking the first character leaves place for 16^3 = (2^4)^3 = 2 ^ (4 * 3 ) = 2 ^12 = 4096 . That should be enough for most of the usecases. >> >> 2.2) line[sizeof ("Boot") - 1] < '0' >> >> Am I doing it right? >> >> sizeof ("Boot") = 4 >> > > It is 5. Ok, yes, sizeof is not length so... it shows what it takes to save it. So... 4 bytes and the 'finish string byte' so that makes 5. Well, I have finally decided not to put the full path to efi file and only the basename of it. That will avoid custom entries being suddenly removed by grub-install. Thank you for your feedback. adrian15 -- Support free software. Donate to Super Grub Disk. Apoya el software libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/