Page MenuHomeFreeBSD

pw: do not move /home/$user to /usr/home
ClosedPublic

Authored by karels on May 13 2023, 8:20 PM.
Tags
None
Referenced Files
F103067114: D40085.id121930.diff
Wed, Nov 20, 12:14 PM
Unknown Object (File)
Tue, Nov 19, 10:09 AM
Unknown Object (File)
Mon, Nov 18, 5:50 PM
Unknown Object (File)
Mon, Nov 18, 7:18 AM
Unknown Object (File)
Fri, Nov 15, 2:09 AM
Unknown Object (File)
Thu, Nov 14, 8:13 AM
Unknown Object (File)
Thu, Nov 14, 8:04 AM
Unknown Object (File)
Thu, Nov 14, 4:56 AM
Subscribers

Details

Summary

When adding a user, pw will create the path to the home directory
if needed. However, if creating a path with just one component,
i.e. that appears to be in the root directory, pw would create the
directory in /usr, and create a symlink from the root directory.
Most commonly, this meant that the default of /home/$user would turn
into /usr/home/$user. This was added in a self-described kludge 26
years ago. It made (some) sense when root was generally a small
partition, with most of the space in /usr. However, the default is
now one large partition. /home really doesn't belong under /usr,
and anyone who wants to use /usr/home can specify it explicitly.
Remove the kludge to move /home under /usr and create the symlink,
and just use the specified path. Note that this operation was
done only on the first invocation for a path, and this happened most
commonly when adding a user during the install.

Modify the test that checked for the creation of the symlink to
verify that the symlink is *not* made, but rather a directory.
Add a test that intermediate directories are still created.

Diff Detail

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

Event Timeline

This revision is now accepted and ready to land.May 13 2023, 10:52 PM

Thanks for your work in handling this, @karels. The pw(8) changes, and tests, make sense to me, but it's not really my code to accept.

There are several remaining references/uses of /usr/home in the src tree, I take it you have a plan to handle those as well? I think the most important is in the buildfs() function of release/tools/vmimage.subr, which is the recently-added ZFS root VM image infrastructure.

My general note of caution here is that you really should make sure you are confident that the different edge/failure cases resulting from the new default are enumerated and handled properly, if you expect to make this change for 14.0. As you said yourself it is a "house of cards", and with 25+ years of precedent for the existing "wrong" behaviour, I think it is more important to ensure the change doesn't result in new breakage than it is to appease our collective feeling of yuckyness over the current scheme. That said, a release cycle is probably the best way to get widespread testing here, so I say go for it 👍

Thanks for your work in handling this, @karels. The pw(8) changes, and tests, make sense to me, but it's not really my code to accept.

No problem, I added you because you did the hire(7) change that instigated this.

There are several remaining references/uses of /usr/home in the src tree, I take it you have a plan to handle those as well? I think the most important is in the buildfs() function of release/tools/vmimage.subr, which is the recently-added ZFS root VM image infrastructure.

Yes, if there are no show-stoppers pointed out soon, I'll ask Mark Johnston about the (apparently obvious) change to the vmimage script. I don't know how to test it. There are a couple of other man pages too.

My general note of caution here is that you really should make sure you are confident that the different edge/failure cases resulting from the new default are enumerated and handled properly, if you expect to make this change for 14.0. As you said yourself it is a "house of cards", and with 25+ years of precedent for the existing "wrong" behaviour, I think it is more important to ensure the change doesn't result in new breakage than it is to appease our collective feeling of yuckyness over the current scheme. That said, a release cycle is probably the best way to get widespread testing here, so I say go for it 👍

That's my feeling too.

karels added a subscriber: markj.

Adding @markj, at least for context.

Yes, if there are no show-stoppers pointed out soon, I'll ask Mark Johnston about the (apparently obvious) change to the vmimage script. I don't know how to test it.

As root (yuck!), build world and a kernel, then run make -C release vm-image WITH_VMIMAGES=1 VMFORMATS=raw VMFS=zfs VMSIZE=20g <any make flags that were previously passed to buildworld/kernel>, try to boot the output VM image, and verify that the dataset layout looks as you expected. It may be possible to build VM images as non-root now, but I don't know offhand how to do it.

usr.sbin/pw/tests/pw_useradd_test.sh
304–314

test ! -d ${HOME}/usr/home also works.

I think you will also want to modify poudriere, which can create FreeBSD images and also references usr/home in some places.

I think you will also want to modify poudriere, which can create FreeBSD images and also references usr/home in some places.

That sounds like a problem, although I don't know much about poudriere. Both layouts will exist for some time. Do you know how much this matters, i.e. do the images need to agree with 14.0 images, 13.x images, or ???. Or is this just the layout for jails that are used for building, in which case it might be arbitrary?

I think you will also want to modify poudriere, which can create FreeBSD images and also references usr/home in some places.

That sounds like a problem, although I don't know much about poudriere. Both layouts will exist for some time. Do you know how much this matters, i.e. do the images need to agree with 14.0 images, 13.x images, or ???. Or is this just the layout for jails that are used for building, in which case it might be arbitrary?

I'm not sure to be honest. Maybe @manu or @bapt could say. I know that poudriere contains code for building VM images, among other things, and that still references /usr/home; I think a change similar to the one you did for release/ would be sufficient. I'm not sure if there's any particular requirement that poudriere images agree with anything else.

There are 2 use case of usr/home in poudriere, one is related to ccache when building ports the other one to the zfs images, we can deal with both cases later.

This revision was automatically updated to reflect the committed changes.