]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
msgunfmt: Fix msgunfmt-tcl-1 failure with tcl version 9.0 beta2.
authorBruno Haible <bruno@clisp.org>
Mon, 1 Jul 2024 11:26:43 +0000 (13:26 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 1 Jul 2024 11:37:22 +0000 (13:37 +0200)
Reported by Jeffrey Cliff <jeffrey.cliff@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2024-07/msg00000.html>.

* gettext-tools/src/msgunfmt.tcl: Access the ::msgcat::header variable through
an absolute name syntax, not a relative name syntax.

Rationale: <https://core.tcl-lang.org/tcl/wiki?name=Migrating+scripts+to+Tcl+9>
says:
  "In Tcl 8 variable names that are not absolute are resolved by looking
   first in the current namespace, and then in the global namespace.
   In Tcl 9 such variables are always interpreted as relative to the current
   namespace."

gettext-tools/src/msgunfmt.tcl

index 32e79cd248891de4721927a8c759fac2c79e5b70..ef32112478d07bc08a785f74c4eac715eeb36c22 100644 (file)
@@ -1,5 +1,5 @@
 # Reading tcl/msgcat .msg files.
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002-2024 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -57,7 +57,7 @@ proc msgcat::mcdump {langfile} {
     # msgunfmt expects the output in UTF-8 encoding.
     fconfigure stdout -encoding utf-8
 
-    set msgcat::header ""
+    set ::msgcat::header ""
 
     set fd [open $langfile r]
     # In newer tcl versions, the .msg files are in UTF-8 encoding.
@@ -65,11 +65,11 @@ proc msgcat::mcdump {langfile} {
     eval [read $fd]
     close $fd
 
-    if {$msgcat::header == ""} {
+    if {$::msgcat::header == ""} {
       # Provide a minimal header.
-      set msgcat::header [subst "MIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n"]
+      set ::msgcat::header [subst "MIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n"]
     }
-    msgcat::write_po_message "" $msgcat::header
+    msgcat::write_po_message "" $::msgcat::header
   } else {
     # Tell msgunfmt to emit an internationalized error message.
     exit 2