Bug 79235 - bad source code
Summary: bad source code
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: perl-DBI
Version: 8.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Warren Togami
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-12-08 10:43 UTC by d.binderman
Modified: 2007-04-18 16:48 UTC (History)
0 users

(edit)
Clone Of:
(edit)
Last Closed: 2005-05-28 07:09:42 UTC


Attachments (Terms of Use)

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:


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