Bug 109798 - perl inline module generates broken C code
perl inline module generates broken C code
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: perl-Inline (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jason Vas Dias
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-11-11 17:05 EST by Bastien Nocera
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-15 18:35:50 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
inline C test case (309 bytes, text/plain)
2003-11-11 17:05 EST, Bastien Nocera
no flags Details

  None (edit)
Description Bastien Nocera 2003-11-11 17:05:25 EST
The attached testcase produces these errors at run-time:
testcase_pl_bb52.xs:12:12: missing terminating " character
testcase_pl_bb52.xs:13:1: missing terminating " character
testcase_pl_bb52.xs: In function `test':
testcase_pl_bb52.xs:14: error: syntax error before '}' token
make: *** [testcase_pl_bb52.o] Error 1

The .xs code generated looks like (yes, the quotes aren't on the same
line):
void test(char* string) {
    printf("My string: %s
", string);
}

when it should be:
void test(char* string) {
    printf("My string: %s\n", string);
}

Works fine under Red Hat Linux 9.
$ rpm -q perl perl-Inline perl-Parse-RecDescent gcc
perl-5.8.1-92
perl-Inline-0.44-8
perl-Parse-RecDescent-1.80-12
gcc-3.3.2-1
Comment 1 Bastien Nocera 2003-11-11 17:05:59 EST
Created attachment 95914 [details]
inline C test case
Comment 2 Bastien Nocera 2005-12-16 09:10:43 EST
Still happens on rawhide.
Comment 3 Jason Vas Dias 2006-03-15 18:35:26 EST
Well, this is actually because in perl-5.8.x, the <<EOF 'here-doc' quote-like
operator does interpolation by default, just like the "" or qq operator; 
ie. the \n in "My string: %s\n" is changed into a literal new line character 
in the Inline C source .

To turn off interpolation in the here-doc, instead of :
   use Inline C => <<EOT;
do:
   use Inline C => <<'EOT';

With that modification, your testcase.pl program works fine on FC-4, FC-5,
RHEL-3, and RHEL-4.

I think the reason it worked with perl-5.8.0 in RHL-9, is that interpolation 
of here-document strings was broken (perhaps by UTF-8-ness) whereas now it
works as intended. 

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