Skip to content

fix disk.Partition cut off after first disk - #1975

Merged
shirou merged 1 commit into
shirou:masterfrom
sni:fix_windows_partitions
Dec 21, 2025
Merged

fix disk.Partition cut off after first disk#1975
shirou merged 1 commit into
shirou:masterfrom
sni:fix_windows_partitions

Conversation

@sni

@sni sni commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

using windows.UTF16ToString() converts a []uint16 to a string but ends after the first NUL. There is already a split0() function which does the right thing in this file, so simply use that one.

before:

getLogicalDrives() -> ['C:\']

after:

getLogicalDrives() -> ['C:\', 'D:\', 'Z:\']
using windows.UTF16ToString() converts a []uint16 to a string but ends after the first NUL.
There is already a split0() function which does the right thing in this file, so simply use
that one.

before:

    getLogicalDrives() -> ['C:\']

after:

    getLogicalDrives() -> ['C:\', 'D:\', 'Z:\']

Signed-off-by: Sven Nierlein <sven@consol.de>
@StefanoBalzarottiNozomi

Copy link
Copy Markdown
Contributor

@sni thank you so much for the fix, can you please add a test?

@sni

sni commented Dec 19, 2025

Copy link
Copy Markdown
Contributor Author

There are tests in place and they failed on my machine before this fix.
The problem is not the test coverage here.

@StefanoBalzarottiNozomi

Copy link
Copy Markdown
Contributor

There are tests in place and they failed on my machine before this fix.
The problem is not the test coverage here.
Ok, I still think we have to find a determistic way to test this but your PR is fine for me.
Lets wait for @shirou

@shirou shirou left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Since procGetLogicalDriveStringsW returns device-dependent values, it’s difficult to add tests. Could you share the value of lpBuffer on your local machine? That would help us add tests for split0.

@StefanoBalzarottiNozomi

Copy link
Copy Markdown
Contributor

Since procGetLogicalDriveStringsW returns device-dependent values, it’s difficult to add tests. Could you share the value of lpBuffer on your local machine? That would help us add tests for split0.

Yeah, but it's possible for example to mount a folder as volume or simulate a virtual drive in the test. It would be nice to know the value and the cause of the problem reported by @sni

@sni

sni commented Dec 20, 2025

Copy link
Copy Markdown
Contributor Author

Could you share the value of lpBuffer on your local machine? That would help us add tests for split0.

Sure, bufferLen is set to: 0xd (13) and lpBuffer is set to:
[]uint16{0x43, 0x3a, 0x5c, 0x0, 0x44, 0x3a, 0x5c, 0x0, 0x5a, 0x3a, 0x5c, 0x0, 0x0}

@shirou

shirou commented Dec 21, 2025

Copy link
Copy Markdown
Owner

Thank you for the information! I can confirm that this PR fixes the issue. I’ll create another PR to add tests using virtual drives (possibly with subst).

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