Treat STATUS_NO_SUCH_FILE as end of enumeration#358
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #358 +/- ##
==========================================
- Coverage 98.78% 98.73% -0.06%
==========================================
Files 24 24
Lines 5288 5288
==========================================
- Hits 5224 5221 -3
- Misses 64 67 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Does this actually happen in real life with an SMB implementation I don't know of? I tried it against a Windows host and it didn't report this error just no items to yield. The fact that the test has to have a mock to represent this type of error also tells me that maybe Samba doesn't do this. While the comment indicate that MS-SMB2 shows |
548ef8c to
2b5c51b
Compare
It happens with samba. New integration tests should be failing before the change. Also enabling debug logs should make it visible. |
Ah I see, it was the non-matching pattern that did the trick. I was just doing Would it be possible to adjust the comments to state this occurs when the pattern doesn't match any files. You can keep the reference saying it may also occur on other servers normally but I just want to be clear when it normally happens in the code. |
MS-SMB2 3.3.5.18 permits servers to terminate QUERY_DIRECTORY with either STATUS_NO_MORE_FILES or STATUS_NO_SUCH_FILE. Samba returns the latter on a non-matching pattern, but existing code caught only the first. The escaping NoSuchFile is not an OSError subclass, so it slips past os-style except clauses and rmtree's ignore_errors.
2b5c51b to
e68d4f5
Compare
|
Better now? |
|
Yea looks great.
Thank you very much for testing these things out and sending the PRs. I greatly appreciate them being in small chunks as it helps to review them when I find some spare time. Let me know when you think you are nearing the end and I'll prep a new release. |
MS-SMB2 3.3.5.18 permits servers to terminate QUERY_DIRECTORY
with either STATUS_NO_MORE_FILES or STATUS_NO_SUCH_FILE. Samba
returns the latter on a non-matching pattern, but existing code
caught only the first. The escaping NoSuchFile is not an
OSError subclass, so it slips past os-style except clauses and
rmtree's ignore_errors.