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

Closure compiler does not work on Windows at least if path contains UTF-8 characters #3784

Open
juj opened this issue Mar 16, 2021 · 5 comments

Comments

@juj
Copy link

juj commented Mar 16, 2021

If an input file name contains non-7bit-ASCII characters in it, Closure fails to operate.

STR:

  1. Install Closure compiler to directory "☃äö Ć € 🦠". (not mandatory, but for good measure to see if any issues arise from that)
  2. Pass an input file "☃äö Ć € 🦠.js" to Closure compiler as --externs or --js.

Results in

C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main> dir äö.js
 Volume in drive C has no label.
 Volume Serial Number is 8847-8E7D

 Directory of C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main

03/16/2021  06:18 PM             3,472 äö.js
               1 File(s)          3,472 bytes
               0 Dir(s)  1,757,394,030,592 bytes free

C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main> node_modules\.bin\google-closure-compiler --externs äö.js --js_output_file out.js --js a.js
[ '--externs', 'äö.js', '--js_output_file', 'out.js', '--js', 'a.js' ]
ERROR - [JSC_READ_ERROR] Cannot read file äö.js: äö.js

1 error(s), 0 warning(s)

C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main> node_modules\.bin\google-closure-compiler --externs a.js --js_output_file out.js --js äö.js
[ '--externs', 'a.js', '--js_output_file', 'out.js', '--js', 'äö.js' ]
ERROR - [JSC_READ_ERROR] Cannot read file äö.js: äö.js

1 error(s), 0 warning(s)
  1. Pass UTF-8 chars as output file :
C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main> node_modules\.bin\google-closure-compiler --js a.js --js_output_file äää.js
[ '--js', 'a.js', '--js_output_file', 'äää.js' ]

C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main> dir *.js
 Volume in drive C has no label.
 Volume Serial Number is 8847-8E7D

 Directory of C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main

03/16/2021  06:18 PM             3,472 a.js
03/16/2021  06:24 PM             5,595 äää.js
               2 File(s)          9,067 bytes
               0 Dir(s)  1,757,393,338,368 bytes free
@juj
Copy link
Author

juj commented Mar 16, 2021

(The [ '--externs', 'äö.js', '--js_output_file', 'out.js', '--js', 'a.js' ] print is one of my own added debug prints, trying to look if the proper path names even reach Closure, which they seem to do. Also did the test prints with simpler äö.js filename to verify the extent of the failure to do UTF-8 handling)

juj added a commit to juj/emscripten that referenced this issue Mar 16, 2021
…prevents calling Closure compiler with a cmdline that contains unicode characters.
juj added a commit to juj/emscripten that referenced this issue Mar 16, 2021
…prevents calling Closure compiler with a cmdline that contains unicode characters.
juj added a commit to emscripten-core/emscripten that referenced this issue Mar 16, 2021
* Work around Closure compiler issue google/closure-compiler#3784 that prevents calling Closure compiler with a cmdline that contains unicode characters.

* flake

* Address review

* Fix Closure removing Wasm2js temp file

* Delete modular.js temp file
@sbc100
Copy link
Contributor

sbc100 commented Aug 24, 2021

Any chance we could get a fix for this? The current workaround in emscripten is kind of horrible.

sbc100 added a commit to emscripten-core/emscripten that referenced this issue Aug 24, 2021
We rename the files we pass to closure in order to work around
google/closure-compiler#3784.

However when we do this it makes debugging difficult because the
error messages contains temp files rather than actual input files.

So, only do the renaming if actually needed.
sbc100 added a commit to emscripten-core/emscripten that referenced this issue Aug 24, 2021
We rename the files we pass to closure in order to work around
google/closure-compiler#3784.

However when we do this it makes debugging difficult because the
error messages contains temp files rather than actual input files.

So, only do the renaming if actually needed.
sbc100 added a commit to emscripten-core/emscripten that referenced this issue Aug 24, 2021
We rename the files we pass to closure in order to work around
google/closure-compiler#3784.

However when we do this it makes debugging difficult because the
error messages contains temp files rather than actual input files.

So, only do the renaming if actually needed.
sbc100 added a commit to emscripten-core/emscripten that referenced this issue Aug 24, 2021
We rename the files we pass to closure in order to work around
google/closure-compiler#3784.

However when we do this it makes debugging difficult because the
error messages contains temp files rather than actual input files.

So, only do the renaming if actually needed.
@Chris2011
Copy link

Is this related to this error, that I get for a file with a cyrillic filename?

Filename: наиывпишв.js

And here is my command: "C:\Users\Chris\.netbeans\minifierbeans\custom-packages\google-closure-compiler.cmd" "--compilation_level" "SIMPLE" "--language_in" "STABLE" "--language_out" "ECMASCRIPT_NEXT" "--js" "C:/Users/Chris/Documents/NetBeansProjects/HTML5Application/public_html/наиывпишв.js" "--js_output_file" "C:/Users/Chris/Documents/NetBeansProjects/HTML5Application/public_html/наиывпишв.min.js"

And here is the error:

Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <?> at index 71: C:/Users/Chris/Documents/NetBeansProjects/HTML5Application/public_html/?????????.js
        at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
        at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
        at java.nio.file.Path.of(Path.java:147)
        at java.nio.file.Paths.get(Paths.java:69)
        at com.google.javascript.jscomp.CommandLineRunner.findJsFiles(CommandLineRunner.java:2130)
        at com.google.javascript.jscomp.CommandLineRunner.access$000(CommandLineRunner.java:134)
        at com.google.javascript.jscomp.CommandLineRunner$Flags.getMixedJsSources(CommandLineRunner.java:1226)
        at com.google.javascript.jscomp.CommandLineRunner.initConfigFromFlags(CommandLineRunner.java:1605)
        at com.google.javascript.jscomp.CommandLineRunner.<init>(CommandLineRunner.java:1446)
        at com.google.javascript.jscomp.CommandLineRunner.main(CommandLineRunner.java:2214)

Happens in my NetBeans plugin Chris2011/minifierbeans#90

@Chris2011
Copy link

Anything new here? Still a problem in version "20211201.0.0".

@brad4d
Copy link
Contributor

brad4d commented Jan 12, 2022

I'm afraid we're just really not motivated to spend development effort on making non-ascii JS inputs work.

However, we'll be happy to review and merge a PR if someone in the community would like to create one.

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

No branches or pull requests

4 participants