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 Cezary.Wagner
Recipients Cezary.Wagner, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-06-25.12:02:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1593086522.02.0.759376462848.issue41106@roundup.psfhosted.org>
In-reply-to
Content
Use case - detection of changes in open files is very important - log scanning - synchronization ...

I think that first of all it is need good unit test to detect this problem (rare edge case - probably it is missed because hard to imagine that it can not work when file is open - I will miss this I think).

It should work like this.

First program is writing file under Windows and second program (unit test) is running os.scandir() if repeated os.scandir() detect changes it is O.K. (same like in Linux).

To make it simpler it can be unit test in one program.

1. Open test file in test directory.
2. os.scandir() in test directory.
3. Some writes to test file (f.write() with and without flush, ... - to be defined what is sufficient to test).
4. os.scandir() in test directory - if change detected it O.K.
5. f.close()

I do not know Windows API now but I think we can detect id directory is changed between scans or we can detect if file is open (it is rare situation - rare edge case) in 90% all files will be closed.

So if all files is closed current os.scandir() maybe is good (not I do not understand implementation to evaluate it correclty) and when one of file or more there is need another implementation which will detect modification.

If you think I missed something please comment. You are welcome.
History
Date User Action Args
2020-06-25 12:02:02Cezary.Wagnersetrecipients: + Cezary.Wagner, paul.moore, tim.golden, zach.ware, eryksun, steve.dower
2020-06-25 12:02:02Cezary.Wagnersetmessageid: <1593086522.02.0.759376462848.issue41106@roundup.psfhosted.org>
2020-06-25 12:02:02Cezary.Wagnerlinkissue41106 messages
2020-06-25 12:02:01Cezary.Wagnercreate