[DRE-maint] Bug#857967: gitlab: postinst chokes on comments locally added to the configuration files

Andreas Beckmann anbe at debian.org
Thu Mar 16 19:21:36 UTC 2017


Package: gitlab
Version: 8.13.11+dfsg-2
Severity: serious

Hi,

the postinst uses several

  export $(cat $conffile)

constructs which are very fragile to the file content. This breaks on
comments, quoted multi-word strings, and probably many more things.

Since adding comments while making local modifications to configuration
files is quite common, an innocent change can easily break future
updates.

Here I just duplicated a line in /etc/gitlab/gitlab-debian.conf and
commented out the copy:

# DEBIAN_FRONTEND=noninteractive apt-get install gitlab --reinstall
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 6 not upgraded.
Need to get 0 B/26.4 MB of archives.
After this operation, 0 B of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 45601 files and directories currently installed.)
Preparing to unpack .../gitlab_8.13.11+dfsg-5_all.deb ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
Unpacking gitlab (8.13.11+dfsg-5) over (8.13.11+dfsg-5) ...
/var/lib/dpkg/info/gitlab.postrm: 21: export: #gitlab_yml_example: bad variable name
dpkg: warning: subprocess old post-removal script returned error exit status 2
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/postrm: 21: export: #gitlab_yml_example: bad variable name
dpkg: error processing archive /var/cache/apt/archives/gitlab_8.13.11+dfsg-5_all.deb (--unpack):
 subprocess new post-removal script returned error exit status 2
/var/lib/dpkg/tmp.ci/postrm: 21: export: #gitlab_yml_example: bad variable name
dpkg: error while cleaning up:
 subprocess new post-removal script returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/gitlab_8.13.11+dfsg-5_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


IMO, the correct solution would be
* use sourcing ('.') to load the content
* explicitly export the variables that need to be exported in the postinst


Andreas



More information about the Pkg-ruby-extras-maintainers mailing list