Bug 30894

Summary: gencat fails to generate header file properly in glibc-2.2-12
Product: [Retired] Red Hat Linux Reporter: Umesh R. Patil <upatil>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Aaron Brown <abrown>
Severity: high Docs Contact:
Priority: medium    
Version: 7.0CC: fweimer, upatil
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-03-07 10:05:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Umesh R. Patil 2001-03-07 02:46:23 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)


Symbolic message catalog identifiers get overwritten by message content 
resulting in an incorrect C header file.  

Reproducible: Always
Steps to Reproduce:
1.  Create a message catalog called PvMsg.src with the following lines:

$quote "
$set S_

MSG_1 This is a sample message

2.  Since, I want to use these message ids in my c/c++ program, I want to 
generate a header file in addition to the message catalog itself.  Run the 
following command:

gencat --new -H PvMsg.h -o PvMsg.cat PvMsg.src

Actual Results:  Edit PvMsg.h and you'll see:

#define S_Set 0x1  ...
#define S_This is a sample message 0x1   --- this is broken because the 
symbolic id is gone!!!

Expected Results:

#define S_Set 0x1  ...
#define S_MSG_1 0x1 ...

The problem is in iconv code that has been added to catgets/gencat.c.  The 
buffer that contains the line with the symbolic message id and the message 
itself is being overwritten by the call to iconv.  Rather than overwrite 
the data pointed to by "this_line", "line" should be used because it is 
already pointing to the beginning of the message that is being fixed...

diff -rc ./catgets/gencat.c ../glibc-2.2.new/catgets/gencat.c
*** ./catgets/gencat.c	Mon Jan  8 10:42:26 2001
--- ../glibc-2.2.new/catgets/gencat.c	Tue Mar  6 14:31:56 2001
***************
*** 714,720 ****
  	      outlen = obstack_room ($t->mem_pool);
  	      obstack_blank ($t->mem_pool, outlen);
  	      this_line = (char *) obstack_base ($t->mem_pool);
! 	      outbuf = this_line;
  
  	      /* Flush the state.  */
  	      iconv (cd_tomb, NULL, NULL, NULL, NULL);
--- 714,720 ----
  	      outlen = obstack_room ($t->mem_pool);
  	      obstack_blank ($t->mem_pool, outlen);
  	      this_line = (char *) obstack_base ($t->mem_pool);
! 	      outbuf = line;
  
  	      /* Flush the state.  */
  	      iconv (cd_tomb, NULL, NULL, NULL, NULL);

Comment 1 Jakub Jelinek 2001-03-07 10:05:02 UTC
The patch does not look correct to me, it will mess things out since outlen
will be wrong. I'm testing a fix ATM.

Comment 2 Jakub Jelinek 2001-03-09 15:46:51 UTC
Should be fixed in glibc-2.2.2-5.

Comment 3 Umesh R. Patil 2001-03-16 01:20:26 UTC
Thanks for the quick response.  Would you please email the patch to me at 
upatil?

Thanks

Umesh.