Project

General

Profile

Actions

Bug #36930

closed

Drop invalid test for YAML parsing

Added by Ewoud Kohl van Wijngaarden 7 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Category:
Tests
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

The test for invalid YAML in test/models/lookup_key_test.rb is {a:test}. With libyaml 0.1.x this is invalid, but with 0.2.x it is valid.

I decided to dive into the failure. As far as I can see it calls YAML.safe_load(value, permitted_classes: [Symbol]) to load the value. So some testing:

EL 8:

# rpm -qv ruby ; rpm -qv libyaml
ruby-2.5.9-111.module_el8+475+35a6c697.x86_64
libyaml-0.1.7-5.el8.x86_64
# ruby -ryaml -e 'puts YAML.safe_load("{a:test}").inspect'
Traceback (most recent call last):
    4: from -e:1:in `<main>'
    3: from /usr/share/ruby/psych.rb:314:in `safe_load'
    2: from /usr/share/ruby/psych.rb:350:in `parse'
    1: from /usr/share/ruby/psych.rb:402:in `parse_stream'
/usr/share/ruby/psych.rb:402:in `parse': (<unknown>): found unexpected ':' while scanning a plain scalar at line 1 column 2 (Psych::SyntaxError)

EL9
# rpm -qv ruby ; rpm -qv libyaml
ruby-3.0.4-160.el9.x86_64
libyaml-0.2.5-7.el9.x86_64
# ruby -ryaml -e 'puts YAML.safe_load("{a:test}").inspect'
{"a:test"=>nil}

Ubuntu 20.04
# dpkg -l | grep -E 'libruby|libyaml'
ii  libruby2.7:amd64        2.7.0-5ubuntu1.12            amd64        Libraries necessary to run Ruby 2.7
ii  libyaml-0-2:amd64       0.2.2-1                      amd64        Fast YAML 1.1 parser and emitter library
# ruby -ryaml -e 'puts YAML.safe_load("{a:test}").inspect'
{"a:test"=>nil}

Actions #1

Updated by The Foreman Bot 7 months ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ewoud Kohl van Wijngaarden
  • Pull request https://github.com/theforeman/foreman/pull/9908 added
Actions #2

Updated by The Foreman Bot 7 months ago

  • Pull request https://github.com/theforeman/foreman/pull/9900 added
Actions #3

Updated by The Foreman Bot 6 months ago

  • Fixed in Releases 3.9.0 added
Actions #4

Updated by Ewoud Kohl van Wijngaarden 6 months ago

  • Status changed from Ready For Testing to Closed
Actions #5

Updated by Oleh Fedorenko 6 months ago

  • Pull request deleted (https://github.com/theforeman/foreman/pull/9900)
Actions

Also available in: Atom PDF