bugGNU gettext - Bugs: bug #59062, po.m4: LINGUAS check should...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #59062: po.m4: LINGUAS check should exclude .po files for unrelated languages

Submitter:  Arfrever <arfrever>
Submitted:  Fri 04 Sep 2020 04:52:00 AM UTC
   
 
Category:  Build Severity:  3 - Normal
Item Group:  None Status:  In Progress
Privacy:  Public Assigned to:  haible
Open/Closed:  Open

Mon 07 Sep 2020 12:36:42 PM UTC, comment #3: 

Also documentation is incomplete in:
https://www.gnu.org/software/gettext/manual/html_node/Installers.html
https://www.gnu.org/software/gettext/manual/html_node/INSTALL-Matters.html

- ISO 639 is a group of several standards. Language codes can be two-letter or three-letter. (https://en.wikipedia.org/wiki/ISO_639)
- Potential _*, .*, @* parts of names of .po files are not mentioned.
- Matching is not described.

Arfrever <arfrever>
Mon 07 Sep 2020 11:14:30 AM UTC, comment #2: 

After more testing, it appears that in both my patch and in your commit, usage of variables is inverted.

When user sets LINGUAS="... zh ..." and zh_CN.po and zh_TW.po files exist, values of variables during some iterations of those loops would be:

desiredlang="zh"
presentlang="zh_CN"

desiredlang="zh"
presentlang="zh_TW"


The current comment implies that zh is variant of zh_CN and zh_TW, but it is the other way round, i.e. zh_CN and zh_TW are variants of zh.

I will attach new patch, which fixes usage of variables.

I have now verified that e.g. setting LINGUAS="en fr ja zh" for gettext project results in:

gettext-runtime/po/Makefile:CATALOGS =  en@quot.gmo en@boldquot.gmo fr.gmo ja.gmo zh_CN.gmo zh_HK.gmo zh_TW.gmo
gettext-tools/po/Makefile:CATALOGS =  en@quot.gmo en@boldquot.gmo fr.gmo ja.gmo zh_CN.gmo zh_TW.gmo


(file #49753)

Arfrever <arfrever>
Sun 06 Sep 2020 07:32:39 PM UTC, comment #1: 

Thanks for the report.
Fixed through this commit:
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=3ab3933d54fe2ae030203658fac59c845ae554c8

I didn't take your patch, because your comment changes confused me, and the syntax character '.' needs to be considered as well.

Bruno Haible <haible>
Group administrator
Fri 04 Sep 2020 04:52:00 AM UTC, original submission:  

po.m4 contains:

          # CATALOGS depends on both $ac_dir and the user's LINGUAS
          # environment variable.
          INST_LINGUAS=
          if test -n "$ALL_LINGUAS"; then
            for presentlang in $ALL_LINGUAS; do
              useit=no
              if test "%UNSET%" != "$LINGUAS"; then
                desiredlanguages="$LINGUAS"
              else
                desiredlanguages="$ALL_LINGUAS"
              fi
              for desiredlang in $desiredlanguages; do
                # Use the presentlang catalog if desiredlang is
                #   a. equal to presentlang, or
                #   b. a variant of presentlang (because in this case,
                #      presentlang can be used as a fallback for messages
                #      which are not translated in the desiredlang catalog).
                case "$desiredlang" in
                  "$presentlang"*) useit=yes;;
                esac
              done
              if test $useit = yes; then
                INST_LINGUAS="$INST_LINGUAS $presentlang"
              fi
            done
          fi
          CATALOGS=
          if test -n "$INST_LINGUAS"; then
            for lang in $INST_LINGUAS; do
              CATALOGS="$CATALOGS $lang.gmo"
            done
          fi


This allows an xx element to match xx or xx@yy or xx_ZZ, but it also unexpectedly matches xxa.

E.g. LINGUAS="fr" currently would enable processing of fr.po, fr_FR.po (French language) and unexpectedly also frr.po (North Frisian language).

Probable fix is to change 'case' check to be:

case "$desiredlang" in
  "$presentlang"|"$presentlang"@*|"$presentlang"_*) useit=yes;;
esac


Arfrever <arfrever>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #49753:  gettext.patch added by arfrever (3KiB - text/x-patch)
file #49741:  gettext.patch added by arfrever (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by arfrever (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-04 haible StatusFixed In Progress
        Open/ClosedClosed Open
    2020-09-07 arfrever Attached File- Added gettext.patch, #49753
    2020-09-06 haible CategoryNone Build
        StatusNone Fixed
        Assigned toNone haible
        Open/ClosedOpen Closed
    2020-09-04 arfrever Attached File- Added gettext.patch, #49741

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code