Debian Bug report logs - #291121
manpages-dev: flock(2) second time by same process

version graph

Package: manpages-dev; Maintainer for manpages-dev is Martin Schulze <joey@debian.org>; Source for manpages-dev is src:manpages.

Reported by: Kevin Ryde <user42@zip.com.au>

Date: Tue, 18 Jan 2005 21:48:05 UTC

Severity: normal

Tags: fixed-upstream

Found in version 2.01-1

Fixed in version 2.09-1

Done: Justin Pryzby <justinpryzby@users.sourceforge.net>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#291121; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to Kevin Ryde <user42@zip.com.au>:
New Bug report received and forwarded. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Kevin Ryde <user42@zip.com.au>
To: submit@bugs.debian.org
Subject: manpages-dev: flock(2) second time by same process
Date: Wed, 19 Jan 2005 08:35:21 +1100
Package: manpages-dev
Version: 2.01-1
Severity: normal

The flock(2) man page says

       A  process  may  only  hold one type of lock (shared or exclusive) on a
       file.  Subsequent flock() calls on an already locked file will  convert
       an existing lock to the new lock mode.

I read this as meaning the lock is associated with the process, and I
tried converting a lock through a second opened fd per the test
program below but it hung after printing "about to do second flock".

The lock is actually associated with the file table entry is it?  Or
the table entry plus the process?  Perhaps this can be clarified.


#include <stdio.h>
#include <sys/file.h>

int
main (void)
{
  int x, y, ret;

  x = open ("foo.tmp", O_RDWR | O_CREAT, 0666);
  if (x == -1) perror ("first open");

  ret = flock (x, LOCK_EX);
  if (ret == -1) perror ("first flock");


  y = open ("foo.tmp", O_RDWR);
  if (y == -1) perror ("first open");

  printf ("about to do second flock\n");
  ret = flock (y, LOCK_SH);
  if (ret == -1) perror ("second flock");

  printf ("done\n");
  return 0;
}


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i586)
Kernel: Linux 2.6.8-1-386
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages manpages-dev depends on:
ii  manpages                      2.01-1     Manual pages about using a GNU/Lin

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#291121; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to "Michael Kerrisk" <mtk-manpages@gmx.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #10 received at 291121@bugs.debian.org (full text, mbox):

From: "Michael Kerrisk" <mtk-manpages@gmx.net>
To: Martin Schulze <joey@infodrom.org>
Cc: 291121@bugs.debian.org
Subject: Re: #291121 flock(2) second time by same process
Date: Tue, 21 Jun 2005 16:36:28 +0200 (MEST)
I agree -- the manual page could offer a little more help.
I've added new text for man-pages-2.04.  (Please close 
this report.)  New text is:

       If a process uses open(2) (or similar) to obtain more than
       one descriptor for the same file,  these  descriptors  are
       treated  independently by flock().  An attempt to lock the
       file using one of these file descriptors may be denied  by
       a  lock  that  the  calling process has already placed via
       another descriptor.

Kevin Ryde said:

> The lock is actually associated with the file table entry 
> is it?  Or the table entry plus the process?  Perhaps this 
> can be clarified.

Note that the manual page did already say the following 
elsewhere:

       Locks created by flock() are associated with an open  file
       table  entry.   This means that duplicate file descriptors
       (created by, for example, fork(2) or dup(2)) refer to  the
       same lock, and this lock may be modified or released using
       any  of  these  descriptors.   Furthermore,  the  lock  is
       released either by an explicit LOCK_UN operation on any of
       these duplicate descriptors, or when all such  descriptors
       have been closed.

Cheers,

Michael

-- 
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7 

Want to help with man page maintenance?  Grab the latest
tarball at ftp://ftp.win.tue.nl/pub/linux-local/manpages/
and grep the source files for 'FIXME'.

Please submit non-trivial man page suggestions as 
"diff -u" patches.

Geschenkt: 3 Monate GMX ProMail gratis + 3 Ausgaben stern gratis
++ Jetzt anmelden & testen ++ http://www.gmx.net/de/go/promail ++



Tags added: fixed-upstream Request was from Justin Pryzby <justinpryzby@users.sourceforge.net> to control@bugs.debian.org. Full text and rfc822 format available.

Reply sent to Justin Pryzby <justinpryzby@users.sourceforge.net>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Kevin Ryde <user42@zip.com.au>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #17 received at 291121-done@bugs.debian.org (full text, mbox):

From: Justin Pryzby <justinpryzby@users.sourceforge.net>
To: 317037-done@bugs.debian.org, 315411-done@bugs.debian.org, 209323-done@bugs.debian.org, 330877-done@bugs.debian.org, 321131-done@bugs.debian.org, 299795-done@bugs.debian.org, 295666-done@bugs.debian.org, 326520-done@bugs.debian.org, 306517-done@bugs.debian.org, 291121-done@bugs.debian.org, 323851-done@bugs.debian.org, 323062-done@bugs.debian.org, 101433-done@bugs.debian.org, 113812-done@bugs.debian.org, 219695-done@bugs.debian.org, 294890-done@bugs.debian.org
Cc: Martin Schulze <joey@debian.org>, Michael Kerrisk <mtk-manpages@gmx.net>
Subject: fixed in recent uploads of manpages
Date: Tue, 22 Nov 2005 11:35:39 -0500
Version: 2.09-1

These bugs are all reported fixed by the upstream manpages maintainer,
Michael Kerrisk.  For my own convenience, I'm marking them all as
"fixed by version 2.09-1", even though some of them are fixed by
earlier uploads.  The bug number, correct fixed-in version, and title
are listed below:

 #317037 2.06 Difficult to understand in sscanf RETURN VALUE
 #315411 2.09 New upstream release: 2.09
 #209323 2.09 please include pty(4) manpage
 #330877 2.09 read can return EINVAL when using O_DIRECT and buffer not aligned
 #321131 2.08 exit.3 missing &quot;is&quot;
 #299795 2.07 Some library functions' manpage use wrong hyphen
 #295666 2.03 regex.7.gz: The word boundary regexps are unsupported
 #326520 2.08 'man msgget' typo: one line not displayed
 #306517 2.04 epoll_ctl(2) description differs from implementation
 #291121 2.04 flock(2) second time by same process
 #323851 2.08 getpwnam.3 manpage should clarify the scope of pw_dir
 #323062 2.08 clone(2) CLONE_PARENT_SETTID description incorrect

 #101433 2.04 "man setitimer" give bad informations
 #113812 2.04 libc6-dev: iconv prototype
 #317037 2.06 Difficult to understand in sscanf RETURN VALUE
 #219695 2.04 sysconf(3): describes _SC_2_DEV, which doesn't exist
 #294890 2.03 Typo in wait(2): "watpid"

-- 
Clear skies,
Justin



Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sun, 24 Jun 2007 20:17:37 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 01:11:18 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.