test icon indicating copy to clipboard operation
test copied to clipboard

Exception not handled when input test file has illegal filename

Open yizhepku opened this issue 5 years ago • 6 comments

Running

pub run test 'This is an ***illegal*** filename'

will cause OS Error, which is unhandled.

yizhepku avatar Sep 15 '19 09:09 yizhepku

On linux I see Failed to load "This is an ***illegal*** filename": Does not exist., which seems reasonable. What output are you seeing (maybe windows is giving a different exception which isn't handled as nicely)?

jakemac53 avatar Sep 16 '19 16:09 jakemac53

Linux accepts '*' as a legal character in filename(in fact, Linux accepts almost any printable characters except the path seperator). So this problem only applies to Windows.

yizhepku avatar Sep 17 '19 01:09 yizhepku

It sounds like we probably need to handle another type of file system exception then? There is likely a try/catch already catching the file does not exist error.

jakemac53 avatar Sep 17 '19 16:09 jakemac53

Exception details below (from windows)

Exists failed, path = 'This is an ***Illegal file name** ' (OS Error: The filename, directory name, or volume label syntax is incorrect.
, errno = 123)
dart:io                                                          _Directory.existsSync
package:test_core/src/runner/reporter/compact.dart 54:53         new CompactReporter._
package:test_core/src/runner/reporter/compact.dart 104:66        CompactReporter.watch
package:test_core/src/runner/configuration/reporters.dart 41:38  _allReporters.<fn>
package:test_core/src/runner.dart 77:49                          new Runner.<fn>
dart:async                                                       runZoned
package:test_core/src/runner/configuration.dart 405:31           Configuration.asCurrent
package:test_core/src/runner.dart 73:50                          new Runner
package:test_core/src/executable.dart 148:14                     _execute
package:test_core/src/executable.dart 40:9                       main
package:test/src/executable.dart 22:9                            main

This is an unexpected error. Please file an issue at http://github.com/dart-lang/test
with the stack trace and instructions for reproducing the error.

jakemac53 avatar Sep 17 '19 16:09 jakemac53

If you are interested in contributing @YizhePKU this would be a relatively easy one, and it would be easiest for you to verify as none of us develop on windows.

Otherwise one of us can grab it when we get a chance.

jakemac53 avatar Sep 17 '19 16:09 jakemac53

See pull request #1079

yizhepku avatar Sep 18 '19 06:09 yizhepku