Skip to content

bcachefs: fix empty label formatting failure#1177

Open
crasm wants to merge 5 commits intonix-community:masterfrom
crasm:fix-bcfs-unlabeled
Open

bcachefs: fix empty label formatting failure#1177
crasm wants to merge 5 commits intonix-community:masterfrom
crasm:fix-bcfs-unlabeled

Conversation

@crasm
Copy link
Copy Markdown
Contributor

@crasm crasm commented Dec 17, 2025

Fixes an argument handling error with the bcachefs module where the ultimate command ends up as bcachefs format --label= ….

This removes the label flag entirely when the nix configured label is the empty string.

@Enzime
Copy link
Copy Markdown
Member

Enzime commented Dec 17, 2025

Can you update the bcachefs test?

Also what’s the error here, is --label= not supported?

@crasm crasm force-pushed the fix-bcfs-unlabeled branch from 1bb9240 to 422afc3 Compare December 17, 2025 05:19
@crasm
Copy link
Copy Markdown
Contributor Author

crasm commented Dec 17, 2025

Also what’s the error here, is --label= not supported?

The bcachefs tool was giving an error when the literal argument --label= was passed without any value.

I’m not sure a test for this is worth keeping around another bcachefs partition/instance with no label?

The label is also currently the only special case option passed to bcachefs format that can be configured inadvertently to be empty.

edit: having a hard time verifying this works; will see about adding a test

@crasm
Copy link
Copy Markdown
Contributor Author

crasm commented Dec 17, 2025

Let me know if you think I should grep the output of `bcachefs show-super’ to confirm there’s no label. In my opinion, testing that the default empty label works should be enough.

@Enzime
Copy link
Copy Markdown
Member

Enzime commented Dec 17, 2025

I think it would be good if your disko configuration explicitly sets the label to empty so that it explicitly tests the empty label situation rather than relying on the default and if you could assert on the output of bcachefs show-super that would be good

@crasm
Copy link
Copy Markdown
Contributor Author

crasm commented Dec 17, 2025

The test is needed for the implicit default as much for the volume creation. It's the most likely scenario a user would stumble upon this, and how I tripped on it. Since the field is optional, leaving it out shouldn't break the config.

Let's say the default label were to be removed at some point (or made null)... Then the test will fail. Which is correct from the perspective of a user relying on the default in their config.

@Enzime
Copy link
Copy Markdown
Member

Enzime commented Dec 17, 2025

Maybe two tests then, one to verify the most basic default config and one to verify what happens when you have the field set to empty

@crasm
Copy link
Copy Markdown
Contributor Author

crasm commented Dec 17, 2025

I want to avoid cluttering the example, so I changed the test to use the empty string specifically

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