<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>39184</bug_id>
          
          <creation_ts>2020-11-04 09:38:18 +0300</creation_ts>
          <short_desc>debugedit: canonicalization unexpectedly shrank by one character</short_desc>
          <delta_ts>2020-11-09 12:23:23 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>rpm-build</component>
          <version>unstable</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Vitaly Chikunov">vt</reporter>
          <assigned_to name="placeholder@altlinux.org">placeholder</assigned_to>
          <cc>arseny</cc>
    
    <cc>glebfm</cc>
    
    <cc>imz</cc>
    
    <cc>ldv</cc>
    
    <cc>placeholder</cc>
    
    <cc>vt</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>193761</commentid>
    <comment_count>0</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2020-11-04 09:38:18 +0300</bug_when>
    <thetext>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 &gt; 0)
        {
          if (--shrank == 0)
            error (EXIT_FAILURE, 0,
                   &quot;canonicalization unexpectedly shrank by one character&quot;);
          else
            {
              memset (ptr, &apos;X&apos;, shrank);
              ptr += shrank;
              *ptr++ = &apos;\0&apos;;
            }
        }

If array of paths shrank more than 1 char it is padded with &quot;XX\0&quot;, but if it&apos;s just one byte it fails.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>193762</commentid>
    <comment_count>1</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2020-11-04 09:55:22 +0300</bug_when>
    <thetext>Related upstream bug https://bugzilla.redhat.com/show_bug.cgi?id=304121
And it&apos;s fix https://github.com/rpm-software-management/rpm/commit/88989572fff1f3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>193763</commentid>
    <comment_count>2</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2020-11-04 10:12:15 +0300</bug_when>
    <thetext>I wonder why we not get this more frequent?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>193769</commentid>
    <comment_count>3</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2020-11-04 21:48:34 +0300</bug_when>
    <thetext>(In reply to Vitaly Chikunov from comment #2)
&gt; 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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>193781</commentid>
    <comment_count>4</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2020-11-05 09:51:19 +0300</bug_when>
    <thetext>(In reply to Dmitry V. Levin from comment #3)
&gt; (In reply to Vitaly Chikunov from comment #2)
&gt; &gt; I wonder why we not get this more frequent?
&gt; 
&gt; Because all such cases are bugs in makefiles (or whatever build systems are
&gt; 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&apos;t find &quot;//&quot;s in them nor in compile log with V=1).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>193935</commentid>
    <comment_count>5</comment_count>
    <who name="Repository Robot">repository-robot</who>
    <bug_when>2020-11-09 04:51:34 +0300</bug_when>
    <thetext>rpm-build-4.0.4-alt152 -&gt; sisyphus:

 Wed Nov 04 2020 Vitaly Chikunov &lt;vt@altlinux&gt; 4.0.4-alt152
 - debuginfo: Allow kbuilds with the output directory.
 - debugedit: Fix &apos;canonicalization unexpectedly shrank by one character&apos;
   (closes: #39184).
 - brp-sign-kmodules: Sign kernel modules after kernel build.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>193953</commentid>
    <comment_count>6</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2020-11-09 12:23:23 +0300</bug_when>
    <thetext>Thanks!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>