From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1d2D9W-0005fu-Ka for mharc-grub-devel@gnu.org; Sun, 23 Apr 2017 04:45:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2D9U-0005fl-Kj for grub-devel@gnu.org; Sun, 23 Apr 2017 04:45:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2D9R-0005wf-IR for grub-devel@gnu.org; Sun, 23 Apr 2017 04:45:52 -0400 Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]:35915) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d2D9R-0005wQ-9r for grub-devel@gnu.org; Sun, 23 Apr 2017 04:45:49 -0400 Received: by mail-lf0-x22e.google.com with SMTP id c80so60980390lfh.3 for ; Sun, 23 Apr 2017 01:45:49 -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=wQAlyqkOc0NF5skskQGA5+bth0JdSfVydXN2zCelgsg=; b=GW9DBbLNNQwCBkX+p2Q5FYosqzL8/mo2lKZyAHkqZYz4KgwpsO04mZWDKCts+ewoPh vEkfQc+gPZN8xAkmzL9wTGCS0BlmZAYWWkb8jKAVxQ9ZVfE94rmkKk7RtNGpCOce+HBG FrRckHYl3jcXQ0ffktssfYCGuipLzj/6cwFf1oiqYaXiCngGCrbwMEtbpsDnlGaHgZdE lAao6auUGil4Rf/39eKy25I7zv7CQrio/xWGudIzmuK+lS9wgJIPhD023bnHCnyKmaUH J6uePaZyGXLWISAGxAemhf2yKHeIBSuZTw6ui0h1UBR9NpZyFSitPadXDzRszjN7yN+7 XqXw== 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=wQAlyqkOc0NF5skskQGA5+bth0JdSfVydXN2zCelgsg=; b=gaRC6ix4t8CL6feTEStPc0atosHirZ7is38vMn0+oT09XAdlMTbw3pCf5yB4lt7Klp 7UVxDa5FWTdP/tWy9KGXoofGZxW81YYhvzy6S8+oHvU4myhQGkvFOIECF1IV9VFHZRoR qFcroiuC6uRtW6R/A6wxwNMWunmcqpDsN8EM7mllv+eIgCSzNmlOp3UZtTMjEh8YMwCA 7djsAOvTKmzqqPGDrQVX/6+8YawOd2xgL8L6Kf2TLwEvS/Bws3AG60m/TERhscEaE1NE GPEeh605HsnRnZFEa52862frUF9UPdN+rkaNY3ul0l8Jk6l1eqiyGg2YDWeTAAM1ePBn vR/w== X-Gm-Message-State: AN3rC/6cyD2qHc7NTAV9eM2pCjSOT2yNMtr10zSbKeUOH7y7LJG9IxIa iCRaZyCLs8auNsd+ X-Received: by 10.25.21.32 with SMTP id l32mr6368095lfi.26.1492937147626; Sun, 23 Apr 2017 01:45:47 -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 i1sm2623646ljd.47.2017.04.23.01.45.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Apr 2017 01:45:47 -0700 (PDT) Subject: Re: grub-install deleting long UEFI entries bug ? To: grub-devel@gnu.org References: <58FBFB47.80603@gmail.com> From: Andrei Borzenkov Message-ID: Date: Sun, 23 Apr 2017 11:45:46 +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: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::22e 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 08:45:53 -0000 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. ... > 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... > > 2.2) line[sizeof ("Boot") - 1] < '0' > > Am I doing it right? > > sizeof ("Boot") = 4 > It is 5.