Bug 152266 - A macro warning shows because of stale events assignment, but no indication in UI for that
Summary: A macro warning shows because of stale events assignment, but no indication i...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.2.7.1 release
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL: https://ask.libreoffice.org/t/macro-w...
Whiteboard: target:7.5.0 target:7.6.0 target:7.5....
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2022-11-28 12:11 UTC by Mike Kaganski
Modified: 2022-12-14 10:52 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
A sample file from ask.libeoffice.org (13.75 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-11-28 12:11 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2022-11-28 12:11:22 UTC
Created attachment 183855 [details]
A sample file from ask.libeoffice.org

Since commit b3edf85e0fe6ca03dc26e1bf531be82193bc9627 ("warn on load when a document binds an event to a macro", author Caolán McNamara, Aug 13 2019, for v.6.4, backported to 6.3.1 and 6.2.7), some documents that likely had macros assignment at some point, but then got the macros removed, started to show the "The document contains document macros" warning. But there is no indication in the UI about such a binding; saving the file keeps the binding, and so doesn't help user getting rid of the warning. Only opening the event assignment dialog, selecting the correct entry there (which doesn't show any assignment!), and pressing [Remove] button (and then saving) gets rid of that stale assignment - but that is impossible for a user to guess that this incantation would do the magic.

The attachment is from https://ask.libreoffice.org/t/macro-warning-shows-despite-no-macros-contained-in-document/84634/5, which says this:

> The OpenOffice default template I used to use several years included 21 empty
> event declarations. All documents derived from that template raise a macro
> warning in recent versions of LibreOffice although nothing points to any macro.
> Sample file ... and hundreds more attachments on forum.openoffice.org having a
> content.xml starting like this:
> 
> <office:document-content office:version="1.2">
> <office:scripts>
>     <office:event-listeners>
>         <script:event-listener script:language="ooo:script" script:event-name="office:start-app"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:close-app"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:new"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:load-finished"/>
>         <script:event-listener script:language="ooo:script" script:event-name="dom:load"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:prepare-unload"/>
>         <script:event-listener script:language="ooo:script" script:event-name="dom:unload"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:save"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:save-done"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:save-as"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:save-as-done"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:copy-to"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:copy-to-done"/>
>         <script:event-listener script:language="ooo:script" script:event-name="dom:DOMFocusIn"/>
>         <script:event-listener script:language="ooo:script" script:event-name="dom:DOMFocusOut"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:print"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:view-created"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:prepare-view-closing"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:view-close"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:modify-changed"/>
>         <script:event-listener script:language="ooo:script" script:event-name="office:visarea-changed"/>
>     </office:event-listeners>
> </office:scripts>

Opening the file, Tools->Customize->Events, and going through the event list, pressing [Remove] for each, helps getting rid of the problem.

I don't know how to create such a file from scratch.
Either this is a false positive (and this markup should be considered as no assignment, maybe even clearing the entries on round-trip), or there should be some indication in the events assignment UI, which would help the user.

Additionally it would be nice if the warning would be a bit more specific where to search, but that's indeed a different issue.
Comment 1 Caolán McNamara 2022-12-08 16:30:38 UTC
We can at least not warn if there is not macro/target associated with the event, which is the case in these examples: https://gerrit.libreoffice.org/c/core/+/143829
Comment 2 Commit Notification 2022-12-08 19:45:07 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8a33bde5288a4a652de35846aa34354044b872c3

tdf#152266 only warn about script:event-listener with non-empty targets

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 3 Commit Notification 2022-12-08 19:47:10 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/20d3af853d327ab66cf55ccdfc5991a13993c47d

Related: tdf#152266 remove office:scripts from wizard letter templates

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 4 Commit Notification 2022-12-09 12:38:38 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/83eb2796d1f4a6778d40a5e2e94c4b536163fecb

Related: tdf#152266 give feedback which events are assigned

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 5 Commit Notification 2022-12-09 13:54:40 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

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

Related: tdf#152266 add a remove all button

It will be available in 7.6.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 6 Commit Notification 2022-12-09 20:38:37 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

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

Related: tdf#152266 remove office:scripts from wizard letter templates

It will be available in 7.5.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.
Comment 7 Commit Notification 2022-12-10 10:06:35 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/99860a1fbf7017cc5efdebdf5901ef57e7c021f0

Related: tdf#152266 open 'event' page by default for SID_CONFIGEVENT

It will be available in 7.6.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 8 Commit Notification 2022-12-10 10:07:38 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/006f7d03d6f29ae2d4a751bf86f399b4cad38313

Related: tdf#152266 give feedback which events are assigned

It will be available in 7.5.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.
Comment 9 Commit Notification 2022-12-10 10:08:41 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/1c0cd3c732298f86f60479dd088f914bf1aca54a

tdf#152266 only warn about script:event-listener with non-empty targets

It will be available in 7.5.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.
Comment 10 Commit Notification 2022-12-10 11:36:49 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/406597a2dad66cdc53bb4091fc61f59a4ca85a51

Related: tdf#152266 open 'event' page by default for SID_CONFIGEVENT

It will be available in 7.5.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.
Comment 11 Commit Notification 2022-12-10 11:37:52 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/3fc3403313b53f4271079839d7fcc65db24a08b2

Related: tdf#152266 add a remove all button

It will be available in 7.5.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.
Comment 12 Commit Notification 2022-12-12 16:00:09 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6691816fe86ef7d193fee3632c2d56debfff3fa9

tdf#152266 add an infobar with indicators for macro-like content in doc

It will be available in 7.6.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 13 Commit Notification 2022-12-12 16:01:12 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/72136773c452513e49358c8b27866cb4169f86cf

tdf#152266 add an infobar with indicators for macro-like content in doc

It will be available in 7.5.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.
Comment 14 Caolán McNamara 2022-12-12 16:24:33 UTC
original trigger problem is resolved and backports in gerrit. Added an infobar which can be used to explore the things that triggered the warning, and added "remove all" to the events page.
Comment 15 Commit Notification 2022-12-14 10:52:13 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/30f13275a2e5761b0c00b3ce011ca562c952a5bf

tdf#152266 only warn about script:event-listener with non-empty targets

It will be available in 7.4.4.

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.