Skip to contentSkip to conversation

msgmft segfaulting on tiger

PATCH In review Martin Langhoff 8 participants 21 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

Today I've debugged a compile of git 1.5.4.2 failing on OSX Tiger (on Basilio's machine). The problem is during the git-gui build, in the PO file handling. Apparently fmtmsg (from fink) segfaults on de.po so the fix is to say

make NO_MSGFMT=NoneThere

I don't think we can do much about it -- my guess is that fink has been built and tested in a different OSX release, and happens to go bellyup on Tiger. Here's a transcript in case it helps anyone.

Here's the tail of the build message, with make called with -d:

GITGUI_VERSION = 0.9.2
* new locations or Tcl/Tk interpreter
GEN git-gui
INDEX lib/
MSGFMT po/de.msg make[1]: *** [po/de.msg] Error 1
make: *** [all] Error 2

Various versions of things involved:

 $ dpkg -S /sw/bin/msgfmt
 gettext-tools: /sw/bin/msgfmt
 $ dpkg -l gettext-tools
(...)
 ii  gettext-tools                     0.10.40-19
 $ uname -a
 Darwin developer 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10
 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386
 $ msgfmt -V
 msgfmt (GNU gettext) 0.10.40
 Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 Written by Ulrich Drepper.

Has anyone got any ideas on how to debug this further? I couldn't find any core files.

cheers,

martin

#1 lore raw
Quoted 4 lines · Martin Langhoff

Today I've debugged a compile of git 1.5.4.2 failing on OSX Tiger (on
Basilio's machine). The problem is during the git-gui build, in the PO file handling. Apparently fmtmsg (from fink) segfaults on de.po so the fix is to say

Grumble. It seems like msgfmt that fink provides actually does not support the --tcl flag. So perhaps the right thing is to always say NO_MSGFMT on OSX?

cheers,

m

#2 lore raw
Quoted 10 lines · Martin Langhoff
Quoted 4 lines · Martin Langhoff

Today I've debugged a compile of git 1.5.4.2 failing on OSX Tiger (on
Basilio's machine). The problem is during the git-gui build, in the PO file handling. Apparently fmtmsg (from fink) segfaults on de.po so the fix is to say

Grumble. It seems like msgfmt that fink provides actually does not support the --tcl flag. So perhaps the right thing is to always say NO_MSGFMT on OSX?

I'd hate to do this. GNU msgfmt does better checking on the messages then po2msg.sh does, and its a tiny bit faster. So I'd rather stick to the standard tool that is widely used.

Currently we are looking to see if msgfmt generates an exit status of 127, and if so we fallback to po2msg.sh. Apparently however that test is passing and thus you are using the fink msgfmt.

Did you try building with make V=1 to look at the full output and not the prettied up simplified output the Makefile uses by default? It won't fix your issue but it may be interesting to see if msgfmt is failing with a particular message or not.

Signature · 1 line
Shawn.
#3 lore raw
Quoted 4 lines · Shawn O. Pearce

Did you try building with make V=1 to look at the full output and not the prettied up simplified output the Makefile uses by default? It won't fix your issue but it may be interesting to see if msgfmt is failing with a particular message or not.

I'll track down Basilio (it's his laptop) today and try, I think he's still at the conference. I also suspect that OSX's own build tools may include a different msgfmt, but the fink one is earlier in the path.

cheers,

m

#4 lore raw

We tried to build with make V=1 and this was the output:

msgfmt --statistics --tcl -l de -d po/ po/de.po msgfmt: unrecognized option --tcl' Try msgfmt --help' for more information.
make[1]: *** [po/de.msg] Error 1
make: *** [all] Error 2

Still the error is in the po/de.po file

Hope this info helps

Gabriel Saldana

Quoted 16 lines · Martin Langhoff
Quoted 4 lines · Shawn O. Pearce

Did you try building with make V=1 to look at the full output and not the prettied up simplified output the Makefile uses by default? It won't fix your issue but it may be interesting to see if msgfmt is failing with a particular message or not.

I'll track down Basilio (it's his laptop) today and try, I think he's still at the conference. I also suspect that OSX's own build tools may include a different msgfmt, but the fink one is earlier in the path.

cheers,

m

#5 lore raw

Hi,

Quoted 2 lines · Gabriel Saldaña

msgfmt --statistics --tcl -l de -d po/ po/de.po msgfmt: unrecognized option `--tcl'

Could you try this, please:

$ msgfmt --tcl; echo $?

Maybe we can have a clever autodetection of msgfmt which does not understand --tcl?

Ciao,
Dscho

#6 lore raw

Here it is:

$ msgfmt --tcl; echo $?
msgfmt: unrecognized option `--tcl'
Try `msgfmt --help' for more information.
1

Gabriel

Quoted 15 lines · Johannes Schindelin

Hi,

Quoted 2 lines · Gabriel Saldaña

msgfmt --statistics --tcl -l de -d po/ po/de.po msgfmt: unrecognized option `--tcl'

Could you try this, please:

$ msgfmt --tcl; echo $?

Maybe we can have a clever autodetection of msgfmt which does not understand --tcl?

Ciao,
Dscho

#7 lore raw

Hi,

Quoted 6 lines · Gabriel Saldaña

Here it is:

$ msgfmt --tcl; echo $?
msgfmt: unrecognized option `--tcl'
Try `msgfmt --help' for more information.
1

Darn. I think that's the same exit code as for any other invocation without filename.

So it seems that there is no easy way to tell a --tcl aware msgfmt from the other.

Ciao,
Dscho

#8 lore raw
Quoted 10 lines · Johannes Schindelin
Quoted 4 lines
$ msgfmt --tcl; echo $?
msgfmt: unrecognized option `--tcl'
Try `msgfmt --help' for more information.
1

Darn. I think that's the same exit code as for any other invocation without filename.

So it seems that there is no easy way to tell a --tcl aware msgfmt from the other.

How about...

    $ msgfmt --tcl -l C -d . /dev/null; echo $?
#9 lore raw
Quoted 6 lines · Junio C Hamano
Quoted 5 lines · Johannes Schindelin
Quoted 4 lines
$ msgfmt --tcl; echo $?
msgfmt: unrecognized option `--tcl'
Try `msgfmt --help' for more information.
1
Quoted 6 lines
Quoted 2 lines

Darn. I think that's the same exit code as for any other invocation without filename.

How about...

    $ msgfmt --tcl -l C -d . /dev/null; echo $?

I can't test this, my msgfmt --tcl works properly. Can someone who has a msgfmt lacking tcl support confirm this will work?

--8<--
[PATCH] git-gui: Gracefully fall back to po2msg.sh if msgfmt --tcl fails

Mac OS X Tiger may have a msgfmt available but it doesn't understand how to implement --tcl. Falling back to po2msg.sh on such systems is a reasonable behavior.

---
 Makefile |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Makefile +5 -0
index 01e0a46..1bd11eb 100644
@@ -224,6 +224,11 @@ else
 	ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127)
 		MSGFMT := $(TCL_PATH) po/po2msg.sh
 	endif
+	ifeq (msgfmt,$(MSGFMT))
+	ifeq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null || echo $?),1)
+		MSGFMT := $(TCL_PATH) po/po2msg.sh
+	endif
+	endif
 endif
 
 msgsdir     = $(gg_libdir)/msgs
Signature · 5 lines
1.5.4.3.295.g6b554


-- 
Shawn.
#10 lore raw

msgmft segfaulting on ubuntu gutsy (clean)

I'm getting the msgmft error message when compiling git 1.5.4.3 on a clean install of Ubuntu Gutsy. Installed dependencies using "apt-get build-dep git-core".

Here's make output:

GITGUI_VERSION = 0.9.2.7.g3bae
* new locations or Tcl/Tk interpreter
GEN git-gui
INDEX lib/
MSGFMT po/de.msg 371 translated.
MSGFMT po/fr.msg 371 translated.
MSGFMT po/hu.msg 371 translated.
MSGFMT po/it.msg 370 translated, 1 untranslated.
MSGFMT po/ja.msg 371 translated.
MSGFMT po/ru.msg 367 translated, 4 untranslated.
MSGFMT po/sv.msg 371 translated.
MSGFMT po/zh_cn.msg 53 translated, 57 fuzzy, 253 untranslated. SUBDIR gitk-git
GEN gitk-wish
Generating catalog po/de.msg
msgfmt --statistics --tcl po/de.po -l de -d po/ make[1]: msgfmt: Command not found
make[1]: *** [po/de.msg] Error 127
make: *** [all] Error 2

It is very similar to Tiger's error message.

Gabriel Saldana

#11 lore raw

Re: msgmft segfaulting on ubuntu gutsy (clean)

Quoted 26 lines · Gabriel Saldaa

I'm getting the msgmft error message when compiling git 1.5.4.3 on a clean install of Ubuntu Gutsy. Installed dependencies using "apt-get build-dep git-core".

Here's make output:

GITGUI_VERSION = 0.9.2.7.g3bae
* new locations or Tcl/Tk interpreter
GEN git-gui
INDEX lib/
MSGFMT po/de.msg 371 translated.
MSGFMT po/fr.msg 371 translated.
MSGFMT po/hu.msg 371 translated.
MSGFMT po/it.msg 370 translated, 1 untranslated.
MSGFMT po/ja.msg 371 translated.
MSGFMT po/ru.msg 367 translated, 4 untranslated.
MSGFMT po/sv.msg 371 translated.
MSGFMT po/zh_cn.msg 53 translated, 57 fuzzy, 253 untranslated. SUBDIR gitk-git
GEN gitk-wish
Generating catalog po/de.msg
msgfmt --statistics --tcl po/de.po -l de -d po/ make[1]: msgfmt: Command not found
make[1]: *** [po/de.msg] Error 127
make: *** [all] Error 2

Quoted 1 line

It is very similar to Tiger's error message.

Rebuild with "NO_MSGFMT=1", or install GNU msgfmt first.

The issue is gitk's Makefile is missing the fallback rule that git-gui has, which is use our Tcl based msgfmt work-a-like if msgfmt is not found. That's exactly what you see above; git-gui fell back automatically to its work-a-like but gitk did not.

Signature · 1 line
Shawn.
#12 lore raw
In reply to Junio C Hamano

Here's the output, hope it helps:

$ msgfmt --tcl -l C -d . /dev/null; echo $?
msgfmt: unrecognized option `--tcl'
Try `msgfmt --help' for more information.
1

somehow msgfmt doesn't recognize the --tcl flag.

Gabriel Saldana

Quoted 14 lines · Junio C Hamano
Quoted 7 lines · Johannes Schindelin
Quoted 4 lines
$ msgfmt --tcl; echo $?
msgfmt: unrecognized option `--tcl'
Try `msgfmt --help' for more information.
1

Darn. I think that's the same exit code as for any other invocation without filename.

So it seems that there is no easy way to tell a --tcl aware msgfmt from the other.

How about...

    $ msgfmt --tcl -l C -d . /dev/null; echo $?
#13 lore raw
Quoted 8 lines · Gabriel Saldaa

Here's the output, hope it helps:

$ msgfmt --tcl -l C -d . /dev/null; echo $?
msgfmt: unrecognized option `--tcl'
Try `msgfmt --help' for more information.
1

somehow msgfmt doesn't recognize the --tcl flag.

Just to revive a nearly dead thead... I have a workaround now in git-gui maint that looks for this case and falls into our po2msg script when msgfmt doesn't see --tcl.

I also set Paul Mackerras a patch for gitk, so it can do the same thing. Maybe Git 1.5.4.4 will include both patches.

Quoted 16 lines
Quoted 15 lines · Junio C Hamano
Quoted 9 lines · Johannes Schindelin
Quoted 4 lines
$ msgfmt --tcl; echo $?
msgfmt: unrecognized option `--tcl'
Try `msgfmt --help' for more information.
1

Darn. I think that's the same exit code as for any other invocation without filename.

So it seems that there is no easy way to tell a --tcl aware msgfmt from the other.

How about...

   $ msgfmt --tcl -l C -d . /dev/null; echo $?
Signature · 1 line
Shawn.
#14 lore raw
Quoted 6 lines · Shawn O. Pearce

Just to revive a nearly dead thead... I have a workaround now in git-gui maint that looks for this case and falls into our po2msg script when msgfmt doesn't see --tcl.

I also set Paul Mackerras a patch for gitk, so it can do the same thing. Maybe Git 1.5.4.4 will include both patches.

I looked at what you have in your Makefile.

It makes me wonder, however, if it makes more sense to squash the two invocations of msgfmt you make into one, like the attached patch.

The point is that msgfmt you guys want to use _must_ understand --tcl, and a msgfmt new enough to be usable would exit with 0 on the above command line.

-- >8 --
gitk i18n: Fall back to po2msg.sh if msgfmt --tcl fails

Some platforms may have a msgfmt that doesn't understand --tcl. Mac OS X Tiger is an example.

Falling back to po2msg.sh on such systems is a reasonable behavior.

---
 Makefile |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Makefile +3 -0
index ae2b80b..c72e7f7 100644
@@ -22,6 +22,9 @@ ifdef NO_MSGFMT
 	MSGFMT ?= $(TCL_PATH) po/po2msg.sh
 else
 	MSGFMT ?= msgfmt
+	ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $?),0)
+		MSGFMT = $(TCL_PATH) po/po2msg.sh 
+	endif
 endif
 
 PO_TEMPLATE = po/gitk.pot
#15 lore raw

PATCH 1/1 Simplify MSGFMT setting in Makefile

To prepare msg files for Tcl scripts, the command that is set to MSGFMT make variable needs to be able to grok "--tcl -l <lang> -d <here>" options correctly. This patch simplifies the tests done in git-gui's Makefile to directly test this condition. If the test run does not exit properly with zero status (either because you do not have "msgfmt" itself, or your "msgfmt" is too old to grok --tcl option --- the reason does not matter), have it fall back to po/po2msg.sh

---

* I am planning to close 'master' for -rc1 by the end of this week, so please plan to tell me to pull if you have accumulated changes, thanks.

 Makefile |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
Makefile +1 -6
index 4e32174..95e99f2 100644
@@ -221,14 +221,9 @@ ifdef NO_MSGFMT
 	MSGFMT ?= $(TCL_PATH) po/po2msg.sh
 else
 	MSGFMT ?= msgfmt
-	ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127)
+	ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $?),0)
 		MSGFMT := $(TCL_PATH) po/po2msg.sh
 	endif
-	ifeq (msgfmt,$(MSGFMT))
-	ifeq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null || echo $?),1)
-		MSGFMT := $(TCL_PATH) po/po2msg.sh
-	endif
-	endif
 endif
 
 msgsdir     = $(gg_libdir)/msgs
#16 lore raw

Re: [PATCH] Simplify MSGFMT setting in Makefile

Quoted 1 line · Junio C Hamano

To prepare msg files for Tcl scripts, the command that is set to MSGFMT

...

Thanks.

Quoted 3 lines

* I am planning to close 'master' for -rc1 by the end of this week, so please plan to tell me to pull if you have accumulated changes, thanks.

Please pull. What is in my master right now (7276607 which is this patch) will likely be gitgui-0.10.0. I'm unlikely to have any further changes (beyond perhaps updated po files) between now and 1.5.5 final.

Makefile ifdef NO_MSGFMT · line 224

Quoted 13 lines
 Makefile |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
Makefile +1 -1
index 4e32174..95e99f2 100644
@@ -221,14 +221,9 @@ ifdef NO_MSGFMT
 	MSGFMT ?= $(TCL_PATH) po/po2msg.sh
 else
 	MSGFMT ?= msgfmt
-	ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127)
+	ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $?),0)

Missing a $ here, it should be $$? not $?. Fixed up when I applied.

Signature · 1 line
Shawn.
Tested-by on v1 1/1
#17 lore raw

Re: [PATCH] Simplify MSGFMT setting in Makefile

In reply to Junio C Hamano
Quoted 9 lines · Junio C Hamano

To prepare msg files for Tcl scripts, the command that is set to MSGFMT make variable needs to be able to grok "--tcl -l <lang> -d <here>" options correctly. This patch simplifies the tests done in git-gui's Makefile to directly test this condition. If the test run does not exit properly with zero status (either because you do not have "msgfmt" itself, or your "msgfmt" is too old to grok --tcl option --- the reason does not matter), have it fall back to po/po2msg.sh

This looks good to me on Mac OS X 10.5.2, would anyone like me to prepare a patch for gitk as without it we still need to manually specifiy NO_MSGFMT to the top level git make in any case?

Charles.

#18 lore raw

Re: [PATCH] Simplify MSGFMT setting in Makefile

In reply to Junio C Hamano
Quoted 3 lines · Junio C Hamano

* I am planning to close 'master' for -rc1 by the end of this week, so please plan to tell me to pull if you have accumulated changes, thanks.

I have a few commits for you to pull, but I am about to push a patch for gitk like the one you sent for git-gui, so I'll send you a pull request when I've done that. However, I found that in this line:

Makefile ifdef NO_MSGFMT · line 224

Quoted 4 lines

else

Makefile +1 -1
 	MSGFMT ?= msgfmt
-	ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127)
+	ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $?),0)

I had to put "echo $$?" for it to work rather than "echo $?".

Paul.

#19 lore raw

Re: [PATCH] Simplify MSGFMT setting in Makefile

Quoted 10 lines · Paul Mackerras
Quoted 3 lines · Junio C Hamano

* I am planning to close 'master' for -rc1 by the end of this week, so please plan to tell me to pull if you have accumulated changes, thanks.

I have a few commits for you to pull, but I am about to push a patch for gitk like the one you sent for git-gui, so I'll send you a pull request when I've done that. However, I found that in this line:

Quoted 7 lines

Makefile ifdef NO_MSGFMT · line 224

Quoted 4 lines

else

Makefile +1 -1
 	MSGFMT ?= msgfmt
-	ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127)
+	ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $?),0)

I had to put "echo $$?" for it to work rather than "echo $?".

$$ is the way to pass a literal $ to the shell in Makefiles, so that seems in order.

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
#20 lore raw

Re: [PATCH] Simplify MSGFMT setting in Makefile

In reply to Paul Mackerras
Quoted 3 lines · Paul Mackerras

I have a few commits for you to pull, but I am about to push a patch for gitk like the one you sent for git-gui, so I'll send you a pull request when I've done that.

Thanks.

Quoted 6 lines

Makefile ifdef NO_MSGFMT · line 224

Quoted 4 lines

else

Makefile +1 -1
 	MSGFMT ?= msgfmt
-	ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127)
+	ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $?),0)

I had to put "echo $$?" for it to work rather than "echo $?".

Yeah, very sorry about this; Shawn already has pointed it out to me.