Bug 591732 - portability broken by rpmsq.c check for PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
portability broken by rpmsq.c check for PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX...
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
12
parisc11 Other
low Severity medium
: ---
: ---
Assigned To: Panu Matilainen
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-12 18:20 EDT by Gary Quakenbush
Modified: 2010-08-13 07:11 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-13 07:11:02 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Gary Quakenbush 2010-05-12 18:20:42 EDT
Description of problem:
The rpmsq.c check for PTHREAD_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.

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:
An HP-UX 11iv2 build of rpm 4.8.0 breaks with this msg:
rpmsq.c:18:4: error: #error RPM expects PTHREAD_MUTEX_DEFAULT == PTHREAD_MUTEX_NORMAL

Expected results:
No error during build.

Additional info:
Pertinent rpmsq.c code from rpm 4.8.0:
16  /* XXX suggested in bugzilla #159024 */
17  #if PTHREAD_MUTEX_DEFAULT != PTHREAD_MUTEX_NORMAL
18    #error RPM expects PTHREAD_MUTEX_DEFAULT == PTHREAD_MUTEX_NORMAL
19  #endif
20
21  #ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
22  static pthread_mutex_t rpmsigTbl_lock = PTHREAD_MUTEX_INITIALIZER;
23  #else
24  static pthread_mutex_t rpmsigTbl_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
25  #endif
26
27  #define DO_LOCK()       pthread_mutex_lock(&rpmsigTbl_lock);
28  #define DO_UNLOCK()     pthread_mutex_unlock(&rpmsigTbl_lock);
29  #define INIT_LOCK()     \
30      {   pthread_mutexattr_t attr; \
31          (void) pthread_mutexattr_init(&attr); \
32          (void) pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); \
33          (void) pthread_mutex_init (&rpmsigTbl_lock, &attr); \
34          (void) pthread_mutexattr_destroy(&attr); \
35          rpmsigTbl_sigchld->active = 0; \
36      }
Comment 1 Panu Matilainen 2010-08-13 07:11:02 EDT
Compilation issues on HP-UX are not Fedora bugs :)
Moved to upstream bug tracker: http://rpm.org/ticket/177, feel free to cc yourself there for further tracking of this.

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