Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix crash completing directories without read access

Tested-by: Mark Somerville <ms@pccl.info> [F17, MRI 1.9.3]
Signed-off-by: Mark Somerville <mark@scottishclimbs.com>
  • Loading branch information...
commit 6eace731868d97b9973760531c0f1e498ec0ca21 1 parent 9083221
@Spakman Spakman authored
Showing with 11 additions and 1 deletion.
  1. +1 −1  lib/rbreadline.rb
  2. +10 −0 test/test_filename_completion_proc.rb
View
2  lib/rbreadline.rb
@@ -1157,7 +1157,7 @@ def rl_filename_completion_function(text, state)
begin
@directory = Dir.new(@dirname)
- rescue Errno::ENOENT, Errno::ENOTDIR
+ rescue Errno::ENOENT, Errno::ENOTDIR, Errno::EACCES
end
# Now dequote a non-null filename.
View
10 test/test_filename_completion_proc.rb
@@ -66,4 +66,14 @@ def test_list_files_and_directories_with_spaces
def test_list_files_in_current_directory
assert_equal((Dir.entries(".") - %w( . .. )).sort, Readline::FILENAME_COMPLETION_PROC.call("").sort)
end
+
+ def test_listing_files_with_no_read_access
+ FileUtils.mkdir("test_no_access")
+ FileUtils.touch("test_no_access/123")
+ FileUtils.chmod(0333, "test_no_access")
+ assert_nil Readline::FILENAME_COMPLETION_PROC.call("test_no_access/")
+ ensure
+ FileUtils.chmod(0775, "test_no_access")
+ FileUtils.rm_r("test_no_access")
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.