Page MenuHomeFreeBSD

autmount(8): fix absolute path when creating a mountpoint
ClosedPublic

Authored by rew on Dec 30 2020, 12:43 AM.
Tags
None
Referenced Files
F103512826: D27832.diff
Mon, Nov 25, 11:03 PM
Unknown Object (File)
Sat, Nov 23, 12:25 AM
Unknown Object (File)
Mon, Nov 18, 8:56 AM
Unknown Object (File)
Sun, Nov 17, 6:13 PM
Unknown Object (File)
Sun, Nov 17, 3:44 PM
Unknown Object (File)
Sun, Nov 17, 2:40 PM
Unknown Object (File)
Sat, Nov 16, 10:38 AM
Unknown Object (File)
Tue, Nov 5, 9:00 PM
Subscribers

Details

Summary

When executing automount(8), it will attempt to create the directory where the
autofs filesystem is to be mounted. The problem is that automount(8) creates
the mountpoint relative to where automount(8) is executed. The expected behavior
is that automount(8) will create the mountpoint using an absolute path.

The issue is the behavior of concat(), it doesn't include the specified
separator when concatenating if either of the passed strings are empty.

Set partial to be the root path (instead of an empty string) on the first
iteration when creating the directory (i.e., the mountpoint of the autofs filesystem).

PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224601

An alternative fix would be to allow concat() to concatenate the separator
when either of the strings are empty. I didn't take this approach because:

  1. concat() won't concatenate multiple separators together (this is the what the above fix takes advantage of).
  1. Without a more thorough investigation of how concat() is used in other places, I'm not certain that changing the behavior of concat() won't have unintended side-effects.
Test Plan

% cd

% automount -L
=> /net -nobrowse,nosuid,intr -hosts

% ls net
=> no such file or directory

% automount
=> success (no output)

% ls net
=> no such file or directory (expected)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rew requested review of this revision.Dec 30 2020, 12:43 AM

ping trasz@, any objections here?

Sorry for delay, I'll get a proper look soon.

I’m resurrecting this - I was wrong to abandon it.

This bug has been reported twice and should be fixed.

trasz@, any idea when you may have time to give this a look?

I think this is a good fix, thanks for working on it. I have no idea what I was thinking when writing it; I suspect it was just a brain fart, not a workaround for something else.

This revision is now accepted and ready to land.Feb 8 2021, 11:03 PM

had to leave town last week - family emergency. I get back tomorrow and will get this in.

sorry for the delay, thanks for looking at it