[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#434294: marked as done (libc6: buggy unlocking of an unlocked pthread_rwlock_t)



Your message dated Mon, 23 Jul 2007 10:05:37 +0200
with message-id <20070723080537.GA19535@artemis.corp>
and subject line Bug#434294: libc6: buggy unlocking of an unlocked pthread_rwlock_t
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: libc6
Version: 2.6-2
Severity: normal

according to it's man page, pthread_rwlock_unlock should return EPERM, if the current thread
doesn't hold the lock.

the actual behavior is different, though:

see:

#include "pthread.h"
#include "errno.h"
#include "assert.h"

int main(void)
{
    pthread_rwlock_t rwlock;
    pthread_rwlock_init(&rwlock, NULL);
    pthread_rwlock_rdlock(&rwlock);
    pthread_rwlock_rdlock(&rwlock);

    pthread_rwlock_unlock(&rwlock);
    pthread_rwlock_unlock(&rwlock);
    assert( pthread_rwlock_unlock(&rwlock) == EPERM );

    pthread_rwlock_destroy(&rwlock);
}



-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable'), (10, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22.1-rt1 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libc6 depends on:
ii  libgcc1                       1:4.2.1-0  GCC support library

libc6 recommends no packages.

-- no debconf information


--- End Message ---
--- Begin Message ---
On Mon, Jul 23, 2007 at 12:34:16AM +0200, Tim Blechmann wrote:
> Package: libc6
> Version: 2.6-2
> Severity: normal
> 
> according to it's man page, pthread_rwlock_unlock should return EPERM, if the current thread
> doesn't hold the lock.
> 
> the actual behavior is different, though:
> 
> see:
> 
> #include "pthread.h"
> #include "errno.h"
> #include "assert.h"
> 
> int main(void)
> {
>     pthread_rwlock_t rwlock;
>     pthread_rwlock_init(&rwlock, NULL);
>     pthread_rwlock_rdlock(&rwlock);
>     pthread_rwlock_rdlock(&rwlock);
> 
>     pthread_rwlock_unlock(&rwlock);
>     pthread_rwlock_unlock(&rwlock);
>     assert( pthread_rwlock_unlock(&rwlock) == EPERM );

HAHAHAHAHAHAHAHAHAHA

  please learn how to use errno. When a call fails in posix it returns a
negative value, usually -1, and sets errno. you must test errno for
EPERM. not the return value.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpof6WXqsOut.pgp
Description: PGP signature


--- End Message ---

Reply to: