The intent of the currect code is to ignore anything under /usr/lib/debug/boot/*. But we also should make sure that /usr/lib/debug/boot directory is also ignored and is not marked obsolete. If we don't do that, make DBATCH_DELETE_OLD_FILES delete-old will try to rmdir(1) this directory, which will cause an error, since /usr/lib/debug/boot may have nested directories like kernel/ and modules/.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Kernel debug files aren't controlled by WITH_/WITHOUT_DEBUG_FILES so should not be removed here
Oh, I see, these seem to be controlled by WITH[OUT]_SPLIT_KERNEL_DEBUG. But where we should put the code that will mark files in /usr/lib/debug/boot/{kernel,modules} 'obsolete'? I guess it must be somewhere in sys/, but I'm not sure where exactly.
When make installkernel is performed, the symbols become insta-stale, isn't it?
Might be, we need somewhat different model of installation of the debug symbols, which would take into account the name of /boot/kernel directory (like /usr/lib/debug/boot/kernel.GENERIC for /boot/kernel.GENERIC). Then, when /boot/kernel is moved to /boot/kernel.old, the debug files tree might be renamed. Of course, this does not solve the issue that kernel and modules have the path to /usr/lib/debug/boot embedded, but this might be a different issue to tackle. Unless we already do this.
My previous answer was probably not quite clear in some aspects. I mean, on make installkernel we should either rename /usr/lib/debug/boot, or remove it, before installing new debug symbols.
This is how it works already, e.g., I have /usr/lib/debug/boot/kernel.GENERIC-KASAN and /usr/lib/debug/boot/kernel.GENERIC-NODEBUG.
Then, when /boot/kernel is moved to /boot/kernel.old, the debug files tree might be renamed. Of course, this does not solve the issue that kernel and modules have the path to /usr/lib/debug/boot embedded, but this might be a different issue to tackle. Unless we already do this.
AFAIK we already do this. Note that the kernel and modules do not have any debug paths embedded, it is a gdb convention to search for /foo/bar/exe's debug symbols in /usr/lib/debug/foo/bar/exe.
With respect to the change itself, I do not see why make delete-old should touch anything under /usr/lib/debug/boot. I believe that the intent of the current code is to ignore anything under /usr/lib/debug/boot/*. What exactly is the problem being solved?
With respect to the change itself, I do not see why make delete-old should touch anything under /usr/lib/debug/boot. I believe that the intent of the current code is to ignore anything under /usr/lib/debug/boot/*. What exactly is the problem being solved?
The current code that populates DEBUG_DIRS effectively ignores everything inside /usr/lib/debug/boot/, but not /usr/lib/debug/boot itself. In my case, I have nested directories in /usr/lib/debug/boot, and they are not included in DEBUG_DIRS. And that's ok, I now agree that make delete-old should not delete files under /usr/lib/debug/boot, but with current implementation /usr/lib/debug/boot is captured into DEBUG_DIRS and thus when I run make delete-old it attempts to delete it with rmdir and can't do this, since the directory is not empty (and prints the error message). So should /usr/lib/debug/boot directory itself be included in DEBUG_DIRS?
No, I think it shouldn't. So I guess the proper thing would be to exclude \! -d /usr/lib/debug/boot/* \! -d /usr/lib/debug/boot. Maybe there's a cleaner way to write that.
Maybe we can do something like this: find -E <...> \! -regex "${DESTDIR}/usr/lib/debug/boot(/.*)?"?
Instead of trying to mark everything under /usr/lib/debug/boot obsolete, prevent /usr/lib/debug/boot itself from being marked obsolete.