UBI containers do not set sticky bit in /tmp, resulting in Ruby temp directory failures
Summary
As reported by @wchandler, UBI 8.6 has an upstream bug where the /tmp
sticky bit isn't set https://bugzilla.redhat.com/show_bug.cgi?id=2138434. This causes Ruby to fail to find a temporary directory, which can cause all sorts of mysterious failures.
This bug has shown up on our nightly builds:
$ docker run -it registry.gitlab.com/gitlab-org/build/cng/gitlab-sidekiq-ee:master-ubi8 irb
Begin parsing .erb templates from /srv/gitlab/config
Begin parsing .tpl templates from /srv/gitlab/config
irb(main):001:0> Dir.tmpdir
Traceback (most recent call last):
5: from /usr/bin/irb:23:in `<main>'
4: from /usr/bin/irb:23:in `load'
3: from /usr/lib64/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
2: from (irb):1
1: from /usr/lib64/ruby/2.7.0/tmpdir.rb:32:in `tmpdir'
ArgumentError (could not find a temporary directory)
irb(main):002:0>
Fortunately, it is NOT present in v15.5.0-ee yet:
$ docker run -it registry.gitlab.com/gitlab-org/build/cng/gitlab-sidekiq-ee:v15.5.0-ubi8 irb
DBegin parsing .erb templates from /srv/gitlab/config
Begin parsing .tpl templates from /srv/gitlab/config
irb(main):001:0> Dir.tmpdir
=> "/tmp"
Steps to reproduce
Run ls -ld /tmp
.
Working version:
[git@d02361516fe4 /]$ ls -ld /tmp
drwxrwxrwt 1 root root 4096 Oct 21 02:05 /tmp
Broken version:
-[git@844f83f4b300 /]$ ls -ld /tmp
drwxrwxrwx 1 root root 4096 Oct 29 04:42 /tmp
Workaround would be to set this bit manually as done in gitlab-org/gitaly!4994 (merged).