Bug 146459 - Basic: Argument is not optional (Base documenter)
Summary: Basic: Argument is not optional (Base documenter)
Status: RESOLVED NOTOURBUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.4.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: haveBacktrace
Depends on:
Blocks:
 
Reported: 2021-12-28 19:40 UTC by Julien Nabet
Modified: 2022-07-12 06:06 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
gdb bt (32.27 KB, text/plain)
2021-12-28 19:41 UTC, Julien Nabet
Details
BaseDocumenter (51.73 KB, image/png)
2021-12-28 21:02 UTC, Andreas Heinisch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Nabet 2021-12-28 19:40:10 UTC
Description:
On pc Debian x86-64 with master sources updated today (4761e11aea650dd93fbc8830ddd7c4976334105e), when using Base Documenter I got this error:
Argument is not optional

Remark: local build includes the patch d8428094c7f8b186b37c76fd7e9508a075424f80 following tdf#146281
tdf#144353, tdf#146281 - Correctly copy the information about variables
During the assignment of a variable, copy its information only if there
isn't already one present.

Steps to Reproduce:
1. Install BaseDocumenter (see https://extensions.libreoffice.org/en/extensions/show/basedocumenter-to-document-your-base-applications)
2. Open an existing odb file (embedded HSQLDB) containing a table, a form
3. Menu BaseDocumenter/New Repository
4. Menu BaseDocumenter/Document this database

Actual Results:
Popup error message "Argument is not optional" In BD_Html
230 If psTargetPage = kTableData Then

Expected Results:
no error


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 4761e11aea650dd93fbc8830ddd7c4976334105e
CPU threads: 12; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: threaded
Comment 1 Julien Nabet 2021-12-28 19:41:11 UTC
Created attachment 177178 [details]
gdb bt
Comment 2 Julien Nabet 2021-12-28 19:42:28 UTC
Andreas/Mike: thought you might be interested in this one since it concerns Basic

Jean-Pierre:  thought you might be interested in this one since it concerns BaseDocumenter
Comment 3 Andreas Heinisch 2021-12-28 21:02:42 UTC
Created attachment 177179 [details]
BaseDocumenter

Could you attach a sample document? I only get the following output with a one sample table and one sample form.
Comment 4 Mike Kaganski 2021-12-29 07:31:51 UTC
You need to define the output directory in BaseDocumenter options (it takes *much* time to show up, without any indication to user that it is busy - I first decided that it did nothing, tried again, and then closed LibreOffice, before seeing it crashed in the script because of termination of application in the middle of execution; I did not define any templates there in the options), to see the following error.
Comment 5 Mike Kaganski 2021-12-29 07:38:44 UTC
(In reply to Mike Kaganski from comment #4)

And that is the correct error (it's the bug in Basic code). The psTargetPage is an optional argument of Sub _BD_AddColumn; it is checked for IsEmpty in line 220 prior to the problematic call in line 230; and the logic of the program is strange here: it uses a separate sTargetPage, which is initialized to _BD_Target(lIndex) or to psTargetPage depending on IsMissing(psTargetPage) - why? can't just initialize psTargetPage itself to _BD_Target(lIndex) when it's missing? - but then the work continues in 230 with psTargetPage unconditionally.
Comment 6 Mike Kaganski 2021-12-29 07:39:27 UTC
(In reply to Mike Kaganski from comment #5)
> it is checked for IsEmpty in line 220

Sorry, I meant IsMissing, of course - sorry
Comment 7 Mike Kaganski 2021-12-29 09:01:32 UTC Comment hidden (off-topic)
Comment 8 Andreas Heinisch 2021-12-29 09:26:28 UTC
Thank you Mike for your assessment. Now after I could reproduce the error, it is definitely a bug in the implementation of the base documenter. Even looking at the gdb output, it shows the line where the new error arises patched in tdf#144353:

#0  SbiRuntime::StepCompare(SbxOperator) (this=0xba63890, eOp=SbxEQ) at basic/source/runtime/runtime.cxx:1351

I will close it as NOTOURBUG.
Comment 9 Mike Kaganski 2021-12-29 09:33:29 UTC
By the way, _BD_DocumentDatabase and _BD_FilePicker in the extension also have the "missing closing parenthesis" - indicated in IDE after fixing bug 80731.
Comment 10 Julien Nabet 2021-12-29 09:38:08 UTC
Thank you Mike and Andreas for your analysis.
Sorry Andreas, I don't have a document, I had just launched the extension and yes I had forgotten talking about defining "output directory". As Mike indicated in the comment 4, it's indeed quite long.
I knew there was some processing during this time because console displayed a lot of these
warn:basic.sbx:3888:3888:basic/source/sbx/sbxvalue.cxx:709: Not at Parent-Prop - otherwise CyclicRef
warn:stoc:3888:3888:stoc/source/inspect/introspection.cxx:1614: object of type "com.sun.star.beans.XIntrospectionAccess" lacks XTypeProvider

and some:
warn:toolkit.helper:3888:3888:toolkit/source/helper/unowrapper.cxx:185: UnoWrapper::SetWindowInterface: there is already a WindowPeer/ComponentInterface for this VCL window
Comment 11 Jean-Pierre Ledure 2021-12-29 11:10:30 UTC
I must confirm that it is not "OUR" bug, but, indeed, "MINE" :)

Thanks to all, and, especially, to Mike who debugged the case: the leading "p" in psTargetPage on line 230 of module BD_Html must be removed.