rpmsq portability issues with pthread mutex type assumptions
Bug #637219 reported by
Jeff Johnson
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
RPM |
Fix Released
|
Low
|
Jeff Johnson | ||
CentOS |
Fix Released
|
Unknown
|
|||
Fedora |
Won't Fix
|
Medium
|
Bug Description
tracker
tags: | added: portability rpm.org |
Changed in centos: | |
status: | Unknown → New |
Changed in centos: | |
status: | New → Fix Released |
Changed in fedora: | |
importance: | Unknown → Medium |
status: | Unknown → Won't Fix |
To post a comment you must log in.
Description of problem: MUTEX_DEFAULT = PTHREAD_ MUTEX_NORMAL appears to have no effect except to break portability. The default mutex type appears to not matter here, because the mutex type is set in INIT_LOCK macro to PTHREAD_ MUTEX_RECURSIVE . In fact, checking for _NORMAL default type conflicts with always setting type to _RECURSIVE.
The rpmsq.c check for PTHREAD_
Note, please disregard Fedora release in this bug report; not sure which Fedora release contains rpm 4.8.0
One possible fix would be to remove lines 16-20 of rpmsq.c. Or to fix this only for HP-UX builds, line 17 could be changed to:
#if !defined(__hpux) && PTHREAD_ MUTEX_DEFAULT != PTHREAD_ MUTEX_NORMAL
Version-Release number of selected component (if applicable):
rpm 4.8.0
How reproducible:
Compile in HP-UX 11iv2 environment
Steps to Reproduce:
1.
2.
3.
Actual results: MUTEX_DEFAULT == PTHREAD_ MUTEX_NORMAL
An HP-UX 11iv2 build of rpm 4.8.0 breaks with this msg:
rpmsq.c:18:4: error: #error RPM expects PTHREAD_
Expected results:
No error during build.
Additional info: MUTEX_DEFAULT != PTHREAD_ MUTEX_NORMAL MUTEX_DEFAULT == PTHREAD_ MUTEX_NORMAL RECURSIVE_ MUTEX_INITIALIZ ER_NP MUTEX_INITIALIZ ER; RECURSIVE_ MUTEX_INITIALIZ ER_NP; mutex_lock( &rpmsigTbl_ lock); mutex_unlock( &rpmsigTbl_ lock); mutexattr_ init(&attr) ; \ mutexattr_ settype( &attr, PTHREAD_ MUTEX_RECURSIVE ); \ mutexattr_ destroy( &attr); \ sigchld- >active = 0; \
Pertinent rpmsq.c code from rpm 4.8.0:
16 /* XXX suggested in bugzilla #159024 */
17 #if PTHREAD_
18 #error RPM expects PTHREAD_
19 #endif
20
21 #ifndef PTHREAD_
22 static pthread_mutex_t rpmsigTbl_lock = PTHREAD_
23 #else
24 static pthread_mutex_t rpmsigTbl_lock = PTHREAD_
25 #endif
26
27 #define DO_LOCK() pthread_
28 #define DO_UNLOCK() pthread_
29 #define INIT_LOCK() \
30 { pthread_mutexattr_t attr; \
31 (void) pthread_
32 (void) pthread_
33 (void) pthread_mutex_init (&rpmsigTbl_lock, &attr); \
34 (void) pthread_
35 rpmsigTbl_
36 }