-
Notifications
You must be signed in to change notification settings - Fork 208
lenses/fstab.aug: Allow individual mount options to be empty #849
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
base: master
Are you sure you want to change the base?
Conversation
d6cd9b0 to
fd361c7
Compare
|
I don't like the full solution here. I think commit 5246ef0 was a hack, not a good fix for that problem. This adds something like another hack on top of that commit. I would prefer a solution where we allow option fields in the list to be empty, which would be a generalisation of both this PR & commit 5246ef0. However I could not work out how to actually express that as an Augeas lens, just getting lots of ambiguous parsing problems that I was unable to fix. |
|
I'll have a look at this |
|
I agree thata commit 5246ef0 fixed a single use-case but didn't address the much boarder issue of other stray commas in the mount options The previous fix treats the trailing comma as an "optional part of the space", which does not seem correct to me either My first instinct was just to "make everything optional", but this approach has some pitfalls It is possible to construct a lens where everything is optional, like this The above lens snippet would accept a wide range of option combinations, such as One aspect of this snippet, is that the extra commas result in additional opt nodes in the tree There is a problem with the above. Given an fstab entry like this This generates a tree like this Notice the there are 2 empty opt entries, which is consistant with the input The resulting preview looks like this which is incorrect syntax for /etc/fstab This forces us to ask the question, what actually valid for "mount options"? I would suggest that the minimal set of mount-options should insist that the 1st option is not empty That would give us an improved snippet like this Curiously, this still accepts a single ',' as a list of mount-options I did notice one other thing when experimenting with the above If we replace the empty string with a NULL like this then the preview fails (ie the reverse translate fails) We can make this completely optional by making the "store" operation optional, like this This appears to act as an indicator that there does not need to be a string stored for an empty opt, as long as the opt node exists I think this improves the usability of the lens I would suggest that the original lens seems quite confusing, and would suggest the following alternative |
|
Thanks. I'll just note that the proper way to express "no mount options" is to put |
This line doesn't compile with: I guess you cannot use I will push an update that contains your version that I'm testing. |
Mount allows mount-option fields to be empty (I think it ignores them), but augeas gave an error. Example: /dev/mapper/vg00-vartmp /var/tmp xfs rw,,nodev,nosuid,noexec,relatime 0 0 Rewrite the lens from scratch to be more rational and to handle the empty mount option case. The fix/rewrite here was provided by George Hansper in: hercules-team#849 (comment) Fixes: https://issues.redhat.com/browse/RHEL-77279 Fixes: hercules-team#832 Signed-off-by: Richard W.M. Jones <[email protected]>
fd361c7 to
406082c
Compare
Mount allows mount-option fields to be empty (I think it ignores them), but augeas gave an error. Example: /dev/mapper/vg00-vartmp /var/tmp xfs rw,,nodev,nosuid,noexec,relatime 0 0 Rewrite the lens from scratch to be more rational and to handle the empty mount option case. The fix/rewrite here was provided by George Hansper in: hercules-team#849 (comment) Fixes: https://issues.redhat.com/browse/RHEL-77279 Fixes: hercules-team#832 Signed-off-by: Richard W.M. Jones <[email protected]>
406082c to
ad79c26
Compare
Mount allows mount-option fields to be empty (I think it ignores them), but augeas gave an error. Allow this to be parsed, preserving the empty option on write.
Example:
/dev/mapper/vg00-vartmp /var/tmp xfs rw,,nodev,nosuid,noexec,relatime 0 0Fixes: https://issues.redhat.com/browse/RHEL-77279
Fixes: #832
Signed-off-by: Richard W.M. Jones [email protected]