Page MenuHomeFreeBSD

Fix list-old-dirs, check-old-dirs to not generate bogus "root fs" entries
ClosedPublic

Authored by sobomax on Aug 25 2025, 6:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 12, 5:10 PM
Unknown Object (File)
Sun, Oct 12, 1:18 PM
Unknown Object (File)
Sun, Oct 12, 1:18 PM
Unknown Object (File)
Sun, Oct 12, 1:18 PM
Unknown Object (File)
Sun, Oct 12, 1:18 PM
Unknown Object (File)
Sun, Oct 12, 2:21 AM
Unknown Object (File)
Fri, Oct 10, 1:06 AM
Unknown Object (File)
Thu, Oct 9, 9:27 AM
Subscribers

Details

Summary

This is a regression since D34741, which causes bogus entry to be generated in some cases. It's quite a dangerous since if the output of the make command is fed to a dumb removal script it might kill the system.

Author: Maksym Sobolyev <sobomax@sippysoft.com>
Date: Mon Aug 25 10:16:41 2025 -0700

Fix list-old-dirs to not generate empty line at the end of the
output if OLD_DIRS happens to have a space at the end of the
last word of the output before the final \n. Then that space
is turned into \n and we end up with a blank line.

The make -V OLD_DIRS looks like so:

0000ce60  73 72 2f 74 65 73 74 73  2f 67 6e 75 2f 75 73 72  |sr/tests/gnu/usr|
0000ce70  2e 62 69 6e 20 75 73 72  2f 74 65 73 74 73 2f 67  |.bin usr/tests/g|
0000ce80  6e 75 2f 75 73 72 2e 62  69 6e 2f 64 69 66 66 20  |nu/usr.bin/diff |
0000ce90  75 73 72 2f 74 65 73 74  73 2f 67 6e 75 2f 6c 69  |usr/tests/gnu/li|
0000cea0  62 20 0a                                          |b .|
0000cea3

Futhermore this gets converted into a "/" i.e. root fs when
calling check-old-dirs.

$ make check-old-dirs
...
/lib/casper
/usr/lib/debug/lib/casper
/etc/skel
/etc/casper
/
/usr/lib/debug/
$

This is the regression since a8267ecc3df0a.

Diff Detail

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

Event Timeline

sobomax edited the summary of this revision. (Show Details)

OK, but we should be able to just use :ts\n as in D39972.

This revision is now accepted and ready to land.Aug 25 2025, 6:44 PM

(If you want to commit this one because you've already tested it I can pick up the :ts\n. Not sure why I missed -dirs when I did that for -libs and -files.

This revision now requires review to proceed.Aug 25 2025, 9:52 PM
This revision was not accepted when it landed; it landed in state Needs Review.Aug 25 2025, 10:02 PM
This revision was automatically updated to reflect the committed changes.