Bug 103717 - lockf function doesn't comply with Single Unix Specification
Summary: lockf function doesn't comply with Single Unix Specification
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: kernel (Show other bugs)
(Show other bugs)
Version: 2.1
Hardware: i686 Linux
medium
medium
Target Milestone: ---
Assignee: Jim Paradis
QA Contact: Brian Brock
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-09-04 08:53 UTC by Unai Uribarri Rodríguez
Modified: 2013-08-06 01:02 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-06-08 21:39:05 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Unai Uribarri Rodríguez 2003-09-04 08:53:23 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624

Description of problem:
lockf returns EINVAL if the third argument of the function lockf, len, is
negative, if running a kernel < 2.4.21 (currently, I'm using redhat
kernel-2.4.9-e.3)

All the versions of the Single Unix Specification says that, when len is
negative, lockf must affect "the preceding bytes up to but not including the
current offset".


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Call lockf with a negative len argument
2.
3.
    

Actual Results:  lockf return -1, errno==EINVAL.

Expected Results:  lockf must return 0.

Additional info:

Comment 1 Unai Uribarri Rodríguez 2003-09-04 08:54:35 UTC
The glibc version is glibc-2.2.4-26.

Comment 2 Jakub Jelinek 2003-09-04 09:12:22 UTC
glibc lockf just calls fcntl in the kernel.

Comment 3 Arjan van de Ven 2003-09-04 09:19:27 UTC
if we change this, we change behavior to userspace, which is something we don't
want within a stable product release.

Comment 4 Unai Uribarri Rodríguez 2003-09-04 09:39:59 UTC
It isn't needed to change the kernel. You can call traslate the negative length
in lockf to a negative start and a positive length to fcntl, for example:

struct flock flock;
/* ... */
if (len < 0)
{
  flock.l_start = len
  flock.l_len = -len;
}
else
{
  flock.l_start = 0;
  flock.l_len = len;
}

Comment 5 Jim Paradis 2006-06-08 21:39:05 UTC
RHEL2.1 is currently accepting only critical security fixes.  This issue is
outside the current scope of support.


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