Bug 163324 - Function Shell report an optional argument as not optional
Summary: Function Shell report an optional argument as not optional
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
24.8.2.1 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-06 13:24 UTC by Robert Großkopf
Modified: 2024-10-06 16:52 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2024-10-06 13:24:47 UTC
Up to LO 24.2. the following command runs well:

oShell = createUnoService("com.sun.star.system.SystemShellExecute")
stField = convertToUrl(home/user/myfile.png)
oShell.execute(stField,,0)

Since LO 24.8 it will execute, but an error appears: "Argument isn't optional".
The error could be suppressed by setting

oShell.execute(stField,3,0)

or some other value, but in help for LibreOffice you could still read the second argument is optional.

Have read the release notes for LO 24.8 but there is no note for this different behavior.

Bug appears in
Version: 24.8.2.1 (X86_64) / LibreOffice Community
Build ID: 0f794b6e29741098670a3b95d60478a65d05ef13
CPU threads: 6; OS: Linux 6.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded

also in Windows systems,
but not in LO 24.2.5 on this system and on Windows systems
Comment 1 Mike Kaganski 2024-10-06 14:49:19 UTC
The XSystemShellExecute::execute method documentation [1] has no mention of any "optional" argument - I write this, because your comment o shows the example of its use. But reading the bug title: it's "Function Shell report an optional argument as not optional". So the question is: what is this bug about: Shell function [2], or XSystemShellExecute::execute? And which help page is mentioned?

[1] https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1system_1_1XSystemShellExecute.html#af7a73d7840dfafddb1bfb0e10c4ec8e0
[2] https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03130500.html?DbPAR=BASIC
Comment 2 Robert Großkopf 2024-10-06 15:32:42 UTC
(In reply to Mike Kaganski from comment #1)
> So the question is: what is this bug
> about: Shell function [2]

> [2]
> https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03130500.
> html?DbPAR=BASIC

Here the content:
–––––––––––
Windowstyle

Optional integer expression that specifies the style of the window that the program is executed in.
––––––––––

All arguments except Pathname (first argument) are marked as optional. Worked this way in all versions before LO 24.8. this way.
Comment 3 Mike Kaganski 2024-10-06 15:43:52 UTC
(In reply to Robert Großkopf from comment #2)

But your comment 0 does not use Shell function at all?
Comment 4 Robert Großkopf 2024-10-06 16:22:22 UTC
(In reply to Mike Kaganski from comment #3)
> (In reply to Robert Großkopf from comment #2)
> 
> But your comment 0 does not use Shell function at all?

Indeed, I didn't recognize the difference.

So it is really 
https://bugs.documentfoundation.org/show_bug.cgi?id=162431

which is solved now and brings up all the errors here, because I have set the second parameter as nothing.

oShell.execute(stField,,0)

Have to fix many databases, which use this code…

Should we close this one as "NOTABUG"?
Comment 5 Mike Kaganski 2024-10-06 16:52:18 UTC
(In reply to Robert Großkopf from comment #4)
> Should we close this one as "NOTABUG"?

Let's do it :-)