Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error when filesystem format has an unsupported values #829

Open
iFreilicht opened this issue Oct 14, 2024 · 6 comments
Open

Better error when filesystem format has an unsupported values #829

iFreilicht opened this issue Oct 14, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@iFreilicht
Copy link
Contributor

Right now, the filesystem type's format argument supports arbitrary strings.

This can cause confusion when you expect to be able to insert zfs, for example, and expect it to just work, see #820.

One solution, suggested in #820 (comment), would be to check for known bad values like zfs, and return an error. This could be implemented with NixOS module assertions as we're relying on evalModules already.

Another option would be to change the type to only allow filesystems that can be built with an mkfs.<type> command. From what I can tell, this is the entire list of currently supported file systems:

  • bfs
  • cramfs
  • minix
  • xfs
  • btrfs
  • vfat
  • ext2
  • ext3
  • ext4
  • bcachefs
  • f2fs

Both options have their merits. Any opinions?

@iFreilicht iFreilicht added the enhancement New feature or request label Oct 14, 2024
@Enzime
Copy link
Contributor

Enzime commented Oct 14, 2024

My preference would be the latter, we could even allow users to specify zfs and then we print out a helpful error message

@Lassulus
Copy link
Collaborator

the problem is with an inclusive list, is that people need to patch disko to add support for new filesystems. currently you can run any mkfs.* command and maybe the package is just missing but that can be passed by ammending PATH externally. I used that a couple of times for exfat or ntfs-3g.

@Enzime
Copy link
Contributor

Enzime commented Oct 14, 2024

I think it would be fine if users just sent through PRs just to update the list of filesystems supported (without adding full support) whenever they encountered new filesystems that have a mkfs that they want to use

A few more that haven't been mentioned yet:

  • mkfs.c from plan9port
  • mkfs.fat from nu_scripts and dosfstools
  • mkfs.erofs from erofs-utils
  • mkfs.msdos from dosfstools

You can get a list of all of the Hydra built (allowUnfree = false;) ones:

$ nix run github:nix-community/nix-index-database -- --regex 'mkfs\..*'
util-linuxMinimal.man                             1,583 r /nix/store/9dblsj9vid6d0xd94j9d0z9wc3pvypq0-util-linux-minimal-2.39.4-man/share/man/man8/mkfs.8.gz
util-linuxMinimal.man                             1,335 r /nix/store/9dblsj9vid6d0xd94j9d0z9wc3pvypq0-util-linux-minimal-2.39.4-man/share/man/man8/mkfs.bfs.8.gz
util-linuxMinimal.man                             1,666 r /nix/store/9dblsj9vid6d0xd94j9d0z9wc3pvypq0-util-linux-minimal-2.39.4-man/share/man/man8/mkfs.cramfs.8.gz
util-linuxMinimal.man                             1,712 r /nix/store/9dblsj9vid6d0xd94j9d0z9wc3pvypq0-util-linux-minimal-2.39.4-man/share/man/man8/mkfs.minix.8.gz
...

@iFreilicht
Copy link
Contributor Author

we could even allow users to specify zfs and then we print out a helpful error message

Ah yes that's a better option than the user simply seeing "value of zfs is not supported"

think it would be fine if users just sent through PRs just to update the list of filesystems supported (without adding full support) whenever they encountered new filesystems that have a mkfs that they want to use

Yeah I agree. And with a bit of effort I think we can basically create a list of all filesystems that we know we can support, and leave out those that we can't.

Of course there will be cases of someone wanting to use their custom-made filesystem together with a custom package, but maybe would could solve that differently then?

We could extend the type to allow either strings for these simple cases, or an attrset like

{
  name = "dwarffs";
  package = pkgs.dwarffs;
  binary = "dfs-create";
}

This would allow maximum flexibility and discoverability at the same time.

@iFreilicht
Copy link
Contributor Author

Ah, and we should probably make this change a two-step process by first issuing warnings when a user specifies a format that we don't know about, and encourage posting an issue, and only actually change the type in the next major release.

@iFreilicht
Copy link
Contributor Author

Good example of why an inclusive list will be a breaking change: #840

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants