about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gettext
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-01-11 23:37:02 +0000
committerAlyssa Ross <hi@alyssa.is>2020-01-11 23:41:30 +0000
commit6c557e3f1c28cf87e9fba232811d6875dd1399c1 (patch)
tree035a071d5d8980df6de0fa42e2ef8fc0cce7055e /nixpkgs/pkgs/development/libraries/gettext
parentda7500bc026e937ac7fce7b50f67a0e1765737a7 (diff)
parente4134747f5666bcab8680aff67fa3b63384f9a0f (diff)
downloadnixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.gz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.bz2
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.lz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.xz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.zst
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.zip
Merge commit 'e4134747f5666bcab8680aff67fa3b63384f9a0f'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gettext')
-rw-r--r--nixpkgs/pkgs/development/libraries/gettext/CVE-2018-18751-bison.patch323
-rw-r--r--nixpkgs/pkgs/development/libraries/gettext/default.nix30
-rw-r--r--nixpkgs/pkgs/development/libraries/gettext/gettext-setup-hook.sh2
-rw-r--r--nixpkgs/pkgs/development/libraries/gettext/gettext.git-2336451ed68d91ff4b5ae1acbc1eca30e47a86a9.patch82
4 files changed, 88 insertions, 349 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gettext/CVE-2018-18751-bison.patch b/nixpkgs/pkgs/development/libraries/gettext/CVE-2018-18751-bison.patch
deleted file mode 100644
index b734c1c8b027..000000000000
--- a/nixpkgs/pkgs/development/libraries/gettext/CVE-2018-18751-bison.patch
+++ /dev/null
@@ -1,323 +0,0 @@
-This patch was generated by re-running Bison 3.0.4 on pro-gram-gen.y after
-applying CVE-2018-18751.patch. This patch removes the need to add bison to
-nativeBuildInputs.
-
---- a/gettext-tools/src/po-gram-gen.c
-+++ b/gettext-tools/src/po-gram-gen.c
-@@ -568,9 +568,9 @@ static const yytype_uint8 yytranslate[] =
- static const yytype_uint16 yyrline[] =
- {
-        0,   169,   169,   171,   172,   173,   174,   179,   187,   195,
--     216,   240,   249,   258,   269,   278,   292,   301,   315,   321,
--     332,   338,   350,   361,   372,   376,   391,   414,   422,   434,
--     442
-+     216,   237,   246,   255,   266,   275,   289,   298,   312,   318,
-+     329,   335,   347,   358,   369,   373,   388,   411,   419,   431,
-+     439
- };
- #endif
-
-@@ -1419,14 +1419,11 @@ yyreduce:
-                   check_obsolete ((yyvsp[-3].message_intro), (yyvsp[-1].string));
-                   check_obsolete ((yyvsp[-3].message_intro), (yyvsp[0].rhs));
-                   if (!(yyvsp[-3].message_intro).obsolete || pass_obsolete_entries)
--                    {
--                      do_callback_message ((yyvsp[-3].message_intro).ctxt, string2, &(yyvsp[-3].message_intro).pos, (yyvsp[-1].string).string,
--                                           (yyvsp[0].rhs).rhs.msgstr, (yyvsp[0].rhs).rhs.msgstr_len, &(yyvsp[0].rhs).pos,
--                                           (yyvsp[-3].message_intro).prev_ctxt,
--                                           (yyvsp[-3].message_intro).prev_id, (yyvsp[-3].message_intro).prev_id_plural,
--                                           (yyvsp[-3].message_intro).obsolete);
--                      free ((yyvsp[-1].string).string);
--                    }
-+                    do_callback_message ((yyvsp[-3].message_intro).ctxt, string2, &(yyvsp[-3].message_intro).pos, (yyvsp[-1].string).string,
-+                                         (yyvsp[0].rhs).rhs.msgstr, (yyvsp[0].rhs).rhs.msgstr_len, &(yyvsp[0].rhs).pos,
-+                                         (yyvsp[-3].message_intro).prev_ctxt,
-+                                         (yyvsp[-3].message_intro).prev_id, (yyvsp[-3].message_intro).prev_id_plural,
-+                                         (yyvsp[-3].message_intro).obsolete);
-                   else
-                     {
-                       free_message_intro ((yyvsp[-3].message_intro));
-@@ -1435,11 +1432,11 @@ yyreduce:
-                       free ((yyvsp[0].rhs).rhs.msgstr);
-                     }
-                 }
--#line 1439 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1436 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 11:
--#line 241 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 238 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-2].message_intro), (yyvsp[-1].stringlist));
-                   check_obsolete ((yyvsp[-2].message_intro), (yyvsp[0].string));
-@@ -1448,11 +1445,11 @@ yyreduce:
-                   string_list_destroy (&(yyvsp[-1].stringlist).stringlist);
-                   free ((yyvsp[0].string).string);
-                 }
--#line 1452 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1449 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 12:
--#line 250 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 247 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-2].message_intro), (yyvsp[-1].stringlist));
-                   check_obsolete ((yyvsp[-2].message_intro), (yyvsp[0].rhs));
-@@ -1461,22 +1458,22 @@ yyreduce:
-                   string_list_destroy (&(yyvsp[-1].stringlist).stringlist);
-                   free ((yyvsp[0].rhs).rhs.msgstr);
-                 }
--#line 1465 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1462 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 13:
--#line 259 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 256 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-1].message_intro), (yyvsp[0].stringlist));
-                   po_gram_error_at_line (&(yyvsp[-1].message_intro).pos, _("missing 'msgstr' section"));
-                   free_message_intro ((yyvsp[-1].message_intro));
-                   string_list_destroy (&(yyvsp[0].stringlist).stringlist);
-                 }
--#line 1476 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1473 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 14:
--#line 270 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 267 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   (yyval.message_intro).prev_ctxt = NULL;
-                   (yyval.message_intro).prev_id = NULL;
-@@ -1485,11 +1482,11 @@ yyreduce:
-                   (yyval.message_intro).pos = (yyvsp[0].string).pos;
-                   (yyval.message_intro).obsolete = (yyvsp[0].string).obsolete;
-                 }
--#line 1489 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1486 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 15:
--#line 279 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 276 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-1].prev), (yyvsp[0].string));
-                   (yyval.message_intro).prev_ctxt = (yyvsp[-1].prev).ctxt;
-@@ -1499,11 +1496,11 @@ yyreduce:
-                   (yyval.message_intro).pos = (yyvsp[0].string).pos;
-                   (yyval.message_intro).obsolete = (yyvsp[0].string).obsolete;
-                 }
--#line 1503 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1500 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 16:
--#line 293 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 290 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-1].string), (yyvsp[0].stringlist));
-                   (yyval.prev).ctxt = (yyvsp[-1].string).string;
-@@ -1512,11 +1509,11 @@ yyreduce:
-                   (yyval.prev).pos = (yyvsp[-1].string).pos;
-                   (yyval.prev).obsolete = (yyvsp[-1].string).obsolete;
-                 }
--#line 1516 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1513 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 17:
--#line 302 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 299 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-2].string), (yyvsp[-1].stringlist));
-                   check_obsolete ((yyvsp[-2].string), (yyvsp[0].string));
-@@ -1526,21 +1523,21 @@ yyreduce:
-                   (yyval.prev).pos = (yyvsp[-2].string).pos;
-                   (yyval.prev).obsolete = (yyvsp[-2].string).obsolete;
-                 }
--#line 1530 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1527 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 18:
--#line 316 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 313 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   (yyval.string).string = NULL;
-                   (yyval.string).pos = (yyvsp[0].pos).pos;
-                   (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
-                 }
--#line 1540 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1537 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 19:
--#line 322 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 319 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-2].pos), (yyvsp[-1].stringlist));
-                   check_obsolete ((yyvsp[-2].pos), (yyvsp[0].pos));
-@@ -1548,21 +1545,21 @@ yyreduce:
-                   (yyval.string).pos = (yyvsp[0].pos).pos;
-                   (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
-                 }
--#line 1552 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1549 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 20:
--#line 333 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 330 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   (yyval.string).string = NULL;
-                   (yyval.string).pos = (yyvsp[0].pos).pos;
-                   (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
-                 }
--#line 1562 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1559 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 21:
--#line 339 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 336 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-2].pos), (yyvsp[-1].stringlist));
-                   check_obsolete ((yyvsp[-2].pos), (yyvsp[0].pos));
-@@ -1570,11 +1567,11 @@ yyreduce:
-                   (yyval.string).pos = (yyvsp[0].pos).pos;
-                   (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
-                 }
--#line 1574 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1571 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 22:
--#line 351 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 348 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-1].pos), (yyvsp[0].stringlist));
-                   plural_counter = 0;
-@@ -1582,30 +1579,30 @@ yyreduce:
-                   (yyval.string).pos = (yyvsp[-1].pos).pos;
-                   (yyval.string).obsolete = (yyvsp[-1].pos).obsolete;
-                 }
--#line 1586 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1583 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 23:
--#line 362 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 359 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-1].pos), (yyvsp[0].stringlist));
-                   (yyval.string).string = string_list_concat_destroy (&(yyvsp[0].stringlist).stringlist);
-                   (yyval.string).pos = (yyvsp[-1].pos).pos;
-                   (yyval.string).obsolete = (yyvsp[-1].pos).obsolete;
-                 }
--#line 1597 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1594 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 24:
--#line 373 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 370 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   (yyval.rhs) = (yyvsp[0].rhs);
-                 }
--#line 1605 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1602 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 25:
--#line 377 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 374 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-1].rhs), (yyvsp[0].rhs));
-                   (yyval.rhs).rhs.msgstr = XNMALLOC ((yyvsp[-1].rhs).rhs.msgstr_len + (yyvsp[0].rhs).rhs.msgstr_len, char);
-@@ -1617,11 +1614,11 @@ yyreduce:
-                   (yyval.rhs).pos = (yyvsp[-1].rhs).pos;
-                   (yyval.rhs).obsolete = (yyvsp[-1].rhs).obsolete;
-                 }
--#line 1621 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1618 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 26:
--#line 392 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 389 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-4].pos), (yyvsp[-3].pos));
-                   check_obsolete ((yyvsp[-4].pos), (yyvsp[-2].number));
-@@ -1640,11 +1637,11 @@ yyreduce:
-                   (yyval.rhs).pos = (yyvsp[-4].pos).pos;
-                   (yyval.rhs).obsolete = (yyvsp[-4].pos).obsolete;
-                 }
--#line 1644 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1641 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 27:
--#line 415 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 412 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   string_list_init (&(yyval.stringlist).stringlist);
-                   string_list_append (&(yyval.stringlist).stringlist, (yyvsp[0].string).string);
-@@ -1652,11 +1649,11 @@ yyreduce:
-                   (yyval.stringlist).pos = (yyvsp[0].string).pos;
-                   (yyval.stringlist).obsolete = (yyvsp[0].string).obsolete;
-                 }
--#line 1656 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1653 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 28:
--#line 423 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 420 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-1].stringlist), (yyvsp[0].string));
-                   (yyval.stringlist).stringlist = (yyvsp[-1].stringlist).stringlist;
-@@ -1665,11 +1662,11 @@ yyreduce:
-                   (yyval.stringlist).pos = (yyvsp[-1].stringlist).pos;
-                   (yyval.stringlist).obsolete = (yyvsp[-1].stringlist).obsolete;
-                 }
--#line 1669 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1666 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 29:
--#line 435 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 432 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   string_list_init (&(yyval.stringlist).stringlist);
-                   string_list_append (&(yyval.stringlist).stringlist, (yyvsp[0].string).string);
-@@ -1677,11 +1674,11 @@ yyreduce:
-                   (yyval.stringlist).pos = (yyvsp[0].string).pos;
-                   (yyval.stringlist).obsolete = (yyvsp[0].string).obsolete;
-                 }
--#line 1681 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1678 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-   case 30:
--#line 443 "po-gram-gen.y" /* yacc.c:1646  */
-+#line 440 "po-gram-gen.y" /* yacc.c:1646  */
-     {
-                   check_obsolete ((yyvsp[-1].stringlist), (yyvsp[0].string));
-                   (yyval.stringlist).stringlist = (yyvsp[-1].stringlist).stringlist;
-@@ -1690,11 +1687,11 @@ yyreduce:
-                   (yyval.stringlist).pos = (yyvsp[-1].stringlist).pos;
-                   (yyval.stringlist).obsolete = (yyvsp[-1].stringlist).obsolete;
-                 }
--#line 1694 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1691 "po-gram-gen.c" /* yacc.c:1646  */
-     break;
-
-
--#line 1698 "po-gram-gen.c" /* yacc.c:1646  */
-+#line 1695 "po-gram-gen.c" /* yacc.c:1646  */
-       default: break;
-     }
-   /* User semantic actions sometimes alter yychar, and that requires
diff --git a/nixpkgs/pkgs/development/libraries/gettext/default.nix b/nixpkgs/pkgs/development/libraries/gettext/default.nix
index 9547c6c31ada..c2165a9d9c7a 100644
--- a/nixpkgs/pkgs/development/libraries/gettext/default.nix
+++ b/nixpkgs/pkgs/development/libraries/gettext/default.nix
@@ -1,24 +1,16 @@
-{ stdenv, lib, fetchurl, libiconv, xz, bison, automake115x, autoconf }:
+{ stdenv, lib, fetchurl, libiconv, xz }:
 
-let allowBisonDependency = !stdenv.isDarwin; in
 stdenv.mkDerivation rec {
   pname = "gettext";
-  version = "0.19.8.1";
+  version = "0.20.1";
 
   src = fetchurl {
     url = "mirror://gnu/gettext/${pname}-${version}.tar.gz";
-    sha256 = "0hsw28f9q9xaggjlsdp2qmbp2rbd1mp0njzan2ld9kiqwkq2m57z";
+    sha256 = "0p3zwkk27wm2m2ccfqm57nj7vqkmfpn7ja1nf65zmhz8qqs5chb6";
   };
   patches = [
     ./absolute-paths.diff
-    (fetchurl {
-      name = "CVE-2018-18751.patch";
-      url = "https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=patch;h=dce3a16e5e9368245735e29bf498dcd5e3e474a4";
-      sha256 = "1lpjwwcjr1sb879faj0xyzw02kma0ivab6xwn3qciy13qy6fq5xn";
-    })
-  ] ++ lib.optionals (!allowBisonDependency) [
-    # Only necessary for CVE-2018-18751.patch:
-    ./CVE-2018-18751-bison.patch
+    ./gettext.git-2336451ed68d91ff4b5ae1acbc1eca30e47a86a9.patch
   ];
 
   outputs = [ "out" "man" "doc" "info" ];
@@ -29,10 +21,6 @@ stdenv.mkDerivation rec {
 
   configureFlags = [
      "--disable-csharp" "--with-xz"
-     # avoid retaining reference to CF during stdenv bootstrap
-  ] ++ lib.optionals stdenv.isDarwin [
-    "gt_cv_func_CFPreferencesCopyAppValue=no"
-    "gt_cv_func_CFLocaleCopyCurrent=no"
   ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     # On cross building, gettext supposes that the wchar.h from libc
     # does not fulfill gettext needs, so it tries to work with its
@@ -54,14 +42,6 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     xz
     xz.bin
-  ]
-  # Only necessary for CVE-2018-18751.patch (unless CVE-2018-18751-bison.patch
-  # is also applied):
-  ++ lib.optional allowBisonDependency bison
-  ++ [
-    # Only necessary for CVE-2018-18751.patch:
-    automake115x
-    autoconf
   ];
   # HACK, see #10874 (and 14664)
   buildInputs = stdenv.lib.optional (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) libiconv;
@@ -106,5 +86,5 @@ stdenv.mkDerivation rec {
 }
 
 // stdenv.lib.optionalAttrs stdenv.isDarwin {
-  makeFlags = "CFLAGS=-D_FORTIFY_SOURCE=0";
+  makeFlags = [ "CFLAGS=-D_FORTIFY_SOURCE=0" ];
 }
diff --git a/nixpkgs/pkgs/development/libraries/gettext/gettext-setup-hook.sh b/nixpkgs/pkgs/development/libraries/gettext/gettext-setup-hook.sh
index ad3763c29b64..69020146f84d 100644
--- a/nixpkgs/pkgs/development/libraries/gettext/gettext-setup-hook.sh
+++ b/nixpkgs/pkgs/development/libraries/gettext/gettext-setup-hook.sh
@@ -10,7 +10,7 @@ addEnvHooks "$hostOffset" gettextDataDirsHook
 
 # libintl must be listed in load flags on non-Glibc
 # it doesn't hurt to have it in Glibc either though
-if [ -n "@gettextNeedsLdflags@" -a -z "$dontAddExtraLibs" ]; then
+if [ -n "@gettextNeedsLdflags@" -a -z "${dontAddExtraLibs-}" ]; then
     # See pkgs/build-support/setup-hooks/role.bash
     getHostRole
     export NIX_${role_pre}LDFLAGS+=" -lintl"
diff --git a/nixpkgs/pkgs/development/libraries/gettext/gettext.git-2336451ed68d91ff4b5ae1acbc1eca30e47a86a9.patch b/nixpkgs/pkgs/development/libraries/gettext/gettext.git-2336451ed68d91ff4b5ae1acbc1eca30e47a86a9.patch
new file mode 100644
index 000000000000..4a19b11507ac
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gettext/gettext.git-2336451ed68d91ff4b5ae1acbc1eca30e47a86a9.patch
@@ -0,0 +1,82 @@
+From 2336451ed68d91ff4b5ae1acbc1eca30e47a86a9 Mon Sep 17 00:00:00 2001
+From: Bruno Haible <bruno@clisp.org>
+Date: Sun, 19 May 2019 13:10:06 +0200
+Subject: [PATCH] msgmerge: Fix behaviour of --for-msgfmt on PO files with no
+ translations.
+
+Reported by Don Lawrence <dlawrence@iecok.com>
+in <https://lists.freedesktop.org/archives/p11-glue/2019-May/000700.html>
+via Daiki Ueno
+in <https://lists.gnu.org/archive/html/bug-gettext/2019-05/msg00124.html>.
+
+* gettext-tools/src/msgmerge.c (main): Treat force_po like true if for_msgfmt
+is true.
+* gettext-tools/tests/msgmerge-26: Add test of PO file with no translations.
+---
+ gettext-tools/src/msgmerge.c    |  4 ++--
+ gettext-tools/tests/msgmerge-26 | 36 +++++++++++++++++++++++++++++++++---
+ 2 files changed, 35 insertions(+), 5 deletions(-)
+
+diff --git a/gettext-tools/src/msgmerge.c b/gettext-tools/src/msgmerge.c
+index cd762c0..92c9b7a 100644
+--- a/gettext-tools/src/msgmerge.c
++++ b/gettext-tools/src/msgmerge.c
+@@ -520,8 +520,8 @@ There is NO WARRANTY, to the extent permitted by law.\n\
+   else
+     {
+       /* Write the merged message list out.  */
+-      msgdomain_list_print (result, output_file, output_syntax, force_po,
+-                            false);
++      msgdomain_list_print (result, output_file, output_syntax,
++                            for_msgfmt || force_po, false);
+     }
+ 
+   exit (EXIT_SUCCESS);
+diff --git a/gettext-tools/tests/msgmerge-26 b/gettext-tools/tests/msgmerge-26
+index cd3862e..b86f7a0 100755
+--- a/gettext-tools/tests/msgmerge-26
++++ b/gettext-tools/tests/msgmerge-26
+@@ -73,7 +73,37 @@ msgstr "Papaya"
+ EOF
+ 
+ : ${DIFF=diff}
+-${DIFF} mm-test26.ok mm-test26.out
+-result=$?
++${DIFF} mm-test26.ok mm-test26.out || Exit 1
+ 
+-exit $result
++# Test with a PO file that has no translated messages.
++
++cat <<\EOF > mm-test26a.in1
++msgid ""
++msgstr ""
++"Content-Type: text/plain; charset=UTF-8\n"
++
++msgid "Hello world"
++msgstr "Hallo Welt"
++EOF
++
++cat <<\EOF > mm-test26a.in2
++msgid ""
++msgstr ""
++"Content-Type: text/plain; charset=ASCII\n"
++
++msgid "Hello, world!"
++msgstr ""
++EOF
++
++: ${MSGMERGE=msgmerge}
++${MSGMERGE} --for-msgfmt -o mm-test26a.tmp mm-test26a.in1 mm-test26a.in2 \
++    || Exit 1
++LC_ALL=C tr -d '\r' < mm-test26a.tmp > mm-test26a.out || Exit 1
++
++cat <<\EOF > mm-test26a.ok
++msgid ""
++msgstr "Content-Type: text/plain; charset=UTF-8\n"
++EOF
++
++: ${DIFF=diff}
++${DIFF} mm-test26a.ok mm-test26a.out || Exit 1
+-- 
+1.9.1
+