Skip to content

Conversation

@b-ggs
Copy link

@b-ggs b-ggs commented Dec 22, 2019

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"]

Now, running that presents the expected output:

No pages found for topic "shell."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant