Bug 446406

Summary: regexp.h header unaware of __REPB_PREFIX macro usage in regex.h
Product: [Fedora] Fedora Reporter: Need Real Name <howarth>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.8-8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-07-23 07:08:30 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
preprocessed source from xview-3.2p1.4/clients/olvwm-4.1/virtual.c none

Description Need Real Name 2008-05-14 14:27:54 UTC
Description of problem:
The changes to regex.h create undefined symbols for the buffer and 
allocated fields of regex_t structures in regexp,h when -D_USE_GNU
is not in use. The  __REPB_PREFIX macro results in a '__' prefix to
the fields of the regex_t structure in such a case.

Version-Release number of selected component (if applicable):
glibc-headers-2.8-3

How reproducible:
Always.

Steps to Reproduce:
1. Complile the attached virtual.i preprocessed source from
xview-3.2p1.4/clients/olvwm-4.1/virtual.c.
This was generated with the command...

   gcc -m32 -O2 -fno-strength-reduce -fno-strict-aliasing
-I/home/howarth/rhdev/BUILD/xview-3.2p1.4/build/include
-I/tmp/xview-3.2p1.4-21.2.fc9-soft/usr/openwin/include
-I/tmp/xview-3.2p1.4-21.2.fc9-soft/usr/openwin/include -I. -I/usr/include
-Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE
-D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-DFUNCPROTO=15 -DNARROWPROTO -DOW_I18N_L3 -DIDENT -DXPM -DSHAPE -DXVIEW32
-DMAXPID=32768 -I/usr/include/X11 -DOPENWINHOME_DEFAULT=\"/usr/openwin\" -O2 -g
-pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -save-temps -c -o virtual.o virtual.c

Actual results:
I expected no errors in the compilation.

Expected results:
The following errors occurred...

./regexp.h: In function ‘compile’:
./regexp.h:132: error: ‘regex_t’ has no member named ‘buffer’
./regexp.h:133: error: ‘regex_t’ has no member named ‘allocated’
./regexp.h:133: error: ‘regex_t’ has no member named ‘buffer’


Additional info:
I believe that the regexp.h header needs to be made aware of the
usage of the __REPB_PREFIX macro in regex.h when the fields of a
egex_t structure is declared. A fix that works here is...

--- regexp.h    2008-05-14 10:17:11.000000000 -0400
+++ regexp.h.patched    2008-05-14 09:45:13.000000000 -0400
@@ -129,8 +129,13 @@
   __expr_ptr = (regex_t *) expbuf;
   /* The remaining space in the buffer can be used for the compiled
      pattern.  */
+#ifdef __USE_GNU
   __expr_ptr->buffer = expbuf + sizeof (regex_t);
   __expr_ptr->allocated = endbuf -  (char *) __expr_ptr->buffer;
+#else
+  __expr_ptr->__buffer = expbuf + sizeof (regex_t);
+  __expr_ptr->__allocated = endbuf -  (char *) __expr_ptr->__buffer;
+#endif

   while ((__ch = (GETC ())) != eof)
     {
@@ -198,7 +203,11 @@
       }

   /* Everything is ok.  */
+#ifdef __USE_GNU
   RETURN ((char *) (__expr_ptr->buffer + __expr_ptr->used));
+#else
+  RETURN ((char *) (__expr_ptr->__buffer + __expr_ptr->used));
+#endif
 }
 #endif

Comment 1 Need Real Name 2008-05-14 14:27:54 UTC
Created attachment 305367 [details]
preprocessed source from xview-3.2p1.4/clients/olvwm-4.1/virtual.c

Comment 2 Jakub Jelinek 2008-06-16 02:00:02 UTC
Fixed in rawhide, will be eventually backported to F9 updates.

Comment 3 Fedora Update System 2008-07-08 20:27:20 UTC
glibc-2.8-7 has been submitted as an update for Fedora 9

Comment 4 Fedora Update System 2008-07-23 07:08:19 UTC
glibc-2.8-8 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.