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

utime_failed error in Windows #106

Open
michaeldrotar opened this issue Apr 4, 2016 · 2 comments
Open

utime_failed error in Windows #106

michaeldrotar opened this issue Apr 4, 2016 · 2 comments

Comments

@michaeldrotar
Copy link

Someone on a mac just utilized this gem for our project. We really like it, but our Windows developers are hitting the following error when Rails.application.initialize! is executed

Errno::EACCES: Permission denied @ utime_failed - log/test.log
/ruby/lib/ruby/2.1.0/fileutils.rb:1163:in `utime'
/ruby/lib/ruby/2.1.0/fileutils.rb:1163:in `block in touch'
/ruby/lib/ruby/2.1.0/fileutils.rb:1160:in `each'
/ruby/lib/ruby/2.1.0/fileutils.rb:1160:in `touch'
/ruby/lib/ruby/gems/2.1.0/gems/logstasher-0.9.0/lib/logstasher.rb:218:in `new_logger'
/ruby/lib/ruby/gems/2.1.0/gems/logstasher-0.9.0/lib/logstasher.rb:103:in `setup'
/ruby/lib/ruby/gems/2.1.0/gems/logstasher-0.9.0/lib/logstasher/railtie.rb:38:in `block (2 levels) in <class:Railtie>'
/ruby/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:36:in `call'
/ruby/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/ruby/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
/ruby/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:44:in `each'
/ruby/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/ruby/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
/ruby/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
/ruby/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
/ruby/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
/ruby/lib/ruby/2.1.0/tsort.rb:345:in `each'
/ruby/lib/ruby/2.1.0/tsort.rb:345:in `call'
/ruby/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
/ruby/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
/ruby/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
/src/config/environment.rb:5:in `<top (required)>'
/ruby/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/ruby/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/ruby/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/ruby/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!'
/ruby/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/ruby/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:201:in `block in invoke_prerequisites'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:199:in `each'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:199:in `invoke_prerequisites'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:178:in `block in invoke_with_call_chain'
/ruby/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/ruby/lib/ruby/gems/2.1.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/ruby/bin/rake:23:in `load'
/ruby/bin/rake:23:in `<main>'
Tasks: TOP => db:reset => environment

I'm not sure how to file a ticket against fileutils so thought I'd start here...? We're really stuck as we can't even get the server up with this issue.

Obviously Windows doesn't have a touch command but I've seen some reports saying the method still works on Windows.

Windows 7
Ruby 2.1.5p273
Rails 4.2.6
Logstasher 0.9.0

@michaeldrotar
Copy link
Author

I should add... a team member forked the logstasher code and tried commenting out the touch line in the new_logger method and everything seems to work still. Perhaps because our log file already exists, but the comment seems to indicate the line is only there to suppress a line from the log so maybe this is a valid approach? I'm not sure of the potential repercussions here.

@levolvel
Copy link

levolvel commented Apr 5, 2016

Was able to get this working on windows by doing:

def new_logger(path)
    if path.is_a? String
      begin
        FileUtils.touch path # prevent autocreate messages in log
      rescue Errno::EACCESS
        # thrown if the os doesn't support the command
      end
    end
    Logger.new path
  end

As noted in the previous comment, I am not sure if this is a valid approach and/or if there are any repercussions of doing this.

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

No branches or pull requests

2 participants