Project

General

Profile

Actions

Defect #35421

closed

Unhandled exception when a YAML syntax error is detected in configuration.yml

Added by Go MAEDA over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Administration
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Redmine will abort with Psych::SyntaxError during startup if a YAML syntax error in configuration.yml is detected.

/Users/somebody/.rbenv/versions/3.0.0/lib/ruby/3.0.0/psych.rb:456:in `parse': (<unknown>): did not find expected key while parsing a block mapping at line 11 column 1 (Psych::SyntaxError)
        from /Users/somebody/.rbenv/versions/3.0.0/lib/ruby/3.0.0/psych.rb:456:in `parse_stream'
        from /Users/somebody/.rbenv/versions/3.0.0/lib/ruby/3.0.0/psych.rb:390:in `parse'
        from /Users/somebody/.rbenv/versions/3.0.0/lib/ruby/3.0.0/psych.rb:280:in `load'
        from /path/to/redmine/lib/redmine/configuration.rb:95:in `load_from_yaml'
        from /path/to/redmine/lib/redmine/configuration.rb:45:in `load'
        from /path/to/redmine/lib/redmine/configuration.rb:76:in `[]'

Although the code at source:tags/4.2.1/lib/redmine/configuration.rb#L98 tries to catch the exception, the code never catches it because the rescue statement should handle Psych::SyntaxError instead of SyntaxError.

        rescue SyntaxError => e
          abort "A syntax error occurred when parsing your Redmine configuration file located at #{filename} with ERB:\n#{e.message}" 

Files

35421.patch (670 Bytes) 35421.patch Go MAEDA, 2021-06-17 07:26
35421-v2.patch (683 Bytes) 35421-v2.patch Go MAEDA, 2021-06-17 08:03
35421-v2.patch (683 Bytes) 35421-v2.patch Go MAEDA, 2021-06-22 10:56

Related issues

Related to Redmine - Defect #9748: Error about configuration.yml validness should mention file pathClosedJean-Philippe Lang

Actions
Actions

Also available in: Atom PDF