Skip to content

Conversation

@kairosci
Copy link

@kairosci kairosci commented Sep 9, 2025

Improve Rock Ridge flag access in ISO9660 parser

Description

This commit refactors the way Rock Ridge flags are accessed in the ISO9660 parser. Previously, the code used a cast on entry->u.data to check for GRUB_ISO9660_RR_DOT and GRUB_ISO9660_RR_DOTDOT flags. This approach was marked with a FIXME comment due to its unsafe and unclear nature. The updated implementation accesses the flags through entry->u.version, eliminating the need for casting and improving code clarity.

Motivation

The original cast on entry->u.data was not only flagged as problematic but also introduced potential risks in terms of type safety and maintainability. By switching to entry->u.version, the code now adheres to a cleaner and more correct method of accessing Rock Ridge flags. This change enhances readability, aligns with best practices, and resolves the longstanding FIXME in the codebase.

@kairosci kairosci force-pushed the master branch 2 times, most recently from 24cce5c to 6236884 Compare September 9, 2025 17:50
  The previous code used a cast on entry->u.data to check for the
  GRUB_ISO9660_RR_DOT and GRUB_ISO9660_RR_DOTDOT flags, which was
  flagged with a FIXME comment.

  This commit resolves the improper cast by accessing the data through
  entry->u.version, providing a cleaner and more correct way to
  read the Rock Ridge flags.

Signed-off-by: Alessio Attilio <[email protected]>
@a1ive
Copy link
Contributor

a1ive commented Sep 16, 2025

It would be better to submit this patch upstream to GNU GRUB.
https://cgit.git.savannah.gnu.org/cgit/grub.git/tree/grub-core/fs/iso9660.c#n629

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants