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.
Tags
None
Referenced Files
Unknown Object (File)
Jan 6 2024, 11:36 AM
Unknown Object (File)
Dec 20 2023, 4:04 AM
Unknown Object (File)
Nov 10 2023, 4:03 PM
Unknown Object (File)
Nov 1 2023, 5:13 AM
Unknown Object (File)
Oct 31 2023, 4:40 PM
Unknown Object (File)
Oct 9 2023, 2:59 PM
Unknown Object (File)
Oct 1 2023, 5:12 AM
Unknown Object (File)
Sep 29 2023, 4:41 PM
Subscribers
None

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 Passed
Unit
No Test Coverage
Build Status
Buildable 20873
Build 20249: 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
30

Why not here?

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

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

share/mk/bsd.links.mk
22

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
22

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
22

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
22

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