[DRE-maint] Bug#1024143: gitlab: postinst fails silently within rake-tasks, if /var/lib/gitlab/.cache/yarn/v6 does not exist

Lars Kruse devel at sumpfralle.de
Tue Nov 15 14:15:55 GMT 2022


Package: gitlab
Version: 15.2.3+ds1-2~fto11+1
Severity: normal
Tags: patch

Dear Maintainer,

during gitlab's package installation, the following line in
`rake-tasks.sh` causes a failure of the postinst processing:

> -runuser -u ${gitlab_user} -- sh -c 'test -d "/var/lib/gitlab/.cache/yarn/v6" && find /var/lib/gitlab/.cache/yarn/v6/ -name .yarn-metadata.json -perm -a=w -exec chmod 644 {} \;'

The above fails, if the directory does not exists.
Due to the shell's exit-on-error (`set -e`), this failure is fatal.

Attached you find a patch, which ensures the proper exitcode for the
line above.

Cheers,
Lars
-------------- next part --------------
--- /usr/lib/gitlab/scripts/rake-tasks.sh.orig	2022-11-15 05:16:06.185030967 +0100
+++ /usr/lib/gitlab/scripts/rake-tasks.sh	2022-11-15 05:16:32.504552974 +0100
@@ -45,7 +45,7 @@
 runuser -u ${gitlab_user} -- sh -c 'if ! grep nodeLinker .yarnrc.yml >/dev/null; then echo "nodeLinker: \"node-modules\"" >>.yarnrc.yml; fi'
 runuser -u ${gitlab_user} -- sh -c 'yarnpkg install'
 # Remove write permissions of .yarn-metadata.json files
-runuser -u ${gitlab_user} -- sh -c 'test -d "/var/lib/gitlab/.cache/yarn/v6" && find /var/lib/gitlab/.cache/yarn/v6/ -name .yarn-metadata.json -perm -a=w -exec chmod 644 {} \;'
+runuser -u ${gitlab_user} -- sh -c 'if test -d "/var/lib/gitlab/.cache/yarn/v6"; then find /var/lib/gitlab/.cache/yarn/v6/ -name .yarn-metadata.json -perm -a=w -exec chmod 644 {} \;; fi'
 
 cd /usr/share/gitlab
 


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