gofrs / flock

Thread-safe file locking library in Go
https://pkg.go.dev/github.com/gofrs/flock
BSD 3-Clause "New" or "Revised" License
578 stars 66 forks source link

fix: missing read-write flag in reopenFDOnError #95

Closed crazy-max closed 3 months ago

crazy-max commented 3 months ago

relates to https://github.com/docker/buildx/issues/2593

seems a regression introduced in https://github.com/gofrs/flock/commit/b659e1e00ac3f430ee58fbfc49f69a9a3b45178c that removes read-write flag: https://github.com/gofrs/flock/commit/b659e1e00ac3f430ee58fbfc49f69a9a3b45178c#diff-87c2c4fe0fb43f4b38b4bee45c1b54cfb694c61e311f93b369caa44f6c1323ffR192

cc @ldez

ldez commented 3 months ago

:thinking: technically the retry should use the same flag as the setFh, so, for me, the previous behavior has a problem.

ldez commented 3 months ago

I think I understand now, it's inspired by util-linux: it's not a "classic" retry but a specific case retry.