This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/12723] New: pathconf for a FIFO returns a different value than fpathconf
- From: "stewb at linuxfoundation dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Mon, 2 May 2011 13:32:23 +0000
- Subject: [Bug libc/12723] New: pathconf for a FIFO returns a different value than fpathconf
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=12723
Summary: pathconf for a FIFO returns a different value than
fpathconf
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper.fsp@gmail.com
ReportedBy: stewb@linuxfoundation.org
If one calls pathconf of a FIFO, you get a different value than you do from
fpathconf:
int fd151, fd152, fd161, fd162;
long p151, p152, p161, p162;
const char f15[15] = "fpathconf-t.15";
const char f16[15] = "fpathconf-t.16";
const char dot[2] = ".";
fd151 = open(f15, O_RDONLY|O_NONBLOCK);
p151 = fpathconf(fd151, _PC_PIPE_BUF);
p152 = pathconf(f15, _PC_PIPE_BUF);
if(p151 != p152) {
printf("test15 FAIL - fpathconf for '%s' (%ld) does not equal pathconf for
'%s' (%ld) \n", f15, p151, f15, p152);
} else {
printf("test15 PASS - fpathconf for '%s' (%ld) equals pathconf for '%s'
(%ld) \n", f15, p151, f15, p152);
}
test15 FAIL - fpathconf for 'fpathconf-t.15' (65536) does not equal pathconf
for 'fpathconf-t.15' (4096)
This would seem to have started about the time of this change:
commit 8a492a675e566dc1e666df0a86cbf541442cb179
Author: Ulrich Drepper <drepper@redhat.com>
Date: Tue Jul 6 07:48:23 2010 -0700
Implement _PC_PIPE_BUF.
Now that the kernel has appropriate support we can implement this
fpathconf command correctly.
Also, according to SUSv3, the result from fpathconf for a directory should be
the same as for a FIFO in that directory. This also seems to have changed:
"6. If path refers to a FIFO, or fildes refers to a pipe or FIFO, the value
returned shall apply to the referenced object. If path or fildes refers to a
directory, the value returned shall apply to any FIFO that exists or can be
created within the directory. If path or fildes refers to any other type of
file, it is unspecified whether an implementation supports an association of
the variable name with the specified file."
fd161 = open(dot, O_RDONLY);
fd162 = open(f16, O_RDONLY|O_NONBLOCK);
p161 = fpathconf(fd161, _PC_PIPE_BUF);
p162 = fpathconf(fd162, _PC_PIPE_BUF);
if(p161 != p162) {
printf("test16 FAIL - fpathconf for '%s' (%ld) does not equal fpathconf
for '%s' (%ld) \n", dot, p161, f16, p162);
} else {
printf("test16 PASS - fpathconf for '%s' (%ld) equals fpathconf for '%s'
(%ld) \n", dot, p161, f16, p162);
}
test16 FAIL - fpathconf for '.' (4096) does not equal fpathconf for
'fpathconf-t.16' (65536)
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.