Page MenuHomeFreeBSD

Don't delete the source file when installing links on case-insensitive file systems
AcceptedPublic

Authored by arichardson on Aug 17 2018, 9:11 AM.

Details

Summary

If the name of the link is the same except for case, use install -S to
avoid removing the destination file (which will be the source on a
case-insensitive file system) before creating the link.

Without this change installworld fails on MacOS in libcrypto (due to hmac.3
-> HMAC.3) and sendmail (mail -> Mail)

Test Plan

installworld works on MacOS (with -DNO_ROOT)

Diff Detail

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 32938
Build 30336: arc lint + arc unit

Event Timeline

Rebased and fixed typo in info message

This revision is now accepted and ready to land.Feb 27 2019, 10:41 PM

This seems incomplete. It's just fixing the specific cases having problems today?
Why shouldn't we mandate enabling case-sensitivity on the filesystem first?

And the solution here is just avoiding installing files so it seems to be producing an incorrect result.

share/mk/bsd.links.mk
37–38

Why not here?

This revision now requires review to proceed.Aug 12 2020, 9:16 AM
share/mk/bsd.links.mk
37–38

This case didn't trigger errors, so I didn't notice. Fixed now.

share/mk/bsd.links.mk
25

My first thought is 'why not include this always?'

I know Linux has a different -S flag, but all this is done using a bootstrapped installer. Wouldn't it be a lot simpler to just always use safe mode? Doesn't seem like it would be significantly slower and it would just work everywhere.

share/mk/bsd.links.mk
25

I'd be happy to add -S unconditionally, moving to a temporary file and renaming should not make much of a difference. I added this additional check in case this is considered too expensive.

Should we always use -S, or only if tolower(source) == tolower(target)?

share/mk/bsd.links.mk
25

I'd been thinking of asking for unconditional. If you do it unconditionally, is there some measurable speed difference?

Given that few changes are required to support a case-insensitive FS I think it's worth doing.

share/mk/bsd.links.mk
25

In a quick and dirty benchmark there's a measurable difference doing 100k simple install's with and without -S, but we're talking ~72s vs ~105s. Given we only have ~1500 links in an install the actual difference might be a second at most.

This revision is now accepted and ready to land.Aug 13 2020, 5:46 PM