[Bug 1974059] [NEW] hiera-eyaml fails to start

Launchpad Bug Tracker 1974059 at bugs.launchpad.net
Fri Jan 27 21:17:41 UTC 2023


You have been subscribed to a public bug by Patrik Lundin (eest):

Ever since upgrading to jammy eyaml fails completely. I thought it was
related to gpgme, ruby-gpg or my GPG keys. But then I tried in a lxc
container and it obviously doesn't work at all.

This also goes for both my laptop and my workstation after upgrading to
jammy. I used to use eyaml everyday in both hirsute and focal.

root at u1:~# eyaml edit foo.eyaml
/usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:37:in `block (2 levels) in find': undefined method `dependencies' for #<Gem::StubSpecification:0x000055b20761a738 @extension_dir=nil, @full_gem_path=nil, @gem_dir=nil, @ignored=nil, @loaded_from="/usr/lib/ruby/gems/3.0.0/specifications/default/abbrev-0.1.0.gemspec", @data=#<Gem::StubSpecification::StubLine:0x000055b2076197c0 @name="abbrev", @version=#<Gem::Version "0.1.0">, @platform="ruby", @extensions=[], @full_name="abbrev-0.1.0", @require_paths=["lib"]>, @name=nil, @spec=nil, @base_dir="/var/lib/gems/3.0.0", @gems_dir="/var/lib/gems/3.0.0/gems", @default_gem=true> (NoMethodError)
 from /usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:34:in `each'
 from /usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:34:in `block in find'
 from /usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:31:in `each'
 from /usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:31:in `find'
 from /usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/bin/eyaml:10:in `<top (required)>'
 from /usr/bin/eyaml:25:in `load'
 from /usr/bin/eyaml:25:in `<main>'
root at u1:~# history
    1  apt-get update
    2  apt-get install hiera-eyaml
    3  eyaml edit foo.eyaml
    4  history
root at u1:~#

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: hiera-eyaml 3.2.2-2
ProcVersionSignature: Ubuntu 5.15.0-30.31-generic 5.15.30
Uname: Linux 5.15.0-30-generic x86_64
ApportVersion: 2.20.11-0ubuntu82
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Wed May 18 15:59:02 2022
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=C.UTF-8
SourcePackage: hiera-eyaml
UpgradeStatus: No upgrade log present (probably fresh install)

===

SRU-formatted update (added by Patrik Lundin)

[ Impact ]

The eyaml command is unusable as it stands, running it will lead to a
backtrace.

[ Test Plan ]

Running `eyaml` will result in a backtrace:
```
$ eyaml
/usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:37:in `block (2 levels) in find': undefined method `dependencies' for #<Gem::StubSpecification:0x000055f2972067c0 @extension_dir=nil, @full_gem_path=nil, @gem_dir=nil, @ignored=nil, @loaded_from="/usr/lib/ruby/gems/3.0.0/specifications/default/abbrev-0.1.0.gemspec", @data=#<Gem::StubSpecification::StubLine:0x000055f2972057a8 @name="abbrev", @version=#<Gem::Version "0.1.0">, @platform="ruby", @extensions=[], @full_name="abbrev-0.1.0", @require_paths=["lib"]>, @name=nil, @spec=nil, @base_dir="/var/lib/gems/3.0.0", @gems_dir="/var/lib/gems/3.0.0/gems", @default_gem=true> (NoMethodError)
        from /usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:34:in `each'
        from /usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:34:in `block in find'
        from /usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:31:in `each'
        from /usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:31:in `find'
        from /usr/share/rubygems-integration/all/gems/hiera-eyaml-3.2.2/bin/eyaml:10:in `<top (required)>'
        from /usr/bin/eyaml:25:in `load'
        from /usr/bin/eyaml:25:in `<main>'
```

After installing the patched package it starts working again:
```
$ sudo dpkg -i hiera-eyaml_3.2.2-2ubuntu0.1_all.deb

$ eyaml
Unknown subcommand

Usage: eyaml <subcommand>

Please use one of the following subcommands or help for more help:
  createkeys, decrypt, edit, encrypt, recrypt, version
```

At this point the edit command reported in the original report above works
again:
```
$ eyaml createkeys
[hiera-eyaml-core] Created key directory: ./keys
[hiera-eyaml-core] Keys created OK

$ eyaml edit foo.eyaml
```

Enter some example content in the editor:
```
# | This is eyaml edit mode. This text (lines starting with # | at the top of
# | the file) will be removed when you save and exit.
# |  - To edit encrypted values, change the content of the DEC(<num>)::PKCS7[]!
# |    block.
# |    WARNING: DO NOT change the number in the parentheses.
# |  - To add a new encrypted value copy and paste a new block from the
# |    appropriate example below. Note that:
# |     * the text to encrypt goes in the square brackets
# |     * ensure you include the exclamation mark when you copy and paste
# |     * you must not include a number when adding a new block
# |    e.g. DEC::PKCS7[]!
---
foo: DEC::PKCS7[bar]!
```

On save it returns:
```
[hiera-eyaml-core] foo.eyaml doesn't exist, editing new file
```

The file now contains an encrypted value:
```
$ cat foo.eyaml
---
foo: ENC[PKCS7,MIIBeQYJKoZIhvcNAQcDoIIBajCCAWYCAQAxggEh...]
```

Re-running "eyaml edit foo.eyaml" will show the contents unencrypted
again.

[ Where problems could occur ]

The patch basically makes sure the returned spec is of the correct type and
changes it if necessary. I guess it could break if ruby objects stopped
supporting the ".respond_to?" method, but it seems unlikely since it is part of
the "default root of all Ruby objects" as defined in
https://ruby-doc.org/core-3.0.2/Object.html

** Affects: hiera-eyaml (Ubuntu)
     Importance: Undecided
         Status: Fix Released

** Affects: hiera-eyaml (Ubuntu Jammy)
     Importance: Undecided
         Status: Confirmed


** Tags: amd64 apport-bug jammy patch uec-images
-- 
hiera-eyaml fails to start
https://bugs.launchpad.net/bugs/1974059
You received this bug notification because you are a member of Ubuntu Sponsors Team, which is subscribed to the bug report.



More information about the Ubuntu-sponsors mailing list