Skip to content

Commit ae28f05

Browse files
committed
Parse mount point options with spaces correctly on OpenBSD
Filesystems shared via exports(5) appear like this: ``` $ mount | grep exported /dev/sd0a on / type ffs (NFS exported, local, noatime, wxallowed) ``` Instead of splitting the line on any whitespace: - partition it at the opening parenthese, - split the left side like before, - drop the closing parenthese in the right half - and split it options on comma+whitespace: ``` $ facter mountpoints./.options [ - "NFS", - "exported", + "NFS exported", "local", "noatime", "wxallowed" ] ```
1 parent 0d524a1 commit ae28f05

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/facter/resolvers/openbsd/mountpoints.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ def read_mount(fact_name)
2727
end
2828

2929
def add_mount_points_fact(line)
30-
elem = line.split("\s")
31-
options = elem.drop(5)
32-
options.each { |option| option.tr!('(),', '') }
30+
(elem, _, options) = line.partition("\s(")
31+
elem = elem.split("\s")
32+
options = options.chop!.split(",\s")
3333
@fact_list[:mountpoints][elem[2]] = { device: elem[0], filesystem: elem[4],
3434
options: options }
3535
end

0 commit comments

Comments
 (0)