]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext: Warn if a fallback ITS file is used
authorDaiki Ueno <ueno@gnu.org>
Sun, 10 May 2020 07:24:37 +0000 (09:24 +0200)
committerDaiki Ueno <ueno@gnu.org>
Sun, 10 May 2020 07:24:37 +0000 (09:24 +0200)
* src/xgettext.c (main): Warn if a fallback ITS file is used.
Suggested by Will Thompson in:
<https://savannah.gnu.org/bugs/?56455>.

gettext-tools/src/xgettext.c

index f5e8765c17580900394d191a86b58b3692da0641..8c6c3fbc6e5daa90e268f29b302e2c3a8edbbcae 100644 (file)
@@ -924,14 +924,21 @@ xgettext cannot work without keywords to look for"));
                         xconcatenated_filename (its_dirs[j], its_basename,
                                                 NULL);
                       struct stat statbuf;
-                      bool ok = false;
-
-                      if (stat (its_filename, &statbuf) == 0)
-                        ok = its_rule_list_add_from_file (its_rules,
-                                                          its_filename);
-                      free (its_filename);
-                      if (ok)
-                        break;
+
+                      if (stat (its_filename, &statbuf) == 0
+                          && its_rule_list_add_from_file (its_rules,
+                                                          its_filename))
+                        {
+                          /* The last element in its_dirs always points to
+                             the fallback directory.  */
+                          if (its_dirs[j + 1] == NULL)
+                            error (0, 0,
+                                   _("warning: a fallback ITS rule file '%s' is used; "
+                                     "it may not be in sync with the upstream"),
+                                   its_filename);
+                          free (its_filename);
+                          break;
+                        }
                     }
                   if (its_dirs[j] == NULL)
                     {