Bug 39184 - debugedit: canonicalization unexpectedly shrank by one character
Summary: debugedit: canonicalization unexpectedly shrank by one character
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: rpm-build (show other bugs)
Version: unstable
Hardware: x86 Linux
: P5 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-04 09:38 MSK by Vitaly Chikunov
Modified: 2020-11-09 12:23 MSK (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaly Chikunov 2020-11-04 09:38:18 MSK
While building a kernel, stumbled upon this debugedit bug (making brp-debuginfo fail, causing overall build failure):

 + /usr/lib/rpm/debugedit -b /usr/src/RPM/BUILD -d /usr/src/debug -l .tmp/src.14318 ./usr/lib/debug/lib/modules/5.9.1-clr-native-alt1.clr992/vmlinux
 /usr/lib/rpm/debugedit: canonicalization unexpectedly shrank by one character

This seems to be probabilistic error.

      if (shrank > 0)
        {
          if (--shrank == 0)
            error (EXIT_FAILURE, 0,
                   "canonicalization unexpectedly shrank by one character");
          else
            {
              memset (ptr, 'X', shrank);
              ptr += shrank;
              *ptr++ = '\0';
            }
        }

If array of paths shrank more than 1 char it is padded with "XX\0", but if it's just one byte it fails.
Comment 2 Vitaly Chikunov 2020-11-04 10:12:15 MSK
I wonder why we not get this more frequent?
Comment 3 Dmitry V. Levin 2020-11-04 21:48:34 MSK
(In reply to Vitaly Chikunov from comment #2)
> I wonder why we not get this more frequent?

Because all such cases are bugs in makefiles (or whatever build systems are used in packages), most of them must have been fixed already?
Comment 4 Vitaly Chikunov 2020-11-05 09:51:19 MSK
(In reply to Dmitry V. Levin from comment #3)
> (In reply to Vitaly Chikunov from comment #2)
> > I wonder why we not get this more frequent?
> 
> Because all such cases are bugs in makefiles (or whatever build systems are
> used in packages), most of them must have been fixed already?

Maybe autotools/cmake normalizes paths? And only unique compilation harness, which is rare, would get this. We never got this for kernel for years, but, this bug is happened on kernel (with a fistful of patches though, but I didn't find "//"s in them nor in compile log with V=1).
Comment 5 Repository Robot 2020-11-09 04:51:34 MSK
rpm-build-4.0.4-alt152 -> sisyphus:

 Wed Nov 04 2020 Vitaly Chikunov <vt@altlinux> 4.0.4-alt152
 - debuginfo: Allow kbuilds with the output directory.
 - debugedit: Fix 'canonicalization unexpectedly shrank by one character'
   (closes: #39184).
 - brp-sign-kmodules: Sign kernel modules after kernel build.
Comment 6 Vitaly Chikunov 2020-11-09 12:23:23 MSK
Thanks!