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

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

    <bug>
          <bug_id>40526</bug_id>
          
          <creation_ts>2021-07-17 23:48:56 +0300</creation_ts>
          <short_desc>wrong output of gb-task-gen-changelog (as if old changelog was empty)</short_desc>
          <delta_ts>2021-07-30 17:10:12 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Infrastructure</classification>
          <product>Infrastructure</product>
          <component>girar</component>
          <version>unspecified</version>
          <rep_platform>x86_64</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc>https://lists.altlinux.org/pipermail/sisyphus-incominger/2021-July/622505.html</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="Ivan Zakharyaschev">imz</reporter>
          <assigned_to name="placeholder@altlinux.org">placeholder</assigned_to>
          <cc>glebfm</cc>
    
    <cc>ldv</cc>
          
          <qa_contact name="Andrey Cherepanov">cas</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>200643</commentid>
    <comment_count>0</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2021-07-17 23:48:56 +0300</bug_when>
    <thetext>https://lists.altlinux.org/pipermail/sisyphus-incominger/2021-July/622505.html
https://lists.altlinux.org/pipermail/sisyphus-incominger/2021-July/622524.html

The whole history is printed, as if the old changelog was empty (or nothing matched):

2021-Jul-17 17:40:26 :: plan: src +1 -1 =17536, noarch +1 -1 =16223
#100 emacs-text-modes 0.2-alt3 -&gt; 0.2-alt4
 Sat Jul 17 2021 Ivan Zakharyaschev &lt;imz at altlinux&gt; 0.2-alt4
 - For markdown-mode:
   + Match also *.md, *.mdwn, and *.markdown files in auto-mode-alist
     (additionally to *.text files) (ALT#30484).
     (These extensions are used on GitHub, in ikiwiki, and GitLab.)
   + Match these patterns only at the end of filenames.
 Sat Dec 26 2009 Terechkov Evgenii &lt;evg at altlinux.ru&gt; 0.2-alt3
 - Markdown-mode added (ALT #20383)
 - Spec cleanup
 Sat Feb 04 2006 Eugene Vlasov &lt;eugvv at altlinux.ru&gt; 0.2-alt2
 [...]
2021-Jul-17 17:40:26 :: emacs-text-modes: closes bugs: 30484 20383

Running rpm_changes_since function from gb-sh-functions locally on the same pair of packages can&apos;t reproduce this problem.

The line &quot;#100 emacs-text-modes 0.2-alt3 -&gt; 0.2-alt4&quot; indicates that rpm_changes_since was called ($F0 is not empty), given the following code of gb-task-gen-changelog script:

join -t$&apos;\t&apos; -o 1.1,1.2,1.3,1.4,1.5,2.3 plan/{add,rm}-src &gt; $tmpdir/src
sort -t$&apos;\t&apos; -u -k1,3 -o $tmpdir/src{,} plan/add-src

while F0=; read -r N EVR F P I F0; do
	changelog=&quot;build/$I/changelog&quot;
	if [ -n &quot;$F0&quot; ]; then
		# Must be executed before commit-repo!
		srpm0=&quot;$GB_REPO_DIR/files/SRPMS/$F0&quot;
		rpm_changes_since &quot;$P&quot; &quot;$srpm0&quot;
	else
		rpm_recent_changes &quot;$P&quot;
	fi &lt; /dev/null &gt; $tmpdir/log
	grep &apos;^[[:space:]]*[^[:space:]]&apos; &lt; $tmpdir/log |
		sed &quot;s/@$qdom_in&gt;/@$qdom_out&gt;/g;s/^/ /&quot; &gt; &quot;$changelog&quot;
	if [ -n &quot;$F0&quot; ] &amp;&amp; [ -s &quot;$changelog&quot; ]; then
		# Report it
		evr0=&quot;${F0%.src.rpm}&quot;
		evr0=&quot;${evr0#$N-}&quot;
		printf &apos;#%s %s %s -&gt; %s\n&apos; \
			&quot;$I&quot; &quot;$N&quot; &quot;$evr0&quot; &quot;$EVR&quot;
		head &lt; &quot;$changelog&quot;
		if [ &quot;$(wc -l &lt; &quot;$changelog&quot;)&quot; -gt 10 ]; then
			echo &apos; [...]&apos;
		fi
	fi
done &lt; $tmpdir/src

That&apos;s very puzzling: as if rpm -qp on the old package printed something strange and different from my local tests, or gawk behaved differently.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>200644</commentid>
    <comment_count>1</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2021-07-17 23:52:33 +0300</bug_when>
    <thetext>To test rpm_changes_since function from gb-sh-functions locally, one can simply clear the gb-sh-conf script:

&gt; gb-sh-conf

and set tmpdir.

Like this:

/bin/sh -f -c &apos;export PATH=&quot;$PATH:$PWD&quot;; . gb-sh-functions ||:; set -eu; tmpdir=/home/imz/tests/test-girar-rpm_changes_since; rpm_changes_since /tasks/279434/build/100/x86_64/srpm/emacs-text-modes-0.2-alt4.src.rpm /ALT/Sisyphus/files/SRPMS/emacs-text-modes-0.2-alt3.src.rpm&apos;; echo $?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>200719</commentid>
    <comment_count>2</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2021-07-19 16:45:01 +0300</bug_when>
    <thetext>It could, for example, be something like hdrcache[1] that affected the result of rpm -qp in girar and made it different from my local tests. However, this kind of special system configuration (hdrcache or something else affecting rpm -qp) can not be seen from girar.spec, so we can only guess.

[1]: hdrcache is present in Sisyphus, p9, p8:

$ fgrep hdrcache  /ALT/{Sisyphus,p{9,8}}/{noarch,x86_64}/base/contents_index
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/rpm-plugins/hdrcache.so	rpm-plugin-hdrcache
/ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/rpmhdrcache.so	rpmhdrcache
/ALT/p9/x86_64/base/contents_index:/usr/lib64/rpm-plugins/hdrcache.so	rpm-plugin-hdrcache
/ALT/p9/x86_64/base/contents_index:/usr/lib64/rpmhdrcache.so	rpmhdrcache
/ALT/p8/x86_64/base/contents_index:/usr/lib64/rpmhdrcache.so	rpmhdrcache
$</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>200734</commentid>
    <comment_count>3</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2021-07-19 19:38:12 +0300</bug_when>
    <thetext>(Ответ для Ivan Zakharyaschev на комментарий #1)
&gt; To test rpm_changes_since function from gb-sh-functions locally, one can
&gt; simply clear the gb-sh-conf script:
&gt; 
&gt; &gt; gb-sh-conf
&gt; 
&gt; and set tmpdir.
&gt; 
&gt; Like this:
&gt; 
&gt; /bin/sh -f -c &apos;export PATH=&quot;$PATH:$PWD&quot;; . gb-sh-functions ||:; set -eu;
&gt; tmpdir=/home/imz/tests/test-girar-rpm_changes_since; rpm_changes_since
&gt; /tasks/279434/build/100/x86_64/srpm/emacs-text-modes-0.2-alt4.src.rpm
&gt; /ALT/Sisyphus/files/SRPMS/emacs-text-modes-0.2-alt3.src.rpm&apos;; echo $?

It&apos;s simpler to call rpm_changes_since() and do this test with the commit 66c2d2e in master branch in my Git repo, where I moved the &quot;pure&quot; functions (in the same sense as the gb-x-* helpers) into a new file, gb-x-sh-functions.

/bin/sh -efu -c &apos;export PATH=&quot;$PATH:$PWD&quot;; . gb-sh-functions;
tmpdir=/home/imz/tests/test-girar-rpm_changes_since; rpm_changes_since
/tasks/279434/build/100/x86_64/srpm/emacs-text-modes-0.2-alt4.src.rpm
/ALT/Sisyphus/files/SRPMS/emacs-text-modes-0.2-alt3.src.rpm&apos;; echo $?

(No need to clean gb-sh-conf, because it is not loaded and needed by any gb-x-*.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>201068</commentid>
    <comment_count>4</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2021-07-30 13:17:45 +0300</bug_when>
    <thetext>(In reply to Ivan Zakharyaschev from comment #2)
&gt; It could, for example, be something like hdrcache[1] that affected the
&gt; result of rpm -qp in girar and made it different from my local tests.
&gt; However, this kind of special system configuration (hdrcache or something
&gt; else affecting rpm -qp) can not be seen from girar.spec, so we can only
&gt; guess.
&gt; 
&gt; [1]: hdrcache is present in Sisyphus, p9, p8:
&gt; 
&gt; $ fgrep hdrcache  /ALT/{Sisyphus,p{9,8}}/{noarch,x86_64}/base/contents_index
&gt; /ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/rpm-plugins/hdrcache.so
&gt; rpm-plugin-hdrcache
&gt; /ALT/Sisyphus/x86_64/base/contents_index:/usr/lib64/rpmhdrcache.so
&gt; rpmhdrcache
&gt; /ALT/p9/x86_64/base/contents_index:/usr/lib64/rpm-plugins/hdrcache.so
&gt; rpm-plugin-hdrcache
&gt; /ALT/p9/x86_64/base/contents_index:/usr/lib64/rpmhdrcache.so	rpmhdrcache
&gt; /ALT/p8/x86_64/base/contents_index:/usr/lib64/rpmhdrcache.so	rpmhdrcache
&gt; $

No,
$ rpmquery rpmhdrcache rpm-plugin-hdrcache
package rpmhdrcache is not installed
package rpm-plugin-hdrcache is not installed</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>201079</commentid>
    <comment_count>5</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2021-07-30 17:07:37 +0300</bug_when>
    <thetext>(Ответ для Dmitry V. Levin на комментарий #4)

&gt; No,
&gt; $ rpmquery rpmhdrcache rpm-plugin-hdrcache
&gt; package rpmhdrcache is not installed
&gt; package rpm-plugin-hdrcache is not installed

Thanks for information!

Could you try to run a command like the one below (no special privileges must be needed) and see whether this bad behavior can be reproduced?

(Ответ для Ivan Zakharyaschev на комментарий #3)

&gt; /bin/sh -efu -c &apos;export PATH=&quot;$PATH:$PWD&quot;; . gb-sh-functions;
&gt; tmpdir=/home/imz/tests/test-girar-rpm_changes_since; rpm_changes_since
&gt; /tasks/279434/build/100/x86_64/srpm/emacs-text-modes-0.2-alt4.src.rpm
&gt; /ALT/Sisyphus/files/SRPMS/emacs-text-modes-0.2-alt3.src.rpm&apos;; echo $?

It&apos;s very puzzling: what can the reason for the difference in behavior be?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>201080</commentid>
    <comment_count>6</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2021-07-30 17:10:12 +0300</bug_when>
    <thetext>Minor correction (regarding &quot;gb-x-sh-functions&quot;):

/bin/sh -efu -c &apos;export PATH=&quot;$PATH:$PWD&quot;; . gb-x-sh-functions;
tmpdir=/home/imz/tests/test-girar-rpm_changes_since; rpm_changes_since
/tasks/279434/build/100/x86_64/srpm/emacs-text-modes-0.2-alt4.src.rpm
/ALT/Sisyphus/files/SRPMS/emacs-text-modes-0.2-alt3.src.rpm&apos;; echo $?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>