Skip to content

Log joliet volume identifier#370

Open
Didrole wants to merge 7 commits intosuperg:mainfrom
Didrole:log-joliet-volume-identifier
Open

Log joliet volume identifier#370
Didrole wants to merge 7 commits intosuperg:mainfrom
Didrole:log-joliet-volume-identifier

Conversation

@Didrole
Copy link
Copy Markdown
Contributor

@Didrole Didrole commented Apr 12, 2026

This PR adds joliet volume identifier logging.

To do this, it parses the iso 9660 supplementary volume descriptor (if available), checks for UCS-2 escape sequences and converts the volume identifier from UCS-2BE to UTF-8.

Example of generated output:

*** INFO (time check: 0s)

CD-ROM [PKW744AF-CD.bin]:
  sectors count: 20638
  mode1 sectors: 20638

  REDUMP.ORG errors: 0

ISO9660 [PKW744AF-CD.bin]:
  volume identifier: T_TARTE
  PVD:
0320 : 20 20 20 20 20 20 20 20  20 20 20 20 20 32 30 30                200
0330 : 30 30 39 32 37 31 33 34  34 35 36 30 30 00 32 30   0092713445600.20
0340 : 30 30 30 39 32 37 31 33  34 35 35 35 30 30 00 00   00092713455500..
0350 : 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
0360 : 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
0370 : 00 01 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................

Joliet [PKW744AF-CD.bin]:
  volume identifier: Têtarte

*** END (time check: 0s)

Summary by CodeRabbit

  • New Features
    • Added support for Joliet ISO9660 volumes with automatic detection and proper volume identifier parsing.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 00bd6ab6-0550-46de-ac7d-eeec77ebfdeb

📥 Commits

Reviewing files that changed from the base of the PR and between 506341b and 36f07d6.

📒 Files selected for processing (2)
  • filesystem/iso9660/iso9660_defs.ixx
  • systems/s_iso.ixx
🚧 Files skipped from review as they are similar to previous changes (1)
  • filesystem/iso9660/iso9660_defs.ixx

📝 Walkthrough

Walkthrough

This pull request adds support for ISO9660 Supplementary Volume Descriptors with Joliet encoding detection. It introduces new struct definitions, a Joliet escape sequence matcher, UCS-2BE to UTF-8 conversion utilities, and extends the ISO printing logic to detect and display Joliet volume identifiers.

Changes

Cohort / File(s) Summary
Supplementary Volume Descriptor & Joliet Support
filesystem/iso9660/iso9660_defs.ixx
Added SupplementaryVolumeDescriptor packed struct with VolumeFlags enum, JOLIET_ESCAPE_SEQUENCES constant set, JolietVolumeIdentifier type alias, and new identifier_to_string overload for UCS-2BE array-to-UTF-8 conversion. Includes required headers <codecvt> and <set>.
ISO Printer Integration
systems/s_iso.ixx
Extended SystemISO::printInfo to detect Supplementary Volume Descriptors and parse Joliet volume identifiers when escape sequences match the expected markers. Added <set> include for comparison logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hop through volumes, east and west,
Joliet escapes pass the test,
UCS-2 whispers turn to UTF's song,
Identifiers dance where they belong! 🌸

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Log joliet volume identifier' directly and clearly describes the main objective of the changeset: adding logging of the Joliet volume identifier as evidenced by the PR objectives, code additions in both iso9660_defs.ixx and s_iso.ixx that implement Joliet parsing and conversion.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
filesystem/iso9660/iso9660_defs.ixx (1)

172-213: Add a size guard for the packed descriptor layout.

Since this struct maps raw on-disk bytes, add a compile-time size check to catch accidental field/layout drift.

♻️ Proposed refactor
 struct SupplementaryVolumeDescriptor
 {
@@
     uint8_t reserved2[653];
 };
+
+static_assert(sizeof(SupplementaryVolumeDescriptor) == sizeof(VolumeDescriptor),
+              "SupplementaryVolumeDescriptor must remain 2048 bytes");
 `#pragma` pack(pop)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@filesystem/iso9660/iso9660_defs.ixx` around lines 172 - 213, Add a
compile-time size guard right after the SupplementaryVolumeDescriptor definition
to ensure the packed on-disk layout hasn't drifted; e.g. add a
static_assert(sizeof(SupplementaryVolumeDescriptor) == 2048,
"SupplementaryVolumeDescriptor size must match on-disk layout (2048)"); ensure
this assertion references the struct name SupplementaryVolumeDescriptor and use
the expected on-disk size (2048 bytes) so any accidental field/layout changes
fail at compile time.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@filesystem/joliet/joliet_defs.ixx`:
- Around line 25-53: The identifier_to_string function currently UTF-8-encodes
UCS-2BE codepoints and then calls trim(result).c_str(), which is undefined
because trim uses std::isspace on signed char values and also returns a pointer
into a temporary. Fix: keep the signature identifier_to_string(const uint16_t
(&identifier)[N]) and the endian_swap/UTF-8 encoding logic, remove the trim()
call, and instead manually strip only ASCII space characters (byte 0x20) from
the end of result (e.g., while(!result.empty() && result.back() == ' ')
result.pop_back();), then return the result string (not result.c_str()). Ensure
no use of std::isspace on raw chars.

In `@systems/s_joliet.ixx`:
- Around line 34-38: The comparison using std::ranges::find against
svd.escape_sequences is wrong because svd.escape_sequences is a 32-byte char
array while joliet::ESCAPE_SEQUENCES holds 3-char sequence string_views; change
the comparison to build a std::string_view over only the actual 3-byte escape
sequence (e.g. std::string_view(svd.escape_sequences, 3)) and compare that
against joliet::ESCAPE_SEQUENCES (or use std::ranges::find with that
string_view). Keep the existing cast for volume_identifier and leave
iso9660::Browser::findDescriptor, svd.escape_sequences,
joliet::ESCAPE_SEQUENCES, std::ranges::find, and joliet::identifier_to_string
references intact.

---

Nitpick comments:
In `@filesystem/iso9660/iso9660_defs.ixx`:
- Around line 172-213: Add a compile-time size guard right after the
SupplementaryVolumeDescriptor definition to ensure the packed on-disk layout
hasn't drifted; e.g. add a static_assert(sizeof(SupplementaryVolumeDescriptor)
== 2048, "SupplementaryVolumeDescriptor size must match on-disk layout (2048)");
ensure this assertion references the struct name SupplementaryVolumeDescriptor
and use the expected on-disk size (2048 bytes) so any accidental field/layout
changes fail at compile time.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e1ac712a-4ec6-4666-bb2f-49f58a5ef287

📥 Commits

Reviewing files that changed from the base of the PR and between d84ff03 and 7f4606c.

📒 Files selected for processing (6)
  • CMakeLists.txt
  • filesystem/iso9660/iso9660_defs.ixx
  • filesystem/joliet/joliet.ixx
  • filesystem/joliet/joliet_defs.ixx
  • systems/s_joliet.ixx
  • systems/systems.ixx

Comment thread filesystem/joliet/joliet_defs.ixx Outdated
Comment thread systems/s_joliet.ixx Outdated
Copy link
Copy Markdown
Owner

@superg superg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  • I would like you to move joliet label handling to SystemISO, as it's an extension to ISO9660, I'd rather have that implemented there (please do it under PVD label printout)
  • Please use codecvt to convert (with endianness fix first), something like:
    std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
    std::string utf8_raw = convert.to_bytes(host_u16);

(I know codecvt is kind of deprecated but into standard committee figure this out, it's available)

After that these files should disappear:
filesystem/joliet/joliet.ixx
filesystem/joliet/joliet_defs.ixx
systems/s_joliet.ixx

@Didrole
Copy link
Copy Markdown
Contributor Author

Didrole commented Apr 15, 2026

I initially made it into a separate system for better readability, and also in case you want to expand joliet support in the future, like for skeleton generation for example.
Well, I guess we can refactor it back later if needed.

Regarding the string conversion, that's fine to me, but the compiler will complain about it.

@Didrole
Copy link
Copy Markdown
Contributor Author

Didrole commented Apr 15, 2026

Updated example of generated output:

*** INFO (time check: 0s)


CD-ROM [PKW744AF-CD.bin]:
  sectors count: 20638
  mode1 sectors: 20638

  REDUMP.ORG errors: 0


ISO9660 [PKW744AF-CD.bin]:
  volume identifier: T_TARTE
  PVD:
0320 : 20 20 20 20 20 20 20 20  20 20 20 20 20 32 30 30                200
0330 : 30 30 39 32 37 31 33 34  34 35 36 30 30 00 32 30   0092713445600.20
0340 : 30 30 30 39 32 37 31 33  34 35 35 35 30 30 00 00   00092713455500..
0350 : 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
0360 : 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
0370 : 00 01 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
  joliet volume identifier: Têtarte


*** END (time check: 1s)

@Didrole Didrole requested a review from superg April 15, 2026 15:28
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