Bug 30894 - gencat fails to generate header file properly in glibc-2.2-12
gencat fails to generate header file properly in glibc-2.2-12
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
7.0
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-03-06 21:46 EST by Umesh R. Patil
Modified: 2016-11-24 10:19 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-03-07 05:05:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Umesh R. Patil 2001-03-06 21:46:23 EST
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 05:05:02 EST
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 10:46:51 EST
Should be fixed in glibc-2.2.2-5.
Comment 3 Umesh R. Patil 2001-03-15 20:20:26 EST
Thanks for the quick response.  Would you please email the patch to me at 
upatil@pivia.com?

Thanks

Umesh.

Note You need to log in before you can comment on or make changes to this bug.