Page MenuHomeFreeBSD

OptionalObsoleteFiles: Don't mark /usr/lib/debug/boot directory obsolete
Needs ReviewPublic

Authored by tembun_bk.ru on Tue, Feb 3, 12:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Feb 5, 6:41 PM
Unknown Object (File)
Wed, Feb 4, 8:56 AM
Unknown Object (File)
Tue, Feb 3, 8:40 PM
Unknown Object (File)
Tue, Feb 3, 5:41 PM
Unknown Object (File)
Tue, Feb 3, 5:18 PM
Unknown Object (File)
Tue, Feb 3, 2:31 PM

Details

Summary

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/.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste requested changes to this revision.EditedTue, Feb 3, 12:57 PM
emaste added a subscriber: emaste.

Kernel debug files aren't controlled by WITH_/WITHOUT_DEBUG_FILES so should not be removed here

This revision now requires changes to proceed.Tue, Feb 3, 12:57 PM

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.

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.

Maybe @markj or @kib could help?

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.

In D55077#1259930, @kib wrote:

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).

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?

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.

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(/.*)?"?

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(/.*)?"?

Sure, it seems to work.

tembun_bk.ru retitled this revision from OptionalObsoleteFiles: Fix finding old DEBUG_DIRS to OptionalObsoleteFiles: Don't mark /usr/lib/debug/boot directory obsolete.
tembun_bk.ru edited the summary of this revision. (Show Details)

Instead of trying to mark everything under /usr/lib/debug/boot obsolete, prevent /usr/lib/debug/boot itself from being marked obsolete.