[SRU] rabbitmqadmin shows %%VSN%% as version

Bug #1773324 reported by Nick on 2018-05-25
24
This bug affects 2 people
Affects Status Importance Assigned to Milestone
rabbitmq-server (Ubuntu)
Status tracked in Eoan
Bionic
Medium
Unassigned
Cosmic
Medium
Unassigned
Disco
Medium
Unassigned
Eoan
Medium
Unassigned

Bug Description

[Impact]
Version information is displayed by rabbitmq-server, preventing configuration management tools from deploying and maintaining the services properly.

[Test Case]
$ rabbitmqadmin --version
rabbitmqadmin %%VSN%%

[Regression Potential]
Very low. The patch simply adds a step to the makefile. Things to look for would be build-time related problems; none are expected.

[Fix]
Upstream's release scripts substitute in the version string, but that logic isn't triggered during the regular debian package build. It's straightforward to fix by inserting an equivalent sed command to the makefile during our build.

This issue affects rabbitmq-server from Bionic forward, and will need carried in our own packaging. The fix may be worth forwarding to debian as well, once it's confirmed their package is affected as well.

For testing, a PPA with packages containing the fix is available at:
https://launchpad.net/~bryce/+archive/ubuntu/sru.1773324

[Discussion]

[Original Report]
When running 'rabbitmqadmin --version' it shows %%VSN%% as the version information on Ubuntu 18.04 and not the correct rabbitmq version. We are using puppet to install and configure rabbitmq server and the puppet-rabbitmq modules [1] are using the version information from that command internally. Currently they are failing in Ubuntu 18.04.

Used versions:

Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic
rabbitmq-server: 3.6.10-1

[1] https://github.com/voxpupuli/puppet-rabbitmq

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: rabbitmq-server 3.6.10-1
ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
Uname: Linux 4.15.0-20-generic x86_64
ApportVersion: 2.20.9-0ubuntu7
Architecture: amd64
Date: Fri May 25 09:46:18 2018
PackageArchitecture: all
SourcePackage: rabbitmq-server
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.default.rabbitmq-server: [modified]
mtime.conffile..etc.default.rabbitmq-server: 2018-05-24T07:06:38.256492

Related branches

Nick (n6ck) wrote :
Andreas Hasenack (ahasenack) wrote :

Confirmed in artful, bionic and cosmic.

Changed in rabbitmq-server (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
tags: added: bitesize
Andreas Hasenack (ahasenack) wrote :

All that's needed is a sed pass on deps/rabbitmq_management/bin/rabbitmqadmin, which has:
VERSION = '%%VSN%%'

Its makefile seems to be ready for that in the prepare-dist target:
prepare-dist::
        $(verbose) sed 's/%%VSN%%/$(PROJECT_VERSION)/' bin/rabbitmqadmin \
                > $(EZ_DIR)/priv/www/cli/rabbitmqadmin

Andreas Hasenack (ahasenack) wrote :

Still happens with disco:
root@disco-rabbit:~# rabbitmqadmin --version
rabbitmqadmin %%VSN%%

root@disco-rabbit:~# dpkg-query -W rabbitmq-server
rabbitmq-server 3.7.8-4ubuntu2

Alvin Joseph Tang (alvintang3) wrote :

Hi! I'd like to work on this bug. I am targeting fix for bionic.

This is my first bug and I'll give it my best. I've already created a package and able to change the version message using sed as mentioned in previous comment but the string is hard coded. How do I get the correct version of the package to use in place of %%VSN%%?

Thank you!

Changed in rabbitmq-server (Ubuntu):
assignee: nobody → Alvin Joseph Tang (alvintang3)
Bryce Harrington (bryce) wrote :

Hi Alvin, thanks for giving this issue some attention.

Often, projects will have some infrastructure in place for tracking their version. I would suggest start by reviewing their release directions, to see if they've documented where they set the number at release. Often there is a header/include file or a .in file somewhere, that gets processed and inserted where it's needed at build time. Or just do a grep through the source for %%VSN%% and see what references it.

If you don't find it quickly, let me know here or catch me on IRC and I'll help you look.

Changed in rabbitmq-server (Ubuntu Disco):
importance: Undecided → Medium
Changed in rabbitmq-server (Ubuntu Cosmic):
importance: Undecided → Medium
Changed in rabbitmq-server (Ubuntu Bionic):
importance: Undecided → Medium
Changed in rabbitmq-server (Ubuntu Disco):
status: New → Triaged
Changed in rabbitmq-server (Ubuntu Cosmic):
status: New → Triaged
Changed in rabbitmq-server (Ubuntu Bionic):
status: New → Triaged
Andreas Hasenack (ahasenack) wrote :

See where the $(PROJECT_VERSION) makefile variable is defined, as that is used in the sed to replace the %string%, and go from there.

Alvin Joseph Tang (alvintang3) wrote :

Thanks Bryce and Andreas. I have this debdiff for Bionic. I built this using pbuilder-dist and it builds successfully. I also installed and tested and it works as intended. Please let me know your thoughts.

Bryce Harrington (bryce) wrote :

Hi Alvin,

Good progress! And thanks for documenting the patch. I would suggest a few changes:

* Instead of calling it 'mypatch.diff' give it a descriptive name, like 'fix-version-string.patch'

* In the patch metadata, make sure to replace all the stuff in <angle brackets>. For example, instead of:

Description: Replace %%VSN%% in rabbitmqadmin with version number
 <long description that can span multiple lines, optional>
Author: Alvin Joseph Tang, <email address hidden>
Origin: <upstream|backport|vendor|other>, <URL, required except if Author is present>
Bug: https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/1773324
Applied-Upstream: <version|URL|commit, identifies patches merged upstream, optional>
Reviewed-by: <name and email of a reviewer, optional>
Last-Update:

You could say something like:

Description: Replace %%VSN%% in rabbitmqadmin with version number
Author: Alvin Joseph Tang, <email address hidden>
Origin: backport
Bug: https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/1773324
Applied-Upstream: 3.6.10
Reviewed-by: Bryce Harrington <email address hidden>
Last-Update: 2019-06-05

tags: added: patch

The attachment "debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

Alvin Joseph Tang (alvintang3) wrote :

Thanks for the comments Bryce! I attached here the updated patch based on your comments.

Do I also build and test for other releases tagged in this bug?

Bryce Harrington (bryce) wrote :

Hi Alvin,

Looking really good.

Sorry for the confusion with the patch name, rather than 'fix-3.6.10.patch' I think you should call it, literally, 'fix-version-string.patch' since it is fixing the version string.

You can probably omit the line "This patch header follows DEP-3: http://dep.debian.net/deps/dep3/" from the patch header.

And yes, please do build and test the other releases. Possibly the same debdiff will apply to them all but sometimes there can be small discrepancies, so is good practice to test them.

Alvin Joseph Tang (alvintang3) wrote :

Thanks for the clarification Bryce! I updated the patch attached and tested it works also in Cosmic. Disco uses version 3.7.8 and is it correct I need to create a new patch for Disco since the documentation is for a different version?

Alvin Joseph Tang (alvintang3) wrote :

Re-uploading patch v3, I just corrected the date in last updated.

Alvin Joseph Tang (alvintang3) wrote :

I created a separate debdiff for Eoan and Disco since it uses rabbitmq-server 3.7.8 already. I was able to build and test it on both Disco and Eoan.

Robie Basak (racb) on 2019-06-10
tags: added: server-next
Bryce Harrington (bryce) wrote :

Thanks Alvin, those debdiffs look good, I'll try and work on getting merge proposals put together for them today.

Bryce Harrington (bryce) on 2019-06-10
summary: - rabbitmqadmin shows %%VSN%% as version
+ [SRU] rabbitmqadmin shows %%VSN%% as version
Bryce Harrington (bryce) on 2019-06-11
description: updated
Bryce Harrington (bryce) on 2019-06-11
Changed in rabbitmq-server (Ubuntu Bionic):
assignee: nobody → Alvin Joseph Tang (alvintang3)
Changed in rabbitmq-server (Ubuntu Cosmic):
assignee: nobody → Alvin Joseph Tang (alvintang3)
Changed in rabbitmq-server (Ubuntu Disco):
assignee: nobody → Alvin Joseph Tang (alvintang3)
Alvin Joseph Tang (alvintang3) wrote :

Thanks Bryce for all the help! Do I need to do anything else or just have to wait for now?

Bryce Harrington (bryce) wrote :

Yes, next will be waiting on some reviews and approvals. When it is approved by the SRU team, they will request a test to validate the fix.

Meanwhile, if you'd like to do more, you might look at some of the other rabbitmq-server bugs, if there's any of interest you can reproduce: https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/

description: updated
Bryce Harrington (bryce) wrote :

Hi Alvin,

One question has come up in triage that perhaps you could help address:

"The file deps/rabbitmq_management/Makefile already has a Makefile target called "prepare-dist" that does this sed. Why repeat it with "all"? Was upstream approached as to why "prepare-dist" is not being called, and whether this is a good fix?"

Alvin Joseph Tang (alvintang3) wrote :

Hi Bryce,

I looked into the Makefile and it seems that prepare-dist target is used when producing the erlang plugin archives (.ez files) and not when building the package itself. Based on the build server documentation[1], all is the default target that is why I used that fix. There's a difference between the sed commands though, the fix replaces the version inline the rabbitmqadmin file itself but for prepare-dist it's generating a new file.

Sorry just to be clear, upstream is the rabbitmq-server repository itself right? I haven't approach them about this problem and whether it's a good fix. I'll do that and get back to you.

[1] https://www.rabbitmq.com/build-server.html

Bryce Harrington (bryce) wrote :

Hi Alvin, just checking in to see if you've had a chance to raise this issue with upstream? I've found it a bit confusing myself what the exact upstream package is for this, but my guess is similar people work on all the various pieces and/or can point you in the right directions.

I'm not super familiar with rabbitmq, and am curious if rabbitmq-server corresponds to an actual tarball package provided by upstream, and if so why it would come configured with %%VSN%% as the version. If it's a repackage, then perhaps the script that generates the package could do the substitution.

Alvin Joseph Tang (alvintang3) wrote :

Hi Bryce,

Please see this thread in rabbitmq-server group about my inquiry: https://groups.google.com/forum/#!topic/rabbitmq-users/KW0VdnXMS-U

I haven't had the time to replicate yet what he mentioned here but it seems that rabbitmqadmin should be enabled using rabbitmq-plugin. I think we are using the wrong file in running rabbitmqadmin as mentioned in the thread. I'm not also familiar that much with rabbitmq-server.

Bryce Harrington (bryce) wrote :

Hi Alvin, have you had a chance to test out their packaging approach yet? I'm really curious why it would work where ours doesn't, and despite digging through it this morning am still perplexed.

I dug through their packaging to try and understand why it works where ours doesn't, but didn't spot anything obvious. I verified we're using the same orig.tar.xz archive as provided by them:

  3b2e7514a016a81859443723f6be514b ../upstream/rabbitmq-server-3.6.10.tar.xz
  3b2e7514a016a81859443723f6be514b ../bionic/rabbitmq-server_3.6.10.orig.tar.xz

But we can see the %%VSN%% is not substituted in the production of these archives:

  upstream/rabbitmq-server-3.6.10$ grep -sr %%VSN *
  deps/rabbitmq_management/Makefile: $(verbose) sed 's/%%VSN%%/$(PROJECT_VERSION)/' bin/rabbitmqadmin
 deps/rabbitmq_management/bin/rabbitmqadmin:VERSION = '%%VSN%%'

You can see this is still true in the 3.7.9 package:

   https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.9/

  rabbitmq-server-3.7.9$ grep %%VSN -sr .
  ./deps/rabbitmq_management/Makefile: $(verbose) sed 's/%%VSN%%/$(PROJECT_VERSION)/' bin/rabbitmqadmin \
  ./deps/rabbitmq_management/bin/rabbitmqadmin:VERSION = '%%VSN%%'

Normally, like with C++ projects, the 'dist' target is what you run to create the release tarball, so is only pertinent to upstream and not supposed to be used for debian packaging. From the name, I would expect this same to be true with a target named 'prepare-dist' as well. Indeed, digging through their makefiles I found this comment:

  # If the application's Makefile defines a `list-dist-deps` target, we
  # use it to populate the dependencies list. This is useful when the
  # application has also a `prepare-dist` target to modify the created
  # tree before we make an archive out of it.

That makes me think that their intention is indeed that prepare-dist is intended to run *prior* to making the archive (i.e. tarball) of it. But since rabbitmqadmin still shows %%VSN%% for version in the rabbitmqadmin script from the tarball posted on rabbitmq's website, I don't know if it's just a bug in the release process, or if I've misunderstood something.

I wondered if perhaps the `rabbitmq-plugins enable rabbitmq_management` they mention does a VSN substitution, however in reviewing that code I didn't see a step that does that.

It would be useful to know if upstream intends for the rabbitmqadmin in their release tarballs to have %%VSN%% as the value for VERSION, or if that should be showing the actual version number. Assuming the former, then question #2 is whether they intend the prepare-dist target to be used in the production of the release archive (e.g. like in a traditional 'make dist'), or if that is intended to be run by the packager/user (e.g. like as part of the 'make && make install' step).

I hope what I've written is sensible.

Bryce Harrington (bryce) wrote :

I've set the merge requests to WIP, as the reviewers don't want to proceed with this as is.

They suggest if the version must be set on our end, it may be more appropriate if the substitution is done in the debian/rules file than via a patch to the upstream makefile.

Changed in rabbitmq-server (Ubuntu Bionic):
assignee: Alvin Joseph Tang (alvintang3) → nobody
Changed in rabbitmq-server (Ubuntu Cosmic):
assignee: Alvin Joseph Tang (alvintang3) → nobody
Changed in rabbitmq-server (Ubuntu Disco):
assignee: Alvin Joseph Tang (alvintang3) → nobody
Changed in rabbitmq-server (Ubuntu Eoan):
assignee: Alvin Joseph Tang (alvintang3) → nobody
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers