Bug #17661

Weblate: ikiwiki should not stop completly when file is wrong

Added by hefee 2020-04-29 15:28:14 . Updated 2020-05-04 12:12:53 .

Status:
Confirmed
Priority:
Normal
Assignee:
zen
Category:
Target version:
Start date:
Due date:
% Done:

0%

Feature Branch:
Type of work:
Test
Blueprint:

Starter:
Affected tool:
Translation Platform
Deliverable for:

Description

Currently ikiwiki run fails, when there is one failed file:

weblate@translate:~/repositories/vcs/staging$ ikiwiki --setup /var/lib/weblate/config/ikiwiki.setup --rebuild
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "de_DE.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Invalid po file /tmp/ikiwiki-po-filter-in.9r75CG2SFn:
/tmp/ikiwiki-po-filter-in.9r75CG2SFn:400: 'msgid' and 'msgstr' entries do not both end with '\n'
msgfmt: found 1 fatal error

things to improve:
1. just continue with the other files
2. print the file source that is triggering that failure, so it possible to fix that file


Files

patch (1122 B) intrigeri, 2020-04-29 17:44:40

Subtasks


Related issues

Related to Tails - Bug #17560: Weblate: Make sure that the integration repo submodules are updated when they are changed in the canonical repo Confirmed

History

#1 Updated by hefee 2020-04-29 15:28:53

Let’s first make sure that is not fixed with Bug #17560

#2 Updated by hefee 2020-04-29 15:29:09

  • related to Bug #17560: Weblate: Make sure that the integration repo submodules are updated when they are changed in the canonical repo added

#3 Updated by intrigeri 2020-04-29 17:44:40

> 2. print the file source that is triggering that failure, so it possible to fix that file

Fully agreed.

That’s what the po_to_markup function in the PO plugin tries to do.
I suspect $doc->process (po4a) raises an exception, that the current code does not catch.

FWIW, the attached (untested) patch might help.

#4 Updated by hefee 2020-04-29 22:02:45

  • Status changed from New to Confirmed

@intrigeri: thanks for the patch. How does this try block improves the situation? What is “$_”?

Let’s see if the issue is fixed by merging with canonical repo and this was only an artifact.

#5 Updated by intrigeri 2020-04-30 08:22:36

(Just my 2cts. I won’t be able to work on this any further in the next weeks.)

> intrigeri: thanks for the patch. How does this try block improves the situation?

If it works, it’ll catch the exception raised by po4a and report the information you’ve requested in the error message.

> What is “$_”?

It’s the caught exception. For details, see https://metacpan.org/pod/Try::Tiny

#6 Updated by hefee 2020-05-02 16:32:48

  • Assignee set to zen

Please add this patch so we can find out where the root issue is located. As the issue is not fixed after we enabled automated merging again.

#7 Updated by hefee 2020-05-04 12:12:53

I tested the patch locally and it indeed improves the situation:

ikiwiki -setup ikiwiki.setup -refresh
refreshing wiki..
scanning index.it.po
po(po_to_markup) - index.it : Invalid po file /tmp/ikiwiki-po-filter-in.MFcvMrhDm8:
/tmp/ikiwiki-po-filter-in.MFcvMrhDm8:23: 'msgid' and 'msgstr' entries do not both end with '\n'
msgfmt: found 1 fatal error