Bug 57203 - Launching .vbs before LibO causes error "Unknown option: -Embedding" and command line help appears
Summary: Launching .vbs before LibO causes error "Unknown option: -Embedding" and comm...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Installation (show other bugs)
Version:
(earliest affected)
3.6.3.2 release
Hardware: All Windows (All)
: medium normal
Assignee: LeMoyne Castle
URL:
Whiteboard: target:4.1.0 target:4.0.0.1 target:3.6.5
Keywords: regression
: 57315 57328 57925 (view as bug list)
Depends on:
Blocks: mab3.6
  Show dependency treegraph
 
Reported: 2012-11-16 18:19 UTC by Marco Borra
Modified: 2013-12-29 11:16 UTC (History)
11 users (show)

See Also:
Crash report or crash signature:


Attachments
cscript error running: http://api.libreoffice.org/examples/OLE/vbscript/WriterDemo.vbs (625.28 KB, image/jpeg)
2012-11-16 18:30 UTC, Marco Borra
Details
vbs error debugging: http://api.libreoffice.org/examples/OLE/vbscript/WriterDemo.vbs (398.79 KB, image/jpeg)
2012-11-16 18:33 UTC, Marco Borra
Details
My Result with LibO 3.6.4.1 (13.07 KB, application/vnd.oasis.opendocument.text)
2012-11-19 14:56 UTC, Rainer Bielefeld Retired
Details
-embedded error (247.31 KB, image/jpeg)
2012-11-20 14:26 UTC, Domingo Sacristan
Details
com.sun.star.ServiceManager error (180.93 KB, image/jpeg)
2012-11-20 14:27 UTC, Domingo Sacristan
Details
OOO VBScript automation demonstration script (6.52 KB, text/plain)
2012-12-19 21:20 UTC, LeMoyne Castle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Borra 2012-11-16 18:19:52 UTC

    
Comment 1 Marco Borra 2012-11-16 18:30:30 UTC
Created attachment 70171 [details]
cscript error running: http://api.libreoffice.org/examples/OLE/vbscript/WriterDemo.vbs
Comment 2 Marco Borra 2012-11-16 18:33:31 UTC
Created attachment 70172 [details]
vbs error debugging: http://api.libreoffice.org/examples/OLE/vbscript/WriterDemo.vbs
Comment 3 Marco Borra 2012-11-16 18:37:02 UTC
Download: http://api.libreoffice.org/examples/OLE/vbscript/WriterDemo.vbs
Save as: C:\test.vbs
Run: cscript C:\test.vbs

See (attached) error message: 
LibreOffice 3.6
Unknown option: -Embedding
Usage: ...

OLE bridge is: 
OK in 3.6.2.2
BROKEN in 3.6.3.2, 3.6.4.1

thanks, Marco
Comment 4 chauk.mean 2012-11-19 13:51:20 UTC
I've faced exactly the same issue.
LibO 3.6.3.2 is a great release but cannot be automated by Automation compatible script languages (VBScript, Ruby, ...).
Comment 5 Rainer Bielefeld Retired 2012-11-19 14:54:52 UTC
A Crash is something critical, but not this one

To be honest, I have no skills here, but I proceeded similar to Comment 3 with "LibreOffice 3.6.4.1 rc" German UI/ German Locale [Build-ID: a9a0717] on German WIN7 Home Premium (64bit) 

0. Launch LibO
1. Download Sample from Comment 3. save as <C:\Users\user\test.vbs>
2. Start DOS window
   > command line prompt in folder C:\Users\user
3. 'cscript test.vbs' <Enter>
   New Writer document will be created in running LibO with a first text line 
   "The first line in the newly created text document." (see attachment!) 
    No Error message

Is my way completely wrong or do you have any Idea why that works for me, but not for other users?

@Marco Borra  /  chauk.mean:
Please create a bug report with complete info due to <http://wiki.documentfoundation.org/BugReport>
Is there a possibility to do the test with a server installation? That might help to find out more easy where the bug appeared
Comment 6 Rainer Bielefeld Retired 2012-11-19 14:56:22 UTC
Created attachment 70259 [details]
My Result with LibO 3.6.4.1
Comment 7 Rainer Bielefeld Retired 2012-11-19 14:56:48 UTC
Needinfo due to Comment 5
Comment 8 Domingo Sacristan 2012-11-19 16:02:53 UTC
I can confirm this issue. If no soffice process is running i cannot run libreoffice from Delphi-Pascal. I get the same error as by comment of Marco Borra

LibreOffice 3.6
Unknown option: -Embedding
Usage: ...

I can reproduce this error by open an .odt document on internet explorer:

- if activex enable
- end all open soffice processes
- try to open one odt doc
-  some time after appears the error message:

LibreOffice 3.6
Unknown option: -Embedding
Usage: ...
Comment 9 Rainer Bielefeld Retired 2012-11-19 16:23:12 UTC
Currently we need one common simple way to reproduce the problem, not lots of more without exact description. Currently this Bug is on Status "Some users have problems and they do not understand why". This should become "We have a clear and simple instruction how everybody can reproduce the problem"

So the very simple question is:
a) can you reproduce the problem with steps in comment 5?
aa) And what might be the reason that in Comment 5 no problem was visible?
b) If not, how has the proceeding to be modified to reproduce the problem?

@Domingo 
Without info concerning your experimental setup your results do not help
Comment 10 Rainer Bielefeld Retired 2012-11-19 16:24:35 UTC
Hm, I just see: without running LibO proceeding due to comment 5 Starts OOo 2.0.3 to create the document - what ever that might mean.
Comment 11 chauk.mean 2012-11-19 16:26:08 UTC
>A Crash is something critical, but not this one

I understand.
But in my case, LibreOffice is fully automated via OLE.
From this point of view, this issue is critical.
But it's OK to leave it as normal as I can downgrade to LibO 3.5.7 (see below).

>To be honest, I have no skills here, but I proceeded similar to Comment 3 with "LibreOffice 3.6.4.1 rc" German UI/ German Locale [Build-ID: a9a0717] on German WIN7 Home Premium (64bit) ...

I've tried LibreOffice 3.6.4 rc1 (2012.11.17) and I have the same issue.
My configuration : Windows XP SP3 French.

It's worth noting that LibreOffice 3.5.7 does not have this issue.
According to Marco Borra, LibreOffice 3.6.2.2 also works fine but I cannot find the download anymore.

What additional information do you need ?
Comment 12 chauk.mean 2012-11-19 16:42:53 UTC
>Hm, I just see: without running LibO proceeding due to comment 5 ...

Sorry, I missed the fact that you started LibO in your procedure.

So, if step0 is performed (LibO is started), launching the VBscript via the cscript.exe or by just double clicking on the script works.

If step0 is not performed (LibO is not started), the issue occurs.

It seems that it's now reproducible.
Thank you Domingo & Rainer.

I hope that this will be fixed for the next release.
Comment 13 Rainer Bielefeld Retired 2012-11-19 16:52:17 UTC
@chauk.mean
So may be the root is some kind of installation - registry - whatever problem?
My suspect is that if I uninstall my OOo 2.0.3 I would run into the problems you see.
Comment 14 Rainer Bielefeld Retired 2012-11-19 16:59:00 UTC
@chauk.mean
If my suspect is true that would lead debugging to a quite different direction. Unfortunately the commit that causes such a problem can't be found by bibisecting, but I hope "between LibO 3.6.2 and 3.6.3" should not have too many changes in that area.
Comment 15 Domingo Sacristan 2012-11-20 14:26:40 UTC
Created attachment 70316 [details]
-embedded error
Comment 16 Domingo Sacristan 2012-11-20 14:27:40 UTC
Created attachment 70317 [details]
com.sun.star.ServiceManager error
Comment 17 Domingo Sacristan 2012-11-20 14:40:11 UTC
Sorry i have forgotten to save the comments

You can reproduce the error if you don't launch LibO

1. Download Sample from Comment 3. save as <C:\Users\user\test.vbs>
2. Start DOS window
   > command line prompt in folder C:\Users\user
3. 'cscript test.vbs' <Enter>
Comment 18 Rainer Bielefeld Retired 2012-11-20 17:47:16 UTC
As expected I run into the problem shown in attachment " -embedded error" when I uninstall OOo 2.0.  So NEW

I doubt that the problem is LibO internal because everything works fine if LibO has been started before the script lets.

@András:
any ideas? Please set Status to ASSIGNED and add yourself to "Assigned To" if you accept this Bug or forward the Bug if it's not your turf.
Comment 19 walid 2012-11-24 05:35:48 UTC
I've faced the same issue. too

I can not Run anymore any automated script via OLE.
Comment 20 Roman Polach 2012-12-06 13:10:55 UTC
Same problem for me with (final) 3.6.4.3
(Win7 64bit)
Comment 21 Aurimas Fišeras 2012-12-08 06:47:16 UTC
I identified the commit that caused this bug: http://cgit.freedesktop.org/libreoffice/core/commit/?id=81a441c695f01bb67fcf41120d5843660d7531fc

This is how it happens:
When this line
Set objServiceManager= WScript.CreateObject("com.sun.star.ServiceManager")
of the example VBScript is invoked, Windows Scripting looks in the Windows registry, where it finds how to initiate this object:
[HKEY_CLASSES_ROOT\CLSID\{82154420-0FBF-11d4-8313-005004526AB4}\LocalServer32]
C:\Program Files\LibreOffice 3.6\program\soffice.exe --nodefault --nologo

However, when soffice.exe is finally called, its command line looks like:
"C:\Program Files\LibreOffice 3.6\program\soffice.exe" --nodefault --nologo -Embedding

Some Windows subsystem adds an additional argument "-Embedding".

And after 81a441c695f01bb67fcf41120d5843660d7531fc LibreOffice does not silently ignore "-Embedding", but fails with the error message.

One possible solution is to add this option to desktop/source/app/cmdlineargs.cxx so that it can be silently ignored again.
Comment 22 Marco Borra 2012-12-12 16:23:07 UTC
Yes. All Windows OS appends -Embedding option

Other options are:
–RegServer
–UnregServer

http://www.thrysoee.dk/InsideCOM+/ch13b.htm

Marco
Comment 23 Aurimas Fišeras 2012-12-15 13:49:10 UTC
*** Bug 57315 has been marked as a duplicate of this bug. ***
Comment 24 LeMoyne Castle 2012-12-19 21:20:32 UTC
Created attachment 71826 [details]
OOO VBScript automation demonstration script

Confirmed that error dialog giving command line argument help appears and script fails on Win7 with LibreOffice 3.6.4 installed as current version few days ago.  

Additionally, on Linux Ubuntu running from recent master 4.1, once the --invisible argument is given (i.e. ~/.../libo$ ./install/program/soffice --nologo --invisible), LibreOffice remains invisible on all future runs made (whether or not the LibreOffice process is killed in between).  Clearly, these options are saved and applied on future runs so it seems that a toggling cl arg (--visible) is needed as well.
Comment 25 LeMoyne Castle 2012-12-19 22:43:26 UTC
*** Bug 57925 has been marked as a duplicate of this bug. ***
Comment 26 LeMoyne Castle 2012-12-21 23:55:20 UTC
Could not reproduce the 'stuck invisible' problem I reported above, except in the expected case where LibO is already invisible running in the background when subsequent calls appear to have no effect.  

Found Bug 42470 which describes a similar problem in the Linux world with a Java based script dispatcher adding --nodefault and users expecting --nodefault <==> --invisible.  I note here that running LibO 3.6.3 from the command line, the --nodefault argument still produces a splash screen. 

I believe that there are now three parameters that should make LibO start invisibly ... 
1) --nodefault = start in background for Linux scripting through Java bridge 
2) -Embedded = start in background for Windows Automation (e.g. CreateObject in vbs/js) 
3) --invisible, just like it says.  
Additionally, --headless starts invisibly but should stay that way, while the scripted LibreOffice app should remain able to become visible through script action when started with --invisible, -Embedded and -nodefault. 

Upshot: -Embedded and -nodefault are needed for backwards compatibility with the previous recommendations of OOo and LibO on how to start LibreOffice in the background via scripts or other apps.
Comment 27 Not Assigned 2013-01-07 13:31:48 UTC
Aurimas Fišeras committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3616640054f4fc18c6e7307ba17e7d89a0f5ae69

fdo#57203 Unknown option: -Embedding



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 28 Not Assigned 2013-01-07 16:00:23 UTC
Aurimas Fišeras committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=abf0ed8400d7787fec906b21de74698936d40e28&h=libreoffice-4-0

fdo#57203 Unknown option: -Embedding


It will be available in LibreOffice 4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 29 Not Assigned 2013-01-07 16:07:03 UTC
Aurimas Fišeras committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=80984766863c12009415e28b7d7e8a9fe9255546&h=libreoffice-3-6

fdo#57203 Unknown option: -Embedding


It will be available in LibreOffice 3.6.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 30 Aurimas Fišeras 2013-01-10 11:03:15 UTC
I can confirm that the bug is fixed in
LibreOffice 4.0.0 RC1, Version 4.0.0.1 (Build ID: 527dba6f6e0cfbbc71bd6e7b88a52699bb48799)
Comment 31 Bill 2013-01-13 17:06:37 UTC
Embedding problem shows when using OpenLP (Church presentation software). Prevents configuring Impress with the programme. (OpenLP suggest running LibreOffice v3.5.x.x to solve problem). I run Windows XP, 7 and Linux Mint LMDE.
Comment 32 Aurimas Fišeras 2013-01-17 14:56:41 UTC
I can confirm that the bug is also fixed in
LibreOffice 3.6.5.2 (Build ID: 5b93205)
Comment 33 Bill 2013-01-18 15:05:30 UTC
Thanks
I will await this release of LibreOffice and see what happens.
 
Bill

-----Original Message-----
From: bugzilla-daemon@freedesktop.org
[mailto:bugzilla-daemon@freedesktop.org] 
Sent: 17 January 2013 14:57
To: bill.brookshaw@blueyonder.co.uk
Subject: [Bug 57203] Launching .vbs before LibO causes error "Unknown
option: -Embedding" and command line help appears





Comment # 32 <https://bugs.freedesktop.org/show_bug.cgi?id=57203#c32>  on
bug 57203 <https://bugs.freedesktop.org/show_bug.cgi?id=57203>  from "
href="mailto:aurimas@members.fsf.org">Aurimas Fišeras 
I can confirm that the bug is also fixed in

LibreOffice 3.6.5.2 (Build ID: 5b93205)



  _____  

You are receiving this mail because: 

*	You are on the CC list for the bug.
Comment 34 Aurimas Fišeras 2013-02-07 14:58:36 UTC
Fixed in both 4.0.0 and 3.5.6
Comment 35 Maxim Monastirsky 2013-12-29 11:16:33 UTC
*** Bug 57328 has been marked as a duplicate of this bug. ***