-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent panic if fileinfo is nil #4850
Conversation
@@ -127,6 +128,9 @@ func absDuration(x time.Duration) time.Duration { | |||
|
|||
func count(basedir string, recursive bool, countFn countFunc) error { | |||
walkFn := func(path string, file os.FileInfo, err error) error { | |||
if file == nil { | |||
return fmt.Errorf("Nil file found at %q", path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the err argument and return it, I think it should have a better error string.
is this patch active in nightly build? |
7c4f2f6
to
ce9f95e
Compare
@c1982 Not just yet, but I can give you a link to a CI build if you tell me which one you need. |
ce9f95e
to
8f67a2e
Compare
amd64/Windows |
I imagine you will still have an error reported to the log, just no more crash. It would be interesting to see what is logged. Here is the build: |
Yes. I tested your version in production. Local service it was not crash. is good. May be help for fix:
This is SMTP queue. So, file is very quickly created and deleted in folder. Plugin try read file attributes but file is gone. Is possible will add config parameters for attributes reading disabled? |
We may do this at some point, but I believe will have to stop using the standard library function to walk the directory. It may also conflict with the idea to add file size #4852 but we could make it optional. In the meantime, I think we should update this PR to call |
(cherry picked from commit 9cc534c)
Thanks. os.IsNotExist(err) condition better than config parameter solution. |
Resolves #4845