Bug 109798 - perl inline module generates broken C code
Summary: perl inline module generates broken C code
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: perl-Inline
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jason Vas Dias
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-11-11 22:05 UTC by Bastien Nocera
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-03-15 23:35:50 UTC
Type: ---
Embargoed:


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

Description Bastien Nocera 2003-11-11 22:05:25 UTC
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 22:05:59 UTC
Created attachment 95914 [details]
inline C test case

Comment 2 Bastien Nocera 2005-12-16 14:10:43 UTC
Still happens on rawhide.

Comment 3 Jason Vas Dias 2006-03-15 23:35:26 UTC
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.