Update lib/rb-inotify/notifier.rb #22

merged 1 commit into from Dec 11, 2012


None yet
2 participants

geoffyoungs commented Dec 5, 2012

I ran into a problem caused by an oddly named directory which resulted in the inotify backend for guard reliably crashing out on a rails project.

The follow snippet demonstrates the issue:

require 'rb-inotify'
require 'fileutils'


listener = INotify::Notifier.new
listener.watch("test-1", :all_events, :recursive) do |event|
  p event

When it encounters a directory named '**', the current code (using Dir.glob) enters an infinite, recursive loop until it throws a SystemStackError, because the directory name is a self-matching glob pattern.

As the code in #watch is only using Dir.glob as a convenient way to get a path, rather than just a list of leafnames, I figure the best solution is to switch to Dir.new?

@geoffyoungs geoffyoungs Update lib/rb-inotify/notifier.rb
Avoid needing to escape glob patterns in directory names

@nex3 nex3 added a commit that referenced this pull request Dec 11, 2012

@nex3 nex3 Merge pull request #22 from geoffyoungs/patch-1
Update lib/rb-inotify/notifier.rb

@nex3 nex3 merged commit 28b1f51 into guard:master Dec 11, 2012

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