On Wed, Aug 03, 2022 at 11:36:49PM -0700, Ross Vandegrift wrote:
> I had built a snapshot with `gbp dch -S`, and wanted to prepare an upload to
> experimental.  I ran:
>   $ gbp dch -R --dist experimental
> But this gave me a changelog with unstable.  I wasn't careful enough and
> uploaded the result :(.
> 
> The manpage documents that --release sets the distribution to unstable.  So
> maybe this behavior is intentional?  If so, it'd be really nice to get an 
> error
> message if I also supply --dist.
> 
> But I think it may be a bug.  When run with --verbose, the log makes it look
> like gbp is setting the dist to experimental.  Example from 0.9.28 is below,
> 0.9.22 behaves the same.

It is a bug; see below.

> Starting situation:
> $ head -n 1 debian/changelog
> efl (1.26.2-3~exp1~1.gbp7d7265) UNRELEASED; urgency=medium
> 
> Update changelog for a release:
> $ gbp dch -R --dist experimental --ignore-branch --verbose
> gbp:debug: ['git', 'rev-parse', '--show-cdup']
> gbp:debug: ['git', 'rev-parse', '--is-bare-repository']
> gbp:debug: ['git', 'rev-parse', '--git-dir']
> gbp:debug: ['git', 'symbolic-ref', 'HEAD']
> gbp:debug: ['git', 'show-ref', 'refs/heads/gbp-bug']
> gbp:info: Continuing from commit '7d72650852767b5308fe9f4c0ff1a8dbd7f504d1'
> gbp:debug: ['git', 'log', '--pretty=format:%H', '--no-show-signature', 
> '7d72650852767b5308fe9f4c0ff1a8dbd7f504d1..HEAD', '--no-merges', '--']
> gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', 
> 'ef0ec43479de56c266f7a8680bffcc6712f3af93^0']
> gbp:debug: ['git', 'show', 
> '--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00',
>  '-z', '--date=raw', '--no-renames', '--name-status', '--no-show-signature', 
> 'ef0ec43479de56c266f7a8680bffcc6712f3af93']
> gbp:debug: debchange ['--no-auto-nmu', '--nomultimaint-merge', 
> '--multimaint', '--', '[[[insert-git-dch-commit-message-here]]]'] []
> gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', 
> '3e3486545ceafae9fc2d8eff789addf0a6b95600^0']
> gbp:debug: ['git', 'show', 
> '--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00',
>  '-z', '--date=raw', '--no-renames', '--name-status', '--no-show-signature', 
> '3e3486545ceafae9fc2d8eff789addf0a6b95600']
> gbp:debug: debchange ['--no-auto-nmu', '--nomultimaint-merge', 
> '--multimaint', '--', '[[[insert-git-dch-commit-message-here]]]'] []
> gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', 
> 'c8929207ddc7721c81d5d8b9776e595d7c525d2f^0']
> gbp:debug: ['git', 'show', 
> '--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00',
>  '-z', '--date=raw', '--no-renames', '--name-status', '--no-show-signature', 
> 'c8929207ddc7721c81d5d8b9776e595d7c525d2f']
> gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', 
> '329535b39b82520c0d4e2823490cf3406f4567bf^0']
> gbp:debug: ['git', 'show', 
> '--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00',
>  '-z', '--date=raw', '--no-renames', '--name-status', '--no-show-signature', 
> '329535b39b82520c0d4e2823490cf3406f4567bf']
> gbp:debug: Set header option 'distribution' to 'experimental'
> gbp:debug: Set header option 'urgency' to 'medium'
> gbp:debug: debchange ['--no-auto-nmu', '--nomultimaint-merge', 
> '--multimaint', '--distribution=experimental', '--urgency=medium', 
> '--nomainttrailer', '--', ''] []

At this point, debchange has updated the UNRELEASED header in the
section to have the specified distribution and urgency.

Unfortunately, now the mangle_changelog function is called to fix up the
snapshot version, and it replaces the distribution and urgency with what
was in the section when gbp-dch was instantiated, rather than what is in
the section now.

Next, gbp-dch calls debchange again to update the changelog timestamp
for release, and debchange sees that the distribution is UNRELEASED and
sets it to unstable.

> gbp:debug: debchange ['--no-auto-nmu', '--release', 
> '--no-force-save-on-release', '--nomultimaint-merge', '--multimaint', '--', 
> ''] []
> gbp:debug: sensible-editor ['debian/changelog'] []
> 
> Oops:
> $ head -n 1 debian/changelog
> efl (1.26.2-3~exp1) unstable; urgency=medium

I'm running 0.9.19 from Ubuntu 22.04, but I assume this bug is still
around.  -Nathan

Reply via email to