[Libreoffice-bugs] [Bug 96038] Shell function does not work whith .bat files and paths containing spaces

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Wed Mar 13 09:41:34 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=96038

--- Comment #10 from Roland Baudin <roland65 at free.fr> ---
Looking at the LibreOffice source code, I finally found the cause of the issue
and I attach a proposed patch to this bug report.

Here is the explanation: in the Windows version of LibreOffice, when calling
the basic Shell(...) function (located in basic/source/runtime/methods.cxx), a
function is_batch_file() is called in turn, to check if the program file path
to execute is a batch or an executable.

The function is_batch_file() is located in sal/osl/w32/procimpl.cxx and simply
checks if the file extension is equal to bat (or cmd or btm).

This works as expected, except when the file path contains space characters. In
that case, the file path is *quoted* before the call to is_batch_file() and for
a batch file the file extension becomes bat" (note the quote) instead of bat,
and thus the call to is_batch_file() wrongly returns false in that case.

I fixed this by simply adding a comparison to bat", cmd" and btm".

The proposed patch is for LibreOffice 6.2.1. I built the patched version in
Windows and checked that the issue has gone.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190313/85823807/attachment-0001.html>


More information about the Libreoffice-bugs mailing list