Bug 722947 - [RHEL5:C++] isxdigit should not be defined as a macro in readline
Summary: [RHEL5:C++] isxdigit should not be defined as a macro in readline
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: readline
Version: 5.6
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Lukáš Nykrýn
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-18 15:04 UTC by Travis Gummels
Modified: 2014-03-27 13:39 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 722942
Environment:
Last Closed: 2014-03-27 13:39:42 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Travis Gummels 2011-07-18 15:04:42 UTC
+++ This bug was initially created as a clone of Bug #722942 +++

Same behaviour seen in RHEL 5 as is seen in RHEL 6 in cloned BZ

Description of problem:

The problem is that readline shouldn't be defining isxdigit as a macro ever. That is wrong in C++ because it is a template function. If you look at ctype.h you see the correct declaration which is excluded from C++ with: 

#if !defined __NO_CTYPE && !defined __cplusplus
<snip>
# define isxdigit(c)    __isctype((c), _ISxdigit)

This is a bug in readline.

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

How reproducible:
100%

Steps to Reproduce:
$ cat test.C 
#include <string> 
#include <readline/readline.h> 
#include <iostream> 

using namespace std; 

int main() { 
cout<<"Hi There "<<isxdigit(19)<<endl; return 0; 
} 


$ g++ test.C


Actual results:

In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios:47,

                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream:44,

                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:44,

                 from test.C:3:

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/localefwd.h:90:35: error: macro "isxdigit" passed 2 arguments, but takes just 1

In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.h:44,

                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios:50,

                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream:44,

                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:44,

                 from test.C:3:

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.h:4609:45: error: macro "isxdigit" passed 2 arguments, but takes just 1

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/localefwd.h:90: error: 'std::isxdigit' declared as an 'inline' variable

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/localefwd.h:90: error: template declaration of 'bool std::isxdigit'

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.h:4609: error: invalid function declaration

Expected results:

No garbage.

Additional info:

A simple fix in readline would be to add 

!defined __cplusplus to the declaration in chardefs.h

    75  #if !defined (isxdigit) && !defined (HAVE_ISXDIGIT)
    76  #  define isxdigit(c)   (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
    77  #endif

so that line 75 ends up being:

    75  #if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus) 
    76  #  define isxdigit(c)   (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
    77  #endif

Comment 1 RHEL Program Management 2011-09-23 00:42:56 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 6 RHEL Program Management 2014-03-07 13:54:09 UTC
This bug/component is not included in scope for RHEL-5.11.0 which is the last RHEL5 minor release. This Bugzilla will soon be CLOSED as WONTFIX (at the end of RHEL5.11 development phase (Apr 22, 2014)). Please contact your account manager or support representative in case you need to escalate this bug.


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