Re: NFS /etc/exports syntax

From: Rick Macklem <rick.macklem_at_gmail.com>
Date: Tue, 20 Jan 2026 14:39:24 UTC
On Tue, Jan 20, 2026 at 6:25 AM Steve Rikli <sr@genyosha.net> wrote:
>
> On Tue, Jan 20, 2026 at 05:47:21AM -0800, Rick Macklem wrote:
> > On Mon, Jan 19, 2026 at 9:30 PM Steve Rikli <sr@genyosha.net> wrote:
> > > There appear to be some inconsistencies in exports(5) man page, or at
> > > least a couple things which have me wondering a bit.  :-)
> > ...
> > > Different but related, is there a syntax rule for "chaining" flags
> > > together after a leading "-"?  E.g. is something like this valid:
> > >
> > >   /foo -maproot=root,ro,alldirs -network=1.2.3.4/24
> >
> > No, each flag must be separate with the "-" at the beginning of
> > it, from what I can see. (The parsing code is literally decades
> > old. It was first written in the late 1980s.)
>
> Does that mean this line from EXAMPLES is actually invalid?
>
>     /cdrom -alldirs,quiet,ro -network 192.168.33.0 -mask 255.255.255.0
>              ^^^^^^^^^^^^^^
> Note the "," between alldirs,quiet,ro flags, with no spaces or dashes.
No, the example is fine. I was wrong. I misread the code when I glanced
at it. I just tried it and the "separate options with commas works, too.

So, you can take your pick. Start with a "-" and then list them separated by
commas or separate each option by whitespace and have each start with a "-".

Like I said, many have hacked it over the years and it appears that
someone liked what you found "more natural" and added the "separated
by commas variant".

rick

>
> > > From a readability standpoint, this seems clearer to me:
> > >
> > >   /foo -maproot=root -ro -alldirs -network=1.2.3.4/24
> >
> > Not sure what you were asking about this line, but it
> > looks ok to me.
>
> That example was simply to draw a comparison between "-flag1 -flag2" and
> the above question about "-flag1,flag2". I find the clarity and
> readability better with dashes and spaces between flags, vs. chaining
> flags together with commmas.  $.02.
>
> > > but I'm curious if there is a formal syntax definition for this stuff.
> >
> > Nope. It's very old C that has been hacked by many over the
> > years. I can barely figure out what it is doing when I look at it
> > and I've looked at it many times.
>
> Understood. I'm guessing the very old C code is somewhat reflected in
> the exports(5) content -- the man page has a lot of info, and some of it
> resembles a proverbial wall of text. :-) The EXAMPLES are pretty
> helpful, fortunately.
>
> Thanks,
> sr.