• How to fix Lintian 'no-code-sections'?

    From =?UTF-8?B?T3R0byBLZWvDpGzDpGluZW4=?@21:1/5 to All on Sat Nov 27 07:20:01 2021
    Hello!

    Lintian in Debian unstable has a new test that my package is failing on: https://lintian.debian.org/tags/no-code-sections

    Can somebody who recently fixed this in their own package give some
    advice how I should fix it for mariadb-10.6?

    See example of Lintian error about libmariadbd.a in context at https://salsa.debian.org/mariadb-team/mariadb-server/-/jobs/2203726


    in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977596 there is a
    shell example how to test for no-code-sections, but it does not return
    anything for me locally:

    readelf -W --section-headers ./debian/tmp/usr/lib/x86_64-linux-gnu/libmariadbd.a | sed -n '/^ *\[[ 0-9]*\]/s/ *\[[ 0-9]*\] *//p' | awk 'BEGIN {rv=1} /^NULL/ {next} $1 ~/^.(text|data|(preinit|init|fini)_array$)/ {if ($5 !~ /^0+$/) rv=0}
    END { exit rv}'
    readelf: Warning: unable to apply unsupported reloc type 21 to section .debug_info

    (or https://paste.debian.net/1220493/ with no line breaks)

    Any suggestions how to debug this locally so I can validate if various
    changes in debian/rules fixes it or not?


    - Otto

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon McVittie@21:1/5 to All on Sat Nov 27 14:30:01 2021
    On Fri, 26 Nov 2021 at 22:10:45 -0800, Otto Kekäläinen wrote:
    Lintian in Debian unstable has a new test that my package is failing on: https://lintian.debian.org/tags/no-code-sections

    As with any Lintian tag, I would recommend doing your own assessment
    of whether this is a real error before assuming there is a bug that you
    need to fix.

    This particular one looks like it's a Lintian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000469 (fixed in git)

    Looking at the results reported with current Lintian, it seems to me
    that this check was initially assuming that every object file (.o) in
    a static library is expected to contain at least some executable code,
    but I don't think that's really true:

    * some translation units end up effectively empty, because they contain
    only functions that are #ifdef'd out under the build options in use,
    for example SDL_evdev_kbd_freebsd.o in a Linux build of libSDL2.a

    * some translation units contain global variables but no executable code,
    for example (guessing from its name) decomposition-table.o in libunistring

    The resolution in Lintian git was to make this check only trigger if
    *the entire static library* contains no executable code, which seems
    reasonable (and in the rare case that a static library intentionally
    contains only variables and no code, it would be appropriate for a
    maintainer who knows that to override the hint).

    If feasible, an excellent way to verify that a static library is
    practically usable would be to add an autopkgtest that statically links
    a simple executable that calls one of your library's functions, and then
    runs that executable. If you add a test like this, please remember to
    flag it as 'superficial' to indicate that it doesn't provide thorough
    test coverage.

    smcv

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?B?T3R0byBLZWvDpGzDpGluZW4=?@21:1/5 to smcv@debian.org on Sat Nov 27 18:50:01 2021
    On Sat, Nov 27, 2021 at 5:30 AM Simon McVittie <smcv@debian.org> wrote:

    On Fri, 26 Nov 2021 at 22:10:45 -0800, Otto Kekäläinen wrote:
    Lintian in Debian unstable has a new test that my package is failing on: https://lintian.debian.org/tags/no-code-sections

    As with any Lintian tag, I would recommend doing your own assessment
    of whether this is a real error before assuming there is a bug that you
    need to fix.

    I tried, but clearly reading the Lintian page linked above and the bug
    report linked from it didn't really convey what it was actually trying
    to achieve. Now when you explained it, I got it, and also see why it
    is fine to ignore.

    This particular one looks like it's a Lintian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000469 (fixed in git)

    Thanks for pointing this out!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)