Page MenuHomeFreeBSD

Clean up all directories created by `make hier`
ClosedPublic

Authored by ngie on Dec 23 2018, 11:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 19 2024, 4:48 PM
Unknown Object (File)
Mar 19 2024, 2:36 PM
Unknown Object (File)
Feb 6 2024, 1:41 AM
Unknown Object (File)
Dec 22 2023, 9:45 PM
Unknown Object (File)
Oct 24 2023, 4:03 PM
Unknown Object (File)
Jul 11 2023, 4:36 PM
Unknown Object (File)
Jul 11 2023, 4:36 PM
Unknown Object (File)
Jul 11 2023, 4:34 PM
Subscribers

Details

Summary

The logic I introduced in r322511 unfortunately left chflags schg'ed
directories behind created by make hier (in the stock /etc/mtree
files, this is limited to /var/empty).

The proposed change calls chflags -R 0 and rm -Rf ... to clean all
of the directories that could not be removed by ${MAKE} clean.
${MAKE} clean in bsd.obj.mk calls cleandir/cleanobj, which handles
the first directory tree walk/removal.

Test Plan
$ sudo make check
...
rpc_test:get_svc_addr_tcp  ->  skipped: clnt_create (: RPC: Port mapper failure - RPC: Timed out)  [120.243s]
rpc_test:get_svc_addr_udp  ->  skipped: clnt_create (: RPC: Port mapper failure - RPC: Timed out)  [120.098s]
rpc_test:raw  ->  passed  [0.007s]
rpc_test:tcp  ->  skipped: Cannot create server 1  [0.028s]
rpc_test:tcp_poll  ->  skipped: Cannot create server 1  [0.017s]
rpc_test:udp  ->  skipped: Cannot create server 1  [0.006s]
rpc_test:udp_poll  ->  skipped: Cannot create server 1  [0.015s]
xdr_test:xdr  ->  passed  [0.004s]

Results file id is usr_obj_usr_src_amd64.amd64_lib_libc_tests_rpc_checkdir_usr_tests_lib_libc_rpc.20181223-233838-068392
Results saved to /root/.kyua/store/results.usr_obj_usr_src_amd64.amd64_lib_libc_tests_rpc_checkdir_usr_tests_lib_libc_rpc.20181223-233838-068392.db

8/8 passed (0 failed)
(cd /usr/src/lib/libc/tests/rpc &&  DEPENDFILE=.depend.rpc_test  NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/rpc/Makefile _RECURSING_PROGS=t   PROG=rpc_test  clean)
rm -f  rpc_test.full.bc rpc_test.full.ll rpc_test rpc_test.bc rpc_test.ll rpc_test.full rpc_test.debug t_rpc.o t_rpc.bco t_rpc.llo
(cd /usr/src/lib/libc/tests/rpc &&  DEPENDFILE=.depend.xdr_test  NO_SUBDIR=1 make -f /usr/src/lib/libc/tests/rpc/Makefile _RECURSING_PROGS=t   PROG=xdr_test  clean)
rm -f  xdr_test.full.bc xdr_test.full.ll xdr_test xdr_test.bc xdr_test.ll xdr_test.full xdr_test.debug h_testbits_xdr.o t_xdr.o h_testbits_xdr.bco t_xdr.bco h_testbits_xdr.llo t_xdr.llo
rm -f h_testbits.h h_testbits.c h_testbits_xdr.c Kyuafile Kyuafile.tmp
rm -rf checkdir
rm: checkdir/var/empty: Operation not permitted
rm: checkdir/var: Directory not empty
rm: checkdir: Directory not empty
*** Error code 1 (ignored)
[ngie@pinklady-fbsd-current /usr/src/lib/libc/tests/rpc]$ ls `make check -VDESTDIR`
ls: /usr/obj/usr/src/amd64.amd64/lib/libc/tests/rpc/checkdir: No such file or directory

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 21700
Build 20984: arc lint + arc unit

Event Timeline

If you tag the commit with rS Phab will make a link automatically: rS322511

share/mk/suite.test.mk
123

How many files do we expect in ${DESTDIR}?

Other chflags uses do a rm 2>/dev/null; chflags -R; rm dance to avoid a slow recursive chflags. Perhaps not necessary here.

Since make clean runs first, I'm assuming the only things left will be things with flags set? If so, what you propose is probably correct (and we don't need the rm/chflags/rm "dance" optimization).

OTOH, if the overall number of files will be small, it might be better to run chflags before make clean and not do a special 'rm'.

Just my 2c.

share/mk/suite.test.mk
123

What @jtl said is correct. ${MAKE} clean effectively performs the rm -Rf dance. The second chflags -R 0/rm -Rf dance is to eliminate the remaining paths that were left behind, which with the stock mtree files is only 1 path:

$ grep -r schg /etc/mtree/
/etc/mtree/BSD.var.dist:    empty           mode=0555 flags=schg

I should be more explicit about that point in my commit message.

ngie marked an inline comment as done.
This revision was not accepted when it landed; it landed in state Needs Review.Feb 6 2019, 9:24 PM
This revision was automatically updated to reflect the committed changes.