Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test failures #811

Merged
merged 2 commits into from
May 17, 2021
Merged

Fix test failures #811

merged 2 commits into from
May 17, 2021

Conversation

nobu
Copy link
Member

@nobu nobu commented May 14, 2021

Fixes following failures:

  • NoMethodError on ruby 2.4

    https://github.com/ruby/rdoc/runs/2565344070?check_suite_focus=true#step:5:64

    Error: test_remove_unparseable_CVE_2021_31799(TestRDocRDoc): NoMethodError: undefined method `children' for Dir:Class
    /home/runner/work/rdoc/rdoc/test/rdoc/test_rdoc_rdoc.rb:467:in `block in test_remove_unparseable_CVE_2021_31799'
         464:       end
         465:
         466:       assert_equal file_list, @rdoc.remove_unparseable(file_list)
      => 467:       assert_equal file_list, Dir.children('.')
         468:     end
         469:   end
         470:
    
  • EINVAL on Windows

    https://github.com/ruby/rdoc/runs/2565343916?check_suite_focus=true#step:5:58

    Error: test_remove_unparseable_CVE_2021_31799(TestRDocRDoc): Errno::EINVAL: Invalid argument @ utime_failed - | touch evil.txt && echo tags
    D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1142:in `utime'
    D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1142:in `block in touch'
    D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1139:in `each'
    D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1139:in `touch'
    D:/a/rdoc/rdoc/test/rdoc/test_rdoc_rdoc.rb:463:in `block (2 levels) in test_remove_unparseable_CVE_2021_31799'
         460:     temp_dir do
         461:       file_list = ['| touch evil.txt && echo tags']
         462:       file_list.each do |f|
      => 463:         FileUtils.touch f
         464:       end
         465:
         466:       assert_equal file_list, @rdoc.remove_unparseable(file_list)
    

@nobu nobu changed the title Dir.children is 2.5+ Fix test failures May 14, 2021
Copy link
Contributor

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good context added in commit messages! Thanks for these, they're helpful in that they fix issues but also teach what they fix.

nobu added 2 commits May 17, 2021 19:06
RDoc seems still supporting outdated 2.4.

https://github.com/ruby/rdoc/runs/2565344070?check_suite_focus=true#step:5:64
```
Error: test_remove_unparseable_CVE_2021_31799(TestRDocRDoc): NoMethodError: undefined method `children' for Dir:Class
/home/runner/work/rdoc/rdoc/test/rdoc/test_rdoc_rdoc.rb:467:in `block in test_remove_unparseable_CVE_2021_31799'
     464:       end
     465:
     466:       assert_equal file_list, @rdoc.remove_unparseable(file_list)
  => 467:       assert_equal file_list, Dir.children('.')
     468:     end
     469:   end
     470:
```
No risk of remote code execution, when the file cannot be created.

https://github.com/ruby/rdoc/runs/2565343916?check_suite_focus=true#step:5:58
```
Error: test_remove_unparseable_CVE_2021_31799(TestRDocRDoc): Errno::EINVAL: Invalid argument @ utime_failed - | touch evil.txt && echo tags
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1142:in `utime'
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1142:in `block in touch'
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1139:in `each'
D:/rubyinstaller-head-x64/lib/ruby/3.1.0/fileutils.rb:1139:in `touch'
D:/a/rdoc/rdoc/test/rdoc/test_rdoc_rdoc.rb:463:in `block (2 levels) in test_remove_unparseable_CVE_2021_31799'
     460:     temp_dir do
     461:       file_list = ['| touch evil.txt && echo tags']
     462:       file_list.each do |f|
  => 463:         FileUtils.touch f
     464:       end
     465:
     466:       assert_equal file_list, @rdoc.remove_unparseable(file_list)
```
@nobu nobu force-pushed the fix-test branch 2 times, most recently from 05b2b6c to a7df7dc Compare May 17, 2021 10:16
@nobu nobu merged commit 88bb73d into ruby:master May 17, 2021
@nobu nobu deleted the fix-test branch May 17, 2021 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants