Bug 151741 - Basic Macro Organizer: Data loss when moving to a new library and renaming it (Windows-only)
Summary: Basic Macro Organizer: Data loss when moving to a new library and renaming it...
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Windows (All)
: medium major
Assignee: Andreas Heinisch
Whiteboard: target:7.6.0
Keywords: dataLoss, needUITest
Depends on:
Reported: 2022-10-24 21:49 UTC by pexu
Modified: 2023-03-17 14:24 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description pexu 2022-10-24 21:49:28 UTC

Basic Macro Organizer causes permanent data loss when a module is moved to a new library which is then subsequently renamed (without closing the dialog in between).

Steps to reproduce:

1) Open Basic Macro Organizer
2) Create a new module "MyModule"
	- Modules > New... > "MyModule" > OK
3) Close Basic Macro Organizer
	- Possibly edit contents in the macro editor and save any modifications
	- Verify that a corresponding "MyModule.xba" exists on filesystem

2) Open Basic Macro Organizer again
3) Create a new library "MyLibrary"
	- Libraries > New... > "MyLibrary > OK
4) Move "MyModule" to "MyLibrary"
	- Modules > Drag & Drop "MyModule" to "MyLibrary"
	- Note that "MyModule.xba" is no longer present on filesystem
5) Rename "MyLibrary" to "MyLibraryIsLost"
	- Libraries > Select "MyLibrary" > Press F2 (or a corresponding key to rename) > "MyLibraryIsLost" > Enter
	- Neither "MyLibrary" nor "MyLibraryIsLost" is visible in Modules anymore

At this point, it is no longer possible to recover the now lost data, even if the Basic Macro Organizer dialog is not closed.
Comment 1 Buovjaga 2023-02-28 13:45:25 UTC
I tested on Linux and Windows and could only repro on Windows. Tested on Win with latest of 7.6 bibisect repo. Already seen in 4.3.
Comment 2 pexu 2023-02-28 14:00:20 UTC
For anyone else that stumbles upon this bug, unlike I claimed in my previous comment, it is possible that not all hope is lost as many, if not all, macro blocks are stored in the compressed .pack backup files.

As I couldn't figure out how to easily to extract these (as in select a file and uncompress it), I ended up creating my own open source unpacking utility.
Comment 3 Buovjaga 2023-02-28 14:40:46 UTC
Hmm, I do notice now on Linux that I get three errors dialogs upon startup:

Error loading BASIC of document file:///home/user/.config/libreoffice/4/user/basic/Standard/script.xlb/:
General Error.
General input/output error.

Error loading BASIC of document file:///home/tonttu/.config/libreoffice/4/user/basic/Library1/script.xlb/:
General Error.
General input/output error.

Error loading BASIC of document file:///home/tonttu/.config/libreoffice/4/user/basic/Library1/dialog.xlb/:
General Error.
General input/output error.

I got out of the situation by resetting my profile.
Comment 4 Andreas Heinisch 2023-03-08 16:08:25 UTC
I can reproduce the bug even if I just rename some libraries.

Gave it a try in https://gerrit.libreoffice.org/c/core/+/148483

However, it works just if a library will get renamed AFTER a module has been created AND edited.
Comment 5 Commit Notification 2023-03-17 14:23:12 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":


tdf#151741 - BASIC Organizer: fill various URLs for libraries

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:

Affected users are encouraged to test the fix and report feedback.
Comment 6 Andreas Heinisch 2023-03-17 14:24:10 UTC
Unfortunately, my UI test does not work because the control does not give me back the focus once I changed the name of the module. 

A prototype is in: https://gerrit.libreoffice.org/c/core/+/148483/9