Bug 79235

Summary: bad source code
Product: [Retired] Red Hat Linux Reporter: d.binderman
Component: perl-DBIAssignee: Warren Togami <wtogami>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
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: 2005-05-28 07:09:42 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:

Description d.binderman 2002-12-08 10:43:28 UTC
Description of Problem:

Hello there,

I just tried to compile package perl-DBI-1.30-1 from Redhat 8.0.

Here are some of the compiler messages.

Perl.xsi:303: warning: operation on `lna' may be undefined
Perl.xsi:339: warning: operation on `lna' may be undefined
Perl.xsi:375: warning: operation on `lna' may be undefined
DBI.xs:3347: warning: operation on `lna' may be undefined
DBI.xs:3368: warning: operation on `lna' may be undefined

I don't have a fix for the problem, but it seems to be around line
447 of DBIXS.h

#define DBD_ATTRIBS_CHECK(func, h, attribs)     \
    if ((attribs) && SvOK(attribs)) {           \
        STRLEN lna=0;                           \
        if (!SvROK(attribs) || SvTYPE(SvRV(attribs))!=SVt_PVHV)         \
            croak("%s->%s(...): attribute parameter '%s' is not a hash ref",
\
                    SvPV(h,lna), func, SvPV(attribs,lna));              \
    } else (attribs) = Nullsv

I suspect that the SvPV macro increments its second parameter,
causing the compiler to complain.

The fix would then be to introduce some temporary variables for
the results of SvPV(h,lna) and SvPV(attribs,lna) something like this

#define DBD_ATTRIBS_CHECK(func, h, attribs)     \
    if ((attribs) && SvOK(attribs)) {           \
        STRLEN lna=0;                           \
        if (!SvROK(attribs) || SvTYPE(SvRV(attribs))!=SVt_PVHV)         \
		{ \
			char * tmp1 = SvPV(h,lna); \
			char * tmp2 = SvPV(attribs,lna); \
            croak("%s->%s(...): attribute parameter '%s' is not a hash ref",
\
                    tmp1, func, tmp2);              \
    } else (attribs) = Nullsv


Version-Release number of selected component (if applicable):


How Reproducible:


Steps to Reproduce:
1. 
2. 
3. 

Actual Results:


Expected Results:


Additional Information: