homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_posix.test_fs_holes() fails on FreeBSD 9.0
Type: Stage: resolved
Components: Tests Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: jcea Nosy List: aklauer, amaury.forgeotdarc, benjamin.peterson, eitan.adler, georg.brandl, jcea, koobs, loewis, pitrou, python-dev, rhettinger, skrah, terry.reedy, vstinner
Priority: normal Keywords:

Created on 2012年12月04日 08:49 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (7)
msg176882 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012年12月04日 08:49
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%203.x/builds/761/steps/test/logs/stdio
======================================================================
FAIL: test_fs_holes (test.test_posix.PosixTester)
----------------------------------------------------------------------
Traceback (most recent call last):
 File "/usr/home/buildbot/python/3.x.koobs-freebsd/build/Lib/test/test_posix.py", line 1003, in test_fs_holes
 self.assertLessEqual(size, os.lseek(fno, i, os.SEEK_HOLE))
AssertionError: 5 not less than or equal to 0
--
See also the issue #10142 which added this feature. I copied the nosy list of this issue.
msg176922 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2012年12月04日 16:16
This is likely a FreeBSD 9 kernel bug.
Using this code under python 3, on a ZFS filesystem:
"""
import os
f = open("test", "wb")
f.write(b"hello")
f.flush()
print(os.lseek(f.fileno(), 3, os.SEEK_HOLE))
"""
Under Solaris, the reply is 5, pointing to the end of the file.
Under current FreeBSD 9, it replies "3". In fact, it replies back current file offset.
This is wrong according to "lseek" man:
"""
[...]
 o If whence is SEEK_HOLE, the **offset of the start of the**
 **next hole greater than or equal to the supplied offset**
 **is returned**. The definition of a hole is provided near
 the end of the DESCRIPTION.
[...]
 A "hole" is defined as a contiguous range of bytes in a
 file, all having the value of zero, but not all zeros in a
 file are guaranteed to be represented as holes returned with
 SEEK_HOLE. Filesystems are allowed to expose ranges of zeros
 with SEEK_HOLE, but not required to. Applications can use
 SEEK_HOLE to optimise their behavior for ranges of zeros,
 but must not depend on it to find all such ranges in a file.
 **The existence of a hole at the end of every data region**
 **allows for easy programming and implies that a virtual hole**
 **exists at the end of the file.** Applications should use
 fpathconf(_PC_MIN_HOLE_SIZE) or pathconf(_PC_MIN_HOLE_SIZE)
 to determine if a filesystem supports SEEK_HOLE. See fpath-
 conf(2).
 **For filesystems that do not supply information about holes,
 the file will be represented as one entire data region.**
"""
So FreeBSD has two bugs:
1. It is giving an error if the filesystem doesn't support holes. The correct behavious SHOULD report a hole at the end of the file.
2. In a file without holes, on a filesystem supporting holes (ZFS), FreeBSD 9 is returning current file offset for SEEK_HOLE, instead of reporting offset = filesize. Consistent with the "virtual hole" at the end of the file.
koobs, can you report to FreeBSD guys?.
In the meantime we could apply a "SkipIf" to this test, to skio FreeBSD 9 (for now).
Ideas?
msg176923 - (view) Author: Kubilay Kocak (koobs) (Python triager) Date: 2012年12月04日 16:22
I'll take care of upstream and report back with PR numbers. Happy with the skipIf until resolved. Thanks for your time and patience jcea, much appreciated.
msg176924 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2012年12月04日 16:24
koobs, do you want the SkipIf now?. Maybe having a red buildbot can contribute push FreeBSD kernel guys :)
msg176925 - (view) Author: Kubilay Kocak (koobs) (Python triager) Date: 2012年12月04日 16:28
Give me till the end of the weekend, will ping you for the skipIf then if I haven't made progress. Thank you again.
msg176975 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2012年12月05日 11:37
FreeBSD Buildbot has been updated to 9.1, and the issue is solved. This was clearly a 9.0 kernel bug.
Closing bug as "Invalid".
Thanks for triaging this, Koobs.
msg176976 - (view) Author: Kubilay Kocak (koobs) (Python triager) Date: 2012年12月05日 11:38
I have just upgraded the buildbot host to FreeBSD 9.1-RELEASE and cannot see failures in the 3.x and 3.3 branches over the last couple of builds.
I have been unable to isolate the commit that fixed it, but the relevant revision log is here if anybody wants to cast an eye over it for confirmation
http://svnweb.freebsd.org/base/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c?view=log 
History
Date User Action Args
2022年04月11日 14:57:39adminsetgithub: 60809
2012年12月05日 11:38:02koobssetmessages: + msg176976
2012年12月05日 11:37:15jceasetstage: resolved
2012年12月05日 11:37:03jceasetstatus: open -> closed
resolution: not a bug
messages: + msg176975
2012年12月05日 00:24:47eitan.adlersetnosy: + eitan.adler
2012年12月04日 16:28:16koobssetmessages: + msg176925
2012年12月04日 16:25:26jceasetassignee: jcea
2012年12月04日 16:24:41jceasetmessages: + msg176924
versions: + Python 3.3
2012年12月04日 16:22:55koobssetmessages: + msg176923
2012年12月04日 16:16:08jceasetmessages: + msg176922
2012年12月04日 09:54:11koobssetnosy: + koobs
2012年12月04日 08:49:16vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /