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: skip non-UTF-8 dir entries in Deno.readDir() #4004

Merged
merged 1 commit into from
Feb 15, 2020

Conversation

bnoordhuis
Copy link
Contributor

Example:

	$ python2 -c 'open("\x80\x7F", "w")'

	$ deno eval 'Deno.readDirSync(".")'
	thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', cli/ops/fs.rs:373:16
	note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
	fatal runtime error: failed to initiate panic, error 5
	Aborted (core dumped)

Before this commit they made deno panic, now they are silently skipped.
Not ideal but arguably better than panicking.

No test because what characters are and aren't allowed in filenames is
highly file system-dependent.

Closes #3950

Example:

		$ python2 -c 'open("\x80\x7F", "w")'

		$ deno eval 'Deno.readDirSync(".")'
		thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', cli/ops/fs.rs:373:16
		note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
		fatal runtime error: failed to initiate panic, error 5
		Aborted (core dumped)

Before this commit they made deno panic, now they are silently skipped.
Not ideal but arguably better than panicking.

No test because what characters are and aren't allowed in filenames is
highly file system-dependent.

Closes denoland#3950
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

LGTM - thanks Ben

@ry ry merged commit 503d8bf into denoland:master Feb 15, 2020
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

Successfully merging this pull request may close these issues.

readDir/readDirSync panics when run on a directory with non-Unicode filenames
2 participants