Bug 158364 - Crash during the execution of BASIC macro with L10N procedures on ExportToPOTFile
Summary: Crash during the execution of BASIC macro with L10N procedures on ExportToPOT...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha1+
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:24.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-24 21:59 UTC by Racho
Modified: 2023-11-26 10:56 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
TestExportToPOTFile BASIC sub (594 bytes, application/octet-stream)
2023-11-25 10:35 UTC, Racho
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Racho 2023-11-24 21:59:54 UTC
Description:
Crash during the execution of BASIC macro with L10N procedures also with the example itself from the help: https://help.libreoffice.org/24.2/pl/text/sbasic/shared/03/sf_l10n.html?&DbPAR=SHARED&System=WIN
---
System info:
Library :   ScriptForge
Service :   L10N
Method :    ExportToPOTFile

The ScriptForge library has crashed. The reason is unknown.
Maybe a bug that could be reported on
    https://bugs.documentfoundation.org/

More details : 

Location : FileSystem.OpenTextFile/1567
Wystąpił wyjątek 
Type: com.sun.star.ucb.ContentCreationException
Message: Unable to create Content for <file:///myFile.pot>: at C:/cygwin/home/tdf/jenkins/daily_workspace/tb/src_master/ucb/source/ucp/file/prov.cxx:122 at C:/cygwin/home/tdf/jenkins/daily_workspace/tb/src_master/ucbhelper/source/client/content.cxx:264.

THE EXECUTION IS CANCELLED.

Steps to Reproduce:
1. write simple basic sub with service L10N and with export to po file (exaple lines from help are enough good)
2. execute it
3. that's all

Actual Results:
THE EXECUTION IS CANCELLED.

Expected Results:
create PO file and go on macro execution


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 8566b767a24bc2c382391b6eb154f410c9f865b8
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: pl-PL (pl_PL); UI: pl-PL
Calc: threaded
Comment 1 Julien Nabet 2023-11-25 08:43:07 UTC
There are several snippets in the help page, could you attach a file with the macro so it would be quick to reproduce?
Comment 2 Racho 2023-11-25 10:35:38 UTC
Created attachment 191033 [details]
TestExportToPOTFile BASIC sub

Error reproduction macro.
Comment 3 Julien Nabet 2023-11-25 11:51:11 UTC
Thank you for the file, I could reproduce this.
Comment 4 Julien Nabet 2023-11-25 12:13:35 UTC
I debugged it and I think you should just replace:
myPO.ExportToPOTFile("myFile.pot", Header := "First line of the header\nSecond line of the header")
by:
myPO.ExportToPOTFile("c:\myFile.pot", Header := "First line of the header\nSecond line of the header")

I mean, on Linux, when putting:
myPO.ExportToPOTFile("/tmp/myFile.pot", Header := "First line of the header\nSecond line of the header")

I got a myFile.pot in /tmp containing:
#  
#  This pristine POT file has been generated by LibreOffice/ScriptForge
#  Full documentation is available on https://help.libreoffice.org/
#  
#  First line of the header
#  Second line of the header
#  
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice&bug_status=UNCONFIRMED&component=UI\n"
"POT-Creation-Date: 2023-11-25 12:59:35\n"
"PO-Revision-Date: YYYY-MM-DD HH:MM:SS\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: LibreOffice - ScriptForge\n"
"X-Accelerator-Marker: ~\n"

msgid  "This is a string to be included in a POT file"
msgstr ""

msgctxt "CTX1"
msgid  "A string with a context"
msgstr ""

#. Do not translate the word String
msgid  "Provide a String value"
msgstr ""

so perhaps not a bug after all.

Jean-Pierre: put you in cc if you got some opinion here.
Comment 5 Racho 2023-11-25 12:38:27 UTC
Yes, you are right, thx! Then bug is no in code but in help :-).

In this line of help: 

myPO.ExportToPOTFile("en-US.pot") 

should be:

myPO.ExportToPOTFile("/path-to/en-US.pot")

or something similar.

Ok, I see now that is: FileSystem.FileNaming in description, but taking the example you are confused :-)

Thank you very much and sorry for the false alarm
r :-)
Comment 6 Julien Nabet 2023-11-25 13:18:51 UTC
Thank you for the feedback Racho!


Olivier: I put you in cc of https://gerrit.libreoffice.org/c/help/+/159899
don't hesitate to comment if needed.
(I put "C:\en-US.pot" or "C:\myFile.pot" to show it requires to put the path in addition to the filename)
Comment 7 Jean-Pierre Ledure 2023-11-25 15:36:21 UTC
I confirm that the help file, i.o.
   filename: The output file in FileSystem.FileNaming notation.
should better contain sth like:
   filename: The complete output filename in FileSystem.FileNaming notation.

Thanks, Racho, for reporting the help approximate text.
Thanks, Julien, for your debugging effort.
Comment 8 Julien Nabet 2023-11-25 15:56:37 UTC
(In reply to Jean-Pierre Ledure from comment #7)
> I confirm that the help file, i.o.
>    filename: The output file in FileSystem.FileNaming notation.
> should better contain sth like:
>    filename: The complete output filename in FileSystem.FileNaming notation.
> ...
I updated the help file in https://gerrit.libreoffice.org/c/help/+/159899/4
Comment 9 Julien Nabet 2023-11-25 17:11:38 UTC
Let's put this one to NOTABUG since the help change I submitted on gerrit is just to make it clearer.
Comment 10 Commit Notification 2023-11-26 10:56:11 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/2fc5ab8916f741bfea022ccfe770ce65efb90494

Related tdf#158364: improve help for ExportToPOTFile