Jira (PUP-10797) puppet 7 gem is missing runtime dependency on scanf

20 views
Skip to first unread message

Josh Cooper (Jira)

unread,
Dec 2, 2020, 12:38:04 PM12/2/20
to puppe...@googlegroups.com
Josh Cooper created an issue
 
Puppet / Task PUP-10797
puppet 7 gem is missing runtime dependency on scanf
Issue Type: Task Task
Assignee: Unassigned
Created: 2020/12/02 9:37 AM
Priority: Normal Normal
Reporter: Josh Cooper

Ruby 2.7 removed the scanf implementation (in Kernel, IO and String) from core ruby to a separate gem. Puppet's scanf function depends on that ruby method, but only expresses the scanf runtime dependency in its Gemfile, but not in the gem that is pushed to rubygems. See https://rubygems.org/gems/puppet/versions/7.0.0.

As a result, if a module calls the puppet scanf function using puppet 7 (gem) and ruby 2.7, such as when running rspec tests, then you'll see (for example in https://github.com/puppetlabs/puppetlabs-puppetdb/pull/317)

       LoadError:
         cannot load such file -- scanf

This doesn't affect module functionality when testing or running against puppet-agent 7 packages, because the scanf gem is included.

AFAIK rubygems doesn't have a way to express conditional runtime dependencies (i.e. only add this dependency when running on ruby 2.7 and up). So the best thing may be to always add the runtime dependency for the puppet 7.x collection? If you're running the puppet 7 gem with ruby 2.5.0, then things will still work (the scanf gem is ignored).

$ rbenv shell 2.5.8
$ gem install scanf --no-document
Fetching: scanf-1.0.0.gem (100%)
Successfully installed scanf-1.0.0
1 gem installed
$ irb
irb(main):001:0> require 'scanf'
=> true
irb(main):002:0> $LOADED_FEATURES.grep /scanf/
=> ["/usr/local/Cellar/rbenv/1.1.2/versions/2.5.8/lib/ruby/2.5.0/scanf.rb"]

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Dec 2, 2020, 1:09:03 PM12/2/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 7.1.0

Josh Cooper (Jira)

unread,
Dec 2, 2020, 1:09:03 PM12/2/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Affects Version/s: PUP 7.0.0

Josh Cooper (Jira)

unread,
Dec 2, 2020, 1:09:03 PM12/2/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Dec 2, 2020, 3:06:02 PM12/2/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Dec 2, 2020, 5:17:04 PM12/2/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Dec 2, 2020, 5:18:03 PM12/2/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Platform Core KANBAN

Josh Cooper (Jira)

unread,
Dec 2, 2020, 5:18:04 PM12/2/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Dec 8, 2020, 12:38:03 PM12/8/20
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Dec 8, 2020, 12:41:04 PM12/8/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Release Notes: Bug Fix
Release Notes Summary: The puppet gem now depends on scanf which is necessary when running on ruby 2.7. This makes it possible to run module tests against the puppet gem on ruby 2.7.

Claire Cadman (Jira)

unread,
Dec 9, 2020, 11:33:03 AM12/9/20
to puppe...@googlegroups.com
Claire Cadman updated an issue
Change By: Claire Cadman
Labels: doc_reviewed platform_7.1
Reply all
Reply to author
Forward
0 new messages