Bug 109798

Summary: perl inline module generates broken C code
Product: [Fedora] Fedora Reporter: Bastien Nocera <bnocera>
Component: perl-InlineAssignee: Jason Vas Dias <jvdias>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: perl-devel
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-15 23:35:50 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:
Attachments:
Description Flags
inline C test case none

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.