-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
nixos-generate-config: account for mount points & devices with spaces & tabs in the name #50234
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
Conversation
@GrahamcOfBorg test installer |
Success on aarch64-linux Attempted: tests.installer No partial log is available. |
Success on x86_64-linux Attempted: tests.installer No partial log is available. |
This pull request has been mentioned on Nix community. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review-january/2002/2 |
Have you tried any other special characters (http://www.asciitable.com/)? Assuming the format is the same as |
And is there any reason why you think this might work differently on ZFS vs BTRFS (or ext etc.)? |
Given the manual specifically mentions tabs I guess it does make sense to escape that character as well. I have not tried any other characters, and without a use case or documentation specifically stating what characters are accepted and how to handle them I don't think that we really should support other characters.
No reason. More testing is better and I'm not familiar enough with this script to be 100% certain of my change without peer review or other people testing it. |
Makes sense. |
… & tabs in the name
7140cd4
to
6156de6
Compare
@GrahamcOfBorg test installer |
@timokau created a folder on my drive with a tab in the name, mounted something tot it, and ran nixos-generate-config.pl - the script picked up the new mount point and wrote out the proper entry. |
Thanks! How do I test this? I mounted a btrfs subvolume with spaces and tabs in the subvolume name and the mount point name. I cloned your fork. I tried to rebuild my system from it with I tried to execute the perl script directly, but that gives me
|
@timokau you can execute the script in a nix-shell with perl and perlPackages.FileSlurp |
That gives the same error. Even if I add |
@timokau This is how I run it: $ nix-shell -p perl perlPackages.FileSlurp |
For some reason it didn't work with Anyways, it works and picks up the subvolume with tabs and spaces :) Thanks for working on this! |
Motivation for this change
nixos-generate-config doesn't properly reproduce my system because I have a file system mount which has a space in it.
Running cat /etc/fstab | grep Home returns my existing mount: data/Home\040Videos /srv/Home\040Videos zfs defaults 0 0
Now if I run nixos-generate-config --show-hardware-config | grep Home then I get no results.
Running cat /proc/self/mountinfo | grep Home shows me that a space is escaped by \040 as such: 287 27 0:51 / /srv/Home\040Videos rw,relatime shared:158 - zfs data/Home\040Videos rw,xattr,noacl
See #49354
Note that I tested this on my system which uses zfs and everything seems fine, but I did not test against any other options, such as BTRFS, or disks with labels.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)