Bug 147529 - MsgBox(missingArg) incorrectly succeeds
Summary: MsgBox(missingArg) incorrectly succeeds
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
6.4.0.3 release
Hardware: All All
: medium normal
Assignee: Andreas Heinisch
URL:
Whiteboard: target:7.5.0 target:7.4.0.0.beta2
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-19 08:13 UTC by Mike Kaganski
Modified: 2022-09-17 16:08 UTC (History)
3 users (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 Mike Kaganski 2022-02-19 08:13:13 UTC
Run the following Basic routine:

Sub Test(Optional x)
  MsgBox x
End Sub

It shows "Error 448" *successful message*; while the correct behavior would be "Argument is not optional" *runtime error*.

This is similar to bug 144353.
Comment 1 raal 2022-03-06 07:48:39 UTC
repro Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: c97a3592c78ce276a353f95ce68c70a8a39174a0
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded Jumbo
Comment 2 Andreas Heinisch 2022-03-07 10:05:32 UTC
Should we fix this directly in the corresponding function (SbRtl_MsgBox) while the different parameters will be retrieved or could we set it somewhere in the retrieval process?

I doubt that MsgBox is the only function which should throw an error with a missing optional paramter.
Comment 3 Mike Kaganski 2022-03-07 10:08:08 UTC
(In reply to Andreas Heinisch from comment #2)

I suppose that we could break when a missing optional is passed as an argument which is not marked optional?
Comment 4 Mike Kaganski 2022-03-07 10:11:00 UTC
(In reply to Mike Kaganski from comment #3)

Oh, ignore me. It is not the case when we pass an argument to another user-defined function. I am not sure is we can find some generic place to handle missing optionals in run-time library functions. Do you have a proposal in mind?
Comment 5 Andreas Heinisch 2022-03-07 19:30:54 UTC
Atm, I don't know such a generic place. So we should tackle one function at a time.
Comment 6 Commit Notification 2022-06-24 07:21:40 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/522f5ad4d8c92624fffa869143aa869662a48589

tdf#147529 - BASIC MsgBox: Check for missing optional parameters

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2022-06-24 16:41:10 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/c44e819489985cbd924e58ccfc82a654c29ea6f5

tdf#147529 - BASIC MsgBox: Check for missing optional parameters

It will be available in 7.4.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.