This fix is specifically for running um inside a Docker container.
For some reason Etc.getlogin returns nil when inside a Docker container. I'm not sure of the reason why that's so, but some light searching pointed to recommendations to use Etc.getpwuid instead of Etc.getlogin anyway. (https://www.rubydoc.info/stdlib/etc/Etc.getlogin)
Reproduction steps:
Dockerfile
FROM ruby:2.6.5-buster
RUN git clone https://github.com/sinclairtarget/um.git \
&& cd um \
&& gem build *.gemspec \
&& gem install um*.gem
CMD ["um", "list"]
Building and running that produces this output:
/usr/local/bundle/gems/um-4.2.0/lib/um/umconfig.rb:113:in `+': no implicit conversion of nil into String (TypeError)
from /usr/local/bundle/gems/um-4.2.0/lib/um/umconfig.rb:113:in `write_pages_directory'
from /usr/local/bundle/gems/um-4.2.0/lib/um/umconfig.rb:78:in `source'
from /usr/local/bundle/gems/um-4.2.0/libexec/um-list.rb:18:in `<main>'
With patch:
Dockerfile
FROM ruby:2.6.5-buster
RUN git clone --single-branch --branch b-ggs/getpwuid https://github.com/b-ggs/um.git \
&& cd um \
&& gem build *.gemspec \
&& gem install um*.gem
CMD ["um", "list"]
This fix is specifically for running
um
inside a Docker container.For some reason
Etc.getlogin
returnsnil
when inside a Docker container. I'm not sure of the reason why that's so, but some light searching pointed to recommendations to useEtc.getpwuid
instead ofEtc.getlogin
anyway. (https://www.rubydoc.info/stdlib/etc/Etc.getlogin)Reproduction steps:
Dockerfile
Building and running that produces this output:
With patch:
Dockerfile
Now, running that presents the expected output: