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

FileUtils.rm_r with secure option throws Errno::ENOTEMPTY #111

Open
mashhurs opened this issue Jun 5, 2023 · 1 comment
Open

FileUtils.rm_r with secure option throws Errno::ENOTEMPTY #111

mashhurs opened this issue Jun 5, 2023 · 1 comment

Comments

@mashhurs
Copy link

mashhurs commented Jun 5, 2023

We have been using FileUtils.rm_r with secure option (FileUtils.rm_r(path, :secure => true)) and as per documentation, FileUtils.rm_r removes the root entries recursively, removes the root at the end. However, somehow we are sometimes (now always) getting Errno::ENOTEMPTY ("Directory not empty") exception with FileUtils.rm_r on the environment: Logstash with ruby 2.6.8, Windows OS (x86_64-mswin32). When checked the directory path, there were no files found in it, means empty dir.

:backtrace=>[
	"org/jruby/RubyDir.java:471:in `rmdir'", 
	"C:/Program Files/logstash/vendor/jruby/lib/ruby/stdlib/fileutils.rb:1459:in `block in remove_dir1'", 
	"C:/Program Files/logstash/vendor/jruby/lib/ruby/stdlib/fileutils.rb:1473:in `platform_support'", 
	"C:/Program Files/logstash/vendor/jruby/lib/ruby/stdlib/fileutils.rb:1458:in `remove_dir1'", 
	"C:/Program Files/logstash/vendor/jruby/lib/ruby/stdlib/fileutils.rb:1451:in `remove'", 
	"C:/Program Files/logstash/vendor/jruby/lib/ruby/stdlib/fileutils.rb:780:in `block in remove_entry'", 
	"C:/Program Files/logstash/vendor/jruby/lib/ruby/stdlib/fileutils.rb:1508:in `postorder_traverse'", 
	"C:/Program Files/logstash/vendor/jruby/lib/ruby/stdlib/fileutils.rb:778:in `remove_entry'", 
	"C:/Program Files/logstash/vendor/jruby/lib/ruby/stdlib/fileutils.rb:698:in `remove_entry_secure'", 
	"C:/Program Files/logstash/vendor/jruby/lib/ruby/stdlib/fileutils.rb:628:in `block in rm_r'", "org/jruby/RubyArray.java:1865:in `each'", 
	"C:/Program Files/logstash/vendor/jruby/lib/ruby/stdlib/fileutils.rb:626:in `rm_r'", 
	"C:/Program Files/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-integration-aws-7.0.1/lib/logstash/outputs/s3/temporary_file.rb:54:in `delete!'", 
	"C:/Program Files/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-integration-aws-7.0.1/lib/logstash/outputs/s3.rb:383:in `clean_temporary_file'", "org/jruby/RubyMethod.java:120:in `call'", 
	"C:/Program Files/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-integration-aws-7.0.1/lib/logstash/outputs/s3/uploader.rb:60:in `upload'", 
	"C:/Program Files/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-integration-aws-7.0.1/lib/logstash/outputs/s3/uploader.rb:30:in `block in upload_async'", 
	"C:/Program Files/logstash/vendor/bundle/jruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/java_executor_service.rb:79:in `run'"]

We wonder what would be a cause.
Thanks.

@deivid-rodriguez
Copy link
Contributor

Hello!

I think you're running into the issue fixed by ec5d3b8. If you upgrade to fileutils 1.7.0 or higher, you should get a better error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants