Whitespace in directory path causing problems on MacOS
gimsieke opened this issue · 8 comments
(related to #18)
As reported by @gsfs in #80 (comment)
George, could you be so kind as to either attach the zipped log file to this issue—not via email though, this apparently doesn’t work—or to send it to Martin and me at letexml@le-tex.de?
I got this log file by running d2t in the directory above where the .tex file was located by using the command:
$d2t 802\ Spring\ 2021/pset4newproblems.docx
I get similar problems if I go into that subdirectory and simply run:
d2t pset4newproblems.docx
Here's the log file:
pset4newproblems.d2t.log.zip
But it seems to run until the end without a severe error. Does it produce any output, that is, a .tex file?
I don’t know what to make of No such file or directory - file:/Users/gsfs/Documents/GSFS/Teaching/802%20Spring%202021/pset4newproblems.docx.tmp/word/embeddings/oleObject1.bin
. Maybe the MathType→MathML converter is expecting a file path instead of a file URI?
Can you send me the docx input? If you don’t want to attach it here publicly you can send it to letexml@le-tex.de.
I made a short test file. Here's the input, output, and log:
test.docx
test.tex.zip
test.d2t.log
I had to zip the output because drag and drop for a .tex file didn't work. The output looks OK except for the equations.
Finally, here's the output and log with the same file but in a directory without blank spaces in the name:
noblanks.tex.zip
noblanks.d2t.log
@sbulka, can you have a look at it? I reproduced the issue on Cygwin. I put test.docx into a directory C:\test dir\
and called, from the directory that I cloned docx2tex into recursively, ./d2t -d /cygdrive/c/test\ dir/test.docx
in Cygwin or cmd /c d2t.bat "c:/test dir/test.docx"
in a Windows shell.
For both invocations, I get errors such as:
Errno::ENOENT: No such file or directory - file:/C:/test%20dir/test.docx.tmp/word/embeddings/oleObject6.bin
initialize at org/jruby/RubyFile.java:368
open at org/jruby/RubyIO.java:1137
open at org/jruby/RubyKernel.java:306
initialize at uri:classloader:/ole/storage/base.rb:48
open at uri:classloader:/ole/storage/base.rb:85
read_from_file at uri:classloader:/file_parser/ole.rb:10
initialize at uri:classloader:/file_parser/ole.rb:7
set_parser at uri:classloader:/mathtype.rb:36
initialize at uri:classloader:/mathtype.rb:16
<main> at <script>:1
despite the file URIs pointing to existing files. Could it be that jruby is having problems with percent encoding in file URIs?
While you’re at it, you might want to look at this message:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.util.io.FilenoUtil (file:/C:/test%20dir/docx2tex/calabash/extensions/transpect/mathtype-extension/lib/jruby-complete-9.1.8.0.jar) to method sun.nio.ch.SelChImpl.getFD()
WARNING: Please consider reporting this to the maintainers of org.jruby.util.io.FilenoUtil
I will investigate, may take some time though.
Ok, the mathtype-extension expliticly states it only accepts file paths, no URI. I don't think we can change this easily. https://github.com/transpect/mathtype-extension#options
solution:
- on xpl step
docx2hub:mathtype2mml
, theos-path
should be used instead ofxml:base
. It is not directly available, but at least its mentioned on docx2hub debug-file00-file-uri.xml
. The change should affect lines 152,159, 450 on https://github.com/transpect/docx2hub/blob/master/xpl/mathtype2mml.xpl). - If the
os-path
cant be retained until the mathtype conversion happens, maybe thexml:base
can be decoded bytr:unescape-uri
? (https://github.com/transpect/xproc-util/blob/master/file-uri/xpl/unescape-for-os-path.xpl).
The issue also occured on a path containing '#'
for me (Windows, no cygwin). Should also be solved if the unescaped os-path
is used.
Regarding the reflection warning, I couldn't reproduce that. Maybe it's a matter of java version? Mine is:
openjdk version "16" 2021-03-16
OpenJDK Runtime Environment (build 16+36-2231)
OpenJDK 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)
Thanks for your advice. I've got the Java warning too:
unsupported Java version "15", defaulting to 1.7
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.util.io.FilenoUtil (file:/C:/cygwin64/home/kraetke/word2tex/trunk/calabash/extensions/transpect/mathtype-extension/lib/jruby
-complete-9.1.8.0.jar) to method sun.nio.ch.SelChImpl.getFD()
WARNING: Please consider reporting this to the maintainers of org.jruby.util.io.FilenoUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
My Java:
java version "15.0.2" 2021-01-19
Java(TM) SE Runtime Environment (build 15.0.2+7-27)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)
Since it's stated that the Java version "15" is unsupported, it might be sufficient to just include a more recent JRuby version?