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

uucore::fsext: Fix mountinfo parsing w/ multiple optional fields #2778

Merged
merged 1 commit into from
Dec 22, 2021

Conversation

refi64
Copy link
Contributor

@refi64 refi64 commented Dec 17, 2021

proc(5) mentions the following for the fields section and hyphen:

(7) optional fields: zero or more fields of the form "tag[:value]";
see below.
(8) separator: the end of the optional fields is marked by a single
hyphen.

IOW, there may actually be multiple optional fields, not just one, in
which case the previously hardcoded indexes for the filesystem type and
device name are now incorrect. Now, the filesystem type and device name
are parsed relative to the hypen's location, ensuring that they will be
correct regardless of the number of optional fields.

Signed-off-by: Ryan Gonzalez ryan.gonzalez@collabora.com

@sylvestre
Copy link
Sponsor Contributor

Would it be possible to add a test for this? thanks

@refi64 refi64 force-pushed the mountinfo-optional branch 2 times, most recently from 2420330 to bc7e4fc Compare December 17, 2021 22:56
@refi64
Copy link
Contributor Author

refi64 commented Dec 17, 2021

@sylvestre done!

proc(5) mentions the following for the fields section and hyphen:

> (7)  optional fields: zero or more fields of the form "tag[:value]";
> see below.
> (8)  separator: the end of the optional fields is marked by a single
> hyphen.

IOW, there may actually be multiple optional fields, not just one, in
which case the previously hardcoded indexes for the filesystem type and
device name are now incorrect. Now, the filesystem type and device name
are parsed relative to the hypen's location, ensuring that they will be
correct regardless of the number of optional fields.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
@sylvestre sylvestre merged commit 5c0adb2 into uutils:master Dec 22, 2021
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