New submission from Marat Sharafutdinov <deca...@gmail.com>:
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. ---------- components: Build messages: 335275 nosy: decaz priority: normal severity: normal status: open title: os.DirEntry.inode() returns invalid value within Docker container type: behavior versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35974> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com