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: os.listdir loses on linux w/NTFS vols
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: fdrake Nosy List: fdrake, loewis, ukekuma
Priority: normal Keywords:

Created on 2001-06-19 14:48 by ukekuma, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (7)
msg5113 - (view) Author: jeremy bornstein (ukekuma) Date: 2001-06-19 14:48
os.listdir() on a directory which is on an NTFS volume
omits one entry from the directory listing.

Example:

planet {188}: grep ntfs /etc/fstab
/dev/hda1               /lose                   ntfs   
uid=500,gid=500,umask=555	1 2
planet {189}: ls /lose
Documents and Settings/  My Music/  Program Files/ 
PUTTY.RND  $Secure  unzipped/  WINNT/
planet {190}: python2.1
Python 2.1 (#1, Jun 19 2001, 00:32:28) 
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on
linux2
Type "copyright", "credits" or "license" for more
information.
>>> import os
>>> os.listdir('/lose')
['$Secure', 'Documents and Settings', 'My Music',
'Program Files', 'PUTTY.RND', 'unzipped']
>>> 
planet {191}:

(In the example, note that the directory 'WINNT' is not
returned by os.listdir.)

I have verified this bug with/1.5.2, 1.6.1, and 2.1 on
Linux (RH7.1) only.  I have only tested it on this one
NTFS volume and this one computer.

msg5114 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2001-06-23 19:45
Logged In: YES 
user_id=21627

This is likely a bug in the NTFS driver, not in Python.
msg5115 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2001-07-04 06:54
Logged In: YES 
user_id=3066

Assigning this to me since I have a similar setup.
msg5116 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2001-07-11 18:33
Logged In: YES 
user_id=3066

I was not able to reproduce this on my system (Mandrake 7.2,
Linux 2.2.17).  This may be a difference in configuration: I
have an NTFS partition, but it's not the one that contains
my \WINNT directory.  If \WINNT is special in some way, I
can't reproduce that.

See also Martin's comment; he's likely to know exactly what
he's talking about.  I'm going to close this as
irreproducible, acknowledging that it might really be a
third-party bug.
msg5117 - (view) Author: jeremy bornstein (ukekuma) Date: 2001-07-12 00:49
Logged In: YES 
user_id=248973

I noticed that it was always the *final* directory entry
which was not displayed. I don't think the problem has
anything to do with the WINNT directory specifically, other
than it the fact that it was the last one.
msg5118 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2001-07-12 01:14
Logged In: YES 
user_id=3066

What's really strange is that Python & ls are returning
different results.  Python is just using
opendir/readdir/closedir for Linux; I've not read the ls
sources to know what that's doing (but it should be
considered buggy if that's not what it's doing!).

Now, if we could get Martin interested in working on the
Linux NTFS driver again...
msg5119 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2001-07-17 11:23
Logged In: YES 
user_id=21627

I have a similar report that tab-completion in the shell
(bash?) will sometimes refuse to return the last directory
entry, on an NTFS.

To find out what ls is doing, I recommend to use strace. I
currently don't even have a system with Linux and NT
installed simultaneously, so I cannot help much.
History
Date User Action Args
2022-04-10 16:04:08adminsetgithub: 34648
2001-06-19 14:48:41ukekumacreate