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.

Author decaz
Recipients decaz
Date 2019-02-11.23:11:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1549926682.07.0.790537148313.issue35974@roundup.psfhosted.org>
In-reply-to
Content
I'm trying to build Python 3.7.2 within official CentOS 7.6.1810 image (https://hub.docker.com/_/centos) and getting the following error during testing:

======================================================================
FAIL: test_attributes (test.test_os.TestScandir)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/src/python/Lib/test/test_os.py", line 3367, in test_attributes
    self.check_entry(entry, 'dir', True, False, False)
  File "/usr/src/python/Lib/test/test_os.py", line 3319, in check_entry
    os.stat(entry.path, follow_symlinks=False).st_ino)
AssertionError: 28093768 != 85098458

I guess this bug applies to Docker containers in general. For instance it's reproduced with the official Python 3.7.2-stretch image based on the Debian Stretch (https://hub.docker.com/_/python):

$ docker run --rm -it python:3.7.2-stretch
Python 3.7.2 (default, Feb  6 2019, 12:04:03) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.mkdir('/test_dir')
>>> for entry in os.scandir('/'):
...   if entry.name == 'test_dir':
...     break
... 
>>> print(entry, entry.inode(), os.stat(entry.path, follow_symlinks=False).st_ino)
<DirEntry 'test_dir'> 23898155 85118011
>>> assert entry.inode() == os.stat(entry.path, follow_symlinks=False).st_ino
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError
>>> 

In case of using host volume when running container it works ok, - the problem occurs when using default Docker volume:

$ docker run --rm -it -v /home/decaz/workspace:/host_dir python:3.7.2-stretch
Python 3.7.2 (default, Feb  6 2019, 12:04:03) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.mkdir('/host_dir/test_dir')
>>> for entry in os.scandir('/host_dir'):
...   if entry.name == 'test_dir':
...     break
... 
>>> print(entry, entry.inode(), os.stat(entry.path, follow_symlinks=False).st_ino)
<DirEntry 'test_dir'> 12873222 12873222
>>> assert entry.inode() == os.stat(entry.path, follow_symlinks=False).st_ino
>>> 

Similar issue - https://bugs.python.org/issue32811.
History
Date User Action Args
2019-02-11 23:11:22decazsetrecipients: + decaz
2019-02-11 23:11:22decazsetmessageid: <1549926682.07.0.790537148313.issue35974@roundup.psfhosted.org>
2019-02-11 23:11:22decazlinkissue35974 messages
2019-02-11 23:11:21decazcreate