-
Notifications
You must be signed in to change notification settings - Fork 664
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
Unable to specify absolute path for output file. #78
Comments
I have encountered this as well. BTW, this seems to be a Windows-specific issue. Mac (and Linux, I guess) are fine. |
@Leonya Thanks - I was wondering why I wasn't able to reproduce it! 👍 |
Yeah, this version fails on Windows. I was testing to hopefully close an issue that should be fixed by this release and got super confused. I thought it was operator error. From within the ant task, I get this:
|
I don't have ready access to a Windows box these days to check this - could one of you try using the forward slashes (/) as you specify the path? I realize it's not a great solution, but I'm wondering if it's at least viable until the root cause is dug out. |
I'm using it from within Ant and on a project that has users on every platform and of every skill level, so it's not a solution for me. That said, I can test it out if that will help discover the root cause. |
@roblarsen Agreed, this isn't meant to be a solution so much as analysis. |
Several variations. All failed. Windows 8/Powershell. PS C:\Users\Rob\Documents\GitHub\html5-boilerplate\build> java -jar "tools/yuicompressor-2.4.8.jar" "C:\Users\Rob\Documents\GitHub\html5-boilerplate\js\main.js" --charset UTF-8 --type js -o "C:/Users/Rob/Documents/GitHub/html5-boilerplate/js/output.js"
C:/Users/Rob/Documents/GitHub/html5-boilerplate/js/output.js [Ljava.lang.String;@40442b95
java.io.FileNotFoundException: \Users\Rob\Documents\GitHub\html5-boilerplate\js\output.js:\Users\Rob\Documents\GitHub\ht
ml5-boilerplate\js\main.js (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
at java.io.FileOutputStream.<init>(FileOutputStream.java:104)
at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
PS C:\Users\Rob\Documents\GitHub\html5-boilerplate\build> java -jar "tools/yuicompressor-2.4.8.jar" "C:/Users/Rob/Docume
nts/GitHub/html5-boilerplate/js/main.js" --charset UTF-8 --type js -o "C:/Users/Rob/Documents/GitHub/html5-boilerplate/j
s/output.js"
C:/Users/Rob/Documents/GitHub/html5-boilerplate/js/output.js [Ljava.lang.String;@40442b95
java.io.FileNotFoundException: \Users\Rob\Documents\GitHub\html5-boilerplate\js\output.js:\Users\Rob\Documents\GitHub\ht
ml5-boilerplate\js\main.js (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
at java.io.FileOutputStream.<init>(FileOutputStream.java:104)
at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
PS C:\Users\Rob\Documents\GitHub\html5-boilerplate\build> java -jar "tools/yuicompressor-2.4.8.jar" "/Users/Rob/Document
s/GitHub/html5-boilerplate/js/main.js" --charset UTF-8 --type js -o "/Users/Rob/Documents/GitHub/html5-boilerplate/js/ou
tput.js"
/Users/Rob/Documents/GitHub/html5-boilerplate/js/output.js [Ljava.lang.String;@c324b85
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:604)
at java.util.ArrayList.get(ArrayList.java:382)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.getToken(JavaScriptCompressor.java:578)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSymbolTree(JavaScriptCompressor.java:1094)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.compress(JavaScriptCompressor.java:556)
at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:187)
... 5 more
PS C:\Users\Rob\Documents\GitHub\html5-boilerplate\build> java -jar "tools/yuicompressor-2.4.8.jar" "../js/main.js" --ch
arset UTF-8 --type js -o "../js/output.js"
../js/output.js [Ljava.lang.String;@39fc0f04
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:604)
at java.util.ArrayList.get(ArrayList.java:382)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.getToken(JavaScriptCompressor.java:578)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSymbolTree(JavaScriptCompressor.java:1094)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.compress(JavaScriptCompressor.java:556)
at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:187)
... 5 more``` |
Let me know if you need anything else. I'll take a look myself, tomorrow. Of course I can't guarantee much since I've written about 5 lines of Java ever, but at least I've got a Windows machine to test this issue against. |
The above commit fixes it. It was pure repo/diff detective work and not me actually knowing my ass from my java elbow, so I'm not sure if there's something I'm missing (there probably is 👍 ) |
@roblarsen Great find - that line will create other problems, but now I know where to go looking. Thanks - I should have something for you to test before the weekend, if you're amenable. |
Sure. Just let me know. |
I'm experiencing the same issue. All absolute paths not working, it seems to mangle the output and input paths together. It occurs to me the new pattern replacement syntax includes the colon as a separator, which is a reserved path character on windows, which is probably the root of the problem. Is there any fix yet? |
any timeline for this? |
I will be testing this patch as soon as I have restored my machine to working order, it has temporarily run out of magic smoke. Sorry for the delay. |
Same problem here. I would vote for fixing this if I could ;-) |
The problem still exists in 2.4.8 (or got back don't know). Just created a workaround for the problem: snip Too fast. The workaround does not work either :-( |
Hi guys, issue ist still persistent (after 1 1/2 year). Do you have any plans to fix this at all? Would be very sad to see Windows Support dropped which currently is the case. Thx and brgds Jan |
Brutal. |
At the end of the day this one needs some TLC from a Windows developer. I don't do development on Windows, so I don't have ready access to the only OS where this problem presents itself. If one of you has the time to put some effort into a patch, I'd invite the assistance. |
Before I move onto bolting another tool into a project I thought was stable, is there officially no longer any support for this tool for Windows? If there's no desire to support Windows you should document it as such so people aren't mislead into thinking this is a cross platform tool. |
There's plenty of desire; I would love it if YUICompressor continued to work on Windows platforms. However, I don't actively use Windows, and so it's very difficult for me to test and develop Windows specific issues. If you're a Windows developer and can provide a PR that fixes this bug without breaking anything else, I heartily welcome your participation! 👍 |
Desire is great, but as far as I can see if you can't support Windows, then the project can't support Windows. It's no longer a cross platform tool. It was fun while it lasted. |
Well, it's an open source project; the Contributor Model around which YUICompressor is shaped really doesn't call for me to be the sole developer on the project. I do understand the frustration, and wish there were more people willing to contribute code so YUICompressor could progress more rapidly - until then, I'll continue to work my best to support you guys, and contributions are ALWAYS welcome. |
I understand what you're going through. Believe me. The last thing I want to do is come on someone's repo and complain about bugs not being fixed. I've been on the other end of that enough to not want to be that guy. That said, I've got my own bugs to clear and to do so I need clarity and/or closure on this issue. Since it's going to remain open until the Java versions of Larry Bird walks through the door, I'm going to have to solve it in some other way. |
Rob. You made your point. |
Temporary fix for Windows (2.4.8) Use relative path for output
Compressed files will be in |
Unable to specify absolute path for output file yui/yuicompressor#78
There is a feature that cause this problem. "-o outfile This feature splits output path with colon and handle it like multiple input files. So C:\somename.css is split to C and \somename.css and then something wrong happen with output path (I don't know exactly what). I added condition to prevent this feature for path starting with c:\ (and also for other letters). Yeah, it is that simple. I also fixed issue #130 with 98eb2c0 no one cares and people still have those problems. 👎 |
Well, @maskamar, I care. We use a very old version of this library in our build, I attempted an upgrade, encountered this issue, and cloned the repo looking to fix the problem myself... but, of course, you already took care of it. Thank you for that! Perhaps the fix wasn't noticed because this issue was left open with no reference to your commit? Regardless, I'd be happy to help push out a new release (2.4.9?) to get your fixes and others to the community. |
@maskamar It's untrue that no one cares; however, as @labkey-adam notes, there's nothing in here that shows me your suggested fix, so I'm not sure what you would like me to do? There was a period of time where a mistake by the Yahoo folks unassigned all tickets away from me, and GitHub didn't notify me, so it took a few months for me to notice it had happened. Perhaps you sent a PR in that timeline and then retracted it or something? |
Those who are still having the same problem, seems they just download from outdated binary releases / not compile it by hand. Here to test, compiled version from OSX 10.11 & Windows 10 with Ant 1.9.4 & jdk-8u66-64 from latest commits in this repo. Once it run without this bugs, please start to replace old 2.4.8 zip released, so peoples can instantly download & run it without any problem. |
Ok so was having this same issue, have a temp solution for windows issue.... cd "%Full-path-to-output-folder%" Hopefuly this helps someone else for now. |
Just ran into this issue. These comments were helpful to me to find out why the problem exists to begin with - especially comment by maskamar on oct 31, 2015. Since the new code is not yet jar'd, I downloaded the fixed source and used ant 1.10.1 to build it. It produced version **yuicompressor-2.4.9. jar ** which I have used for a few days with no problems. The absolute path issue is gone. In my copy, I also updated the --help option under -o <file> to reflect the fact that this version does not support split filter syntax for absolute paths that start with drive name and a ":", such as C:\dir\filename.js etc. Thanks for the useful comments. BTW, the link in cecekpawon Oct 31, 2015 comment is broken. Would 2.4.9 be officially released any time soon? |
Since the last release (2.4.8) was four years ago, I wouldn't hold my breath. I don't know for sure, but I would guess that YUI Compressor is included as part of this announcement: https://yahooeng.tumblr.com/post/96098168666/important-announcement-regarding-yui Since you seem to have a working build of 2.4.9, perhaps you should fork the project and make your build more generally available. If you do so, it will probably be the most meaningful advance of YUI in years. |
@altearius
or in a single file compression scenario:
So the -s option now appears to solve the issues that were discussed on this forum. I have also added two other options:
Usage() is also updated. I have tested it on over 100 files under windows and unix shell and It is working as advertised. I am not a pro githubber and haven't done any forks here. But I have the modified sources and the new CC: @maskamar, @tml , @roblarsen , @Leonya , @labkey-adam |
can you send me the jar file? |
In 2.4.7, it was possible to specify an absolute path for the output file. Attempting to do this in 2.4.8 causes the following error:
The text was updated successfully, but these errors were encountered: