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
Unknown Object (File)
Mar 12 2024, 6:39 AM
Unknown Object (File)
Mar 12 2024, 6:39 AM
Unknown Object (File)
Mar 12 2024, 6:39 AM
Unknown Object (File)
Mar 8 2024, 5:09 AM
Unknown Object (File)
Jan 6 2024, 7:55 PM
Unknown Object (File)
Jan 6 2024, 7:55 PM
Unknown Object (File)
Jan 6 2024, 7:51 PM
Unknown Object (File)
Jan 4 2024, 8:24 AM
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