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: Skip os.utime() test on NFS?
Type: Stage: resolved
Components: Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, ischwabacher, larry, pitrou, python-dev, skip.montanaro
Priority: normal Keywords: patch

Created on 2014-05-12 16:48 by skip.montanaro, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_import.patch ischwabacher, 2015-03-02 00:10 Patch to skip os.utime() when utime returns EINVAL
test_import.patch ischwabacher, 2015-03-05 23:08 Fixed truncated line review
Messages (11)
msg218336 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2014-05-12 16:48
I got a strange error during "make test" in a fresh build (hg clone ;
./configure ; make ; make test)

Traceback (most recent call last):
  File "Lib/test/test_import.py", line 293, in test_timestamp_overflow
    os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5))
OSError: [Errno 22] Invalid argument

It took me a little while to figure out what was wrong. A simple check
succeeded:

>>> import os
>>> os.utime("/tmp/trash", (2 ** 33 - 5, 2 ** 33 - 5))
>>> 2**33-5
8589934587

After a bit of poking around, I realized test.support.TESTFN is on an
NFS filesystem in my work environment:

>>> import importlib
>>> from test.support import TESTFN
>>> TESTFN
'@test_31576_tmp'
>>> import sys
>>> sys.path.insert(0, os.curdir)
>>> source = TESTFN + ".py"
>>> compiled = importlib.util.cache_from_source(source)
>>> compiled
'__pycache__/@test_31576_tmp.cpython-35.pyc'
>>> open(source, 'w')
<_io.TextIOWrapper name='@test_31576_tmp.py' mode='w' encoding='ANSI_X3.4-1968'>
>>> source
'@test_31576_tmp.py'
>>> os.path.getmtime(source)
1399912946.9349897
>>> 2**33-5
8589934587
>>> os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument
>>> os.utime("/tmp/trash", (2 ** 33 - 5, 2 ** 33 - 5))
>>> os.curdir
'.'
>>> os.getcwd()
'/home/skipm/3rdParty/python/cpython'
>>>
blade% df -h .
Filesystem                          Size  Used Avail Use% Mounted on
nfshost3:/global/export/home/skipm  2.1T  1.5T  639G  71% /home/skipm

Should this test be skipped on NFS-mounted filesystems? Or should the
test environment try to insure TESTFN is created on a local
filesystem?

Skip
msg218417 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-05-13 09:04
Or we could simply catch the EINVAL failure and then skip the test.
I suppose the filesystem doesn't support timestamps > 2**32 ?
msg218420 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-05-13 09:21
Antoine's plan sounds good to me.  And, is it true that NFS only supports four-byte timestamps?
msg218431 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2014-05-13 10:50
> Or we could simply catch the EINVAL failure and then skip the test.
> I suppose the filesystem doesn't support timestamps > 2**32 ?

Just in that one test? If I passed -1 that would probably also
generate EINVAL (haven't tested).

I'll have to check with the admins to see if this particular
filesystem is NFS3 or NFS4. I'm guessing 2**32 might be the max for
the former. The latter causes us all sorts of other heartburn though,
so even though it might be "more modern" in this regard, we don't use
it much.
msg236998 - (view) Author: Isaac Schwabacher (ischwabacher) * Date: 2015-03-02 00:10
Patch to do precisely this.  Wish I'd spent more time searching for this thread and less time debugging; it would have saved me a lot of trouble.
msg237306 - (view) Author: Isaac Schwabacher (ischwabacher) * Date: 2015-03-05 23:08
...and fixed a spot where git diff + copy/paste truncated a long line.  /sheepish
msg241735 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2015-04-21 19:24
Any chance this will make it into 3.5? It's not a big deal, but I notice that it's still present in 3.5.0a4.
msg241738 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2015-04-21 19:56
Issac doesn't have commit bit...

... but you do.
msg241740 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2015-04-21 20:10
On Tue, Apr 21, 2015 at 2:56 PM, Larry Hastings <report@bugs.python.org> wrote:
> Issac doesn't have commit bit...
>
> ... but you do.

Alas, my commit bit long ago fell into disuse. I haven't checked
anything in since long before the days of Mercurial and the current
workflow. I would almost certainly mess something up. In fact, to
avoid confusion in the future, removal of my commit bit might not be a
bad idea.
msg241788 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-04-22 08:31
New changeset aa60f4d1a569 by Berker Peksag in branch 'default':
Issue #21483: Skip test_timestamp_overflow on NFS.
https://hg.python.org/cpython/rev/aa60f4d1a569
msg241789 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-04-22 08:32
Thanks Isaac.
History
Date User Action Args
2022-04-11 14:58:03adminsetgithub: 65682
2015-04-22 08:32:41berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg241789

resolution: fixed
stage: resolved
2015-04-22 08:31:53python-devsetnosy: + python-dev
messages: + msg241788
2015-04-21 20:10:13skip.montanarosetmessages: + msg241740
2015-04-21 19:56:42larrysetmessages: + msg241738
2015-04-21 19:24:03skip.montanarosetmessages: + msg241735
2015-03-05 23:08:23ischwabachersetfiles: + test_import.patch

messages: + msg237306
2015-03-02 00:10:17ischwabachersetfiles: + test_import.patch

nosy: + ischwabacher
messages: + msg236998

keywords: + patch
2014-05-13 10:50:20skip.montanarosetmessages: + msg218431
2014-05-13 09:21:04larrysetmessages: + msg218420
2014-05-13 09:04:38pitrousetnosy: + larry
2014-05-13 09:04:29pitrousetnosy: + pitrou
messages: + msg218417
2014-05-12 16:48:28skip.montanarocreate