Blame SOURCES/0261-fs-fat-don-t-error-when-mtime-is-0.patch

b35c50
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b35c50
From: Robbie Harwood <rharwood@redhat.com>
b35c50
Date: Fri, 15 Jul 2022 15:42:41 -0400
b35c50
Subject: [PATCH] fs/fat: don't error when mtime is 0
b35c50
MIME-Version: 1.0
b35c50
Content-Type: text/plain; charset=UTF-8
b35c50
Content-Transfer-Encoding: 8bit
b35c50
b35c50
In the wild, we occasionally see valid ESPs where some file modification times
b35c50
are 0.  For instance:
b35c50
b35c50
    ├── [Dec 31  1979]  EFI
b35c50
    │   ├── [Dec 31  1979]  BOOT
b35c50
    │   │   ├── [Dec 31  1979]  BOOTX64.EFI
b35c50
    │   │   └── [Dec 31  1979]  fbx64.efi
b35c50
    │   └── [Jun 27 02:41]  fedora
b35c50
    │       ├── [Dec 31  1979]  BOOTX64.CSV
b35c50
    │       ├── [Dec 31  1979]  fonts
b35c50
    │       ├── [Mar 14 03:35]  fw
b35c50
    │       │   ├── [Mar 14 03:35]  fwupd-359c1169-abd6-4a0d-8bce-e4d4713335c1.cap
b35c50
    │       │   ├── [Mar 14 03:34]  fwupd-9d255c4b-2d88-4861-860d-7ee52ade9463.cap
b35c50
    │       │   └── [Mar 14 03:34]  fwupd-b36438d8-9128-49d2-b280-487be02d948b.cap
b35c50
    │       ├── [Dec 31  1979]  fwupdx64.efi
b35c50
    │       ├── [May 10 10:47]  grub.cfg
b35c50
    │       ├── [Jun  3 12:38]  grub.cfg.new.new
b35c50
    │       ├── [May 10 10:41]  grub.cfg.old
b35c50
    │       ├── [Jun 27 02:41]  grubenv
b35c50
    │       ├── [Dec 31  1979]  grubx64.efi
b35c50
    │       ├── [Dec 31  1979]  mmx64.efi
b35c50
    │       ├── [Dec 31  1979]  shim.efi
b35c50
    │       ├── [Dec 31  1979]  shimx64.efi
b35c50
    │       └── [Dec 31  1979]  shimx64-fedora.efi
b35c50
    └── [Dec 31  1979]  FSCK0000.REC
b35c50
b35c50
    5 directories, 17 files
b35c50
b35c50
This causes grub-probe failure, which in turn causes grub-mkconfig
b35c50
failure.  They are valid filesystems that appear intact, and the Linux
b35c50
FAT stack is able to mount and manipulate them without complaint.
b35c50
b35c50
The check for mtime of 0 has been present since
b35c50
20def1a3c3952982395cd7c3ea7e78638527962b ("fat: support file
b35c50
modification times").
b35c50
b35c50
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
b35c50
(cherry picked from commit 0615c4887352e32d7bb7198e9ad0d695f9dc2c31)
b35c50
---
b35c50
 grub-core/fs/fat.c | 3 ---
b35c50
 1 file changed, 3 deletions(-)
b35c50
b35c50
diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c
b35c50
index dd82e4ee35..ff6200c5be 100644
b35c50
--- a/grub-core/fs/fat.c
b35c50
+++ b/grub-core/fs/fat.c
b35c50
@@ -1027,9 +1027,6 @@ grub_fat_dir (grub_device_t device, const char *path, grub_fs_dir_hook_t hook,
b35c50
 					  grub_le_to_cpu16 (ctxt.dir.w_date),
b35c50
 					  &info.mtime);
b35c50
 #endif
b35c50
-      if (info.mtimeset == 0)
b35c50
-	grub_error (GRUB_ERR_OUT_OF_RANGE,
b35c50
-		    "invalid modification timestamp for %s", path);
b35c50
 
b35c50
       if (hook (ctxt.filename, &info, hook_data))
b35c50
 	break;