bugGNU gettext - Bugs: bug #42206, xgettext concatenates lines in C...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #42206: xgettext concatenates lines in C files when it shouldn't

Submitted by:  Armijn Hemel <armijn>
Submitted on:  Sun 27 Apr 2014 04:59:09 PM UTC  
 
Category: CSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Wed 30 Apr 2014 06:42:40 AM UTC, comment #5:

Thanks for the background info, perhaps the attached patch might meet your use-case. However, I doubt if it is generally useful, since there is no way to extract the second string (after #else).

(file #31280)

Daiki Ueno <ueno>
Project Administrator
Mon 28 Apr 2014 07:56:43 AM UTC, comment #4:

Thanks for your swift reply. Unfortunately for me that workaround will not work as my use case is a bit different. Please let me explain. I am using xgettext to analyse vast amounts of source code and to extract identifiers that could end up in binaries for fingerprinting. Because xgettext concatenates these two strings fingerprinting (partially) fails. It is not my intention to modify the source code that I analyse.

It would be great if #if #elif #else #endif and friends could be taken into account by xgettext, if possible.

Armijn Hemel <armijn>
Sun 27 Apr 2014 11:59:14 PM UTC, comment #3:

Can't it be easily worked around by modifying the code a bit:

Daiki Ueno <ueno>
Project Administrator
Sun 27 Apr 2014 05:01:25 PM UTC, comment #2:

and also with 0.18.3. Apologies for the noise.

Armijn Hemel <armijn>
Sun 27 Apr 2014 05:00:18 PM UTC, comment #1:

I forgot to add:

$ xgettext -V
xgettext (GNU gettext-tools) 0.18.2

Armijn Hemel <armijn>
Sun 27 Apr 2014 04:59:09 PM UTC, original submission:

xgettext concatenates lines in C files when it shouldn't. The following snippet is from init/init.c from BusyBox 1.1.0 (around line 770):

#if #cpu(s390)
/* Seems the s390 console is Wierd(tm). */
"The system is halted. You may reboot now."
#else
"The system is halted. Press Reset or turn off power"
#endif

xgettext produces the following result:

#: init.c:770
msgid ""
"The system is halted. You may reboot now.The system is halted. Press Reset "
"or turn off power"

It would make more sense to report these as two separate strings, if possible.

Armijn Hemel <armijn>

 

Attached Files
file #31280:  gettext-cpp-ifelse.patch added by ueno (1KiB - text/x-patch)
file #31258:  init.c added by armijn (29KiB - text/plain - init.c from BusyBox 1.1.0)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by haible (Updated the item)
  • -unavailable- added by ueno (Posted a comment)
  • -unavailable- added by armijn (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 27 Nov 2016 11:49:44 AM UTChaibleCategoryNone=>C
    Wed 30 Apr 2014 06:42:40 AM UTCuenoAttached File-=>Added gettext-cpp-ifelse.patch, #31280
    Sun 27 Apr 2014 04:59:09 PM UTCarmijnAttached File-=>Added init.c, #31258

    Back to the top


    Powered by Savane 3.1-cleanup1