Skip to contentSkip to conversation

hfsplus: Allow reading files created by Mac OS 9

PATCH In review Dave Vasilevsky 2 participants 3 messages Oct 2, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hfsplus: Allow reading files created by Mac OS 9

The permissions field of hfsplus files is only used by Mac OS X. This causes Grub to skip reading files created by Mac OS 9, since their file mode is read as unknown. Instead, assume files with zero mode are regular files.

From Technote 1150: "The traditional Mac OS implementation of HFS Plus does not use the permissions field. Files created by traditional Mac OS have the entire field set to 0."

---
 grub-core/fs/hfsplus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
grub-core/fs/hfsplus.c +3 -1
index 3f203abcc..6799ba278 100644
@@ -736,7 +736,9 @@ list_nodes (void *record, void *hook_arg)
 	int mode = (grub_be_to_cpu16 (fileinfo->mode)
 		    & GRUB_HFSPLUS_FILEMODE_MASK);
 
-	if (mode == GRUB_HFSPLUS_FILEMODE_REG)
+	if (mode == 0) /* created by pre-Mac OS X */
+          type = GRUB_FSHELP_REG;
+        else if (mode == GRUB_HFSPLUS_FILEMODE_REG)
 	  type = GRUB_FSHELP_REG;
 	else if (mode == GRUB_HFSPLUS_FILEMODE_SYMLINK)
 	  type = GRUB_FSHELP_SYMLINK;
Signature · 7 lines
2.51.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw
Quoted 8 lines · Dave Vasilevsky

The permissions field of hfsplus files is only used by Mac OS X. This causes Grub to skip reading files created by Mac OS 9, since their file mode is read as unknown. Instead, assume files with zero mode are regular files.

From Technote 1150: "The traditional Mac OS implementation of HFS Plus does not use the permissions field. Files created by traditional Mac OS have the entire field set to 0."

Except missing SOB patch LGTM. I can add Signed-off-by on your behalf if you are OK with it.

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#2 lore raw

Yes that's perfect, please add the SOB. Thank you!

Dave

Quoted 6 lines · Daniel Kiper
Quoted 5 lines · Dave Vasilevsky

The permissions field of hfsplus files is only used by Mac OS X. This causes Grub to skip reading files created by Mac OS 9, since their file mode is read as unknown. Instead, assume files with zero mode are regular files.

Quoted 9 lines
Quoted 3 lines

From Technote 1150: "The traditional Mac OS implementation of HFS Plus does not use the permissions field. Files created by traditional Mac OS have the entire field set to 0."

Except missing SOB patch LGTM. I can add Signed-off-by on your behalf if you are OK with it.

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel