Page MenuHomeFreeBSD

include: Delete stale symlinks using find(1) instead of a shell loop.
ClosedPublic

Authored by arichardson on Dec 15 2020, 4:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 22, 5:33 PM
Unknown Object (File)
Fri, Nov 15, 5:50 PM
Unknown Object (File)
Fri, Nov 15, 5:44 PM
Unknown Object (File)
Fri, Nov 15, 5:26 PM
Unknown Object (File)
Fri, Nov 15, 3:45 PM
Unknown Object (File)
Oct 24 2024, 9:28 PM
Unknown Object (File)
Oct 1 2024, 2:56 AM
Unknown Object (File)
Sep 29 2024, 6:06 AM
Subscribers
None

Details

Summary

This reduces the number of processes spawned during make includes from 2536
to 2442.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 35609
Build 32509: arc lint + arc unit

Event Timeline

arichardson created this revision.
bdrewery added inline comments.
include/Makefile
143–147

There's a similar check in copies. Both are dealing with a symlinked dir (here) or header (there) switching to a file by choice of committers. If INCSLINKS or the mtree change we could get into trouble. Or someone might be switching from make symlinks to default make copies on the destdir. I think we need to keep this as a seatbelt for _any_ incremental build in WORLDTMP, or install to DESTDIR.

It could probably be more efficient with a find but getting all the arguments to there without going over the command line arg max is tricky.

This revision now requires changes to proceed.Dec 16 2020, 10:03 PM
include/Makefile
143–147

like find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto -maxdepth 1 -mindepth 1 -type l -delete (-depth 1 is slower for some reason). I was wanting to give an xargs example but bmake just passes it all to sh -c anyway so it doesn't help avoid the problem.

arichardson added inline comments.
include/Makefile
143–147

Yes, much better! Included in updated version. However, in this case it needs to be maxdepth 0, and 1 below.

arichardson marked an inline comment as done.

Use find(1)

arichardson retitled this revision from Stop checking whether `make includes` target directories are symlinks to include: Delete stale symlinks using find(1) instead of a shell loop..Dec 22 2020, 2:32 PM
arichardson edited the summary of this revision. (Show Details)
arichardson added inline comments.
include/Makefile
154

-print is not necessary here, but I think it could be helpful since it shows the files that have been deleted.

I think this looks ok.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 19 2021, 9:38 PM
This revision was automatically updated to reflect the committed changes.