files_lock
files_lock copied to clipboard
BUG: "Extending" infinite locks leads to TTL of 1 second.
The following lines contain a very nasty bug, when the default of inifinte lock-timeout is just left as is:
https://github.com/nextcloud/files_lock/blob/f990ca0e19c331fe2c3212a5c76ac3f999a10a03/lib/Service/LockService.php#L170-L172
If these are executed with infinite lock-timeout, then we have
$known->getTimeout() === 0$known->getETA() === FileLock::ETA_INFINITE === -1$this->configService->getTimeoutSeconds() === 0
Hence the timeout calculation leads to 0 - (-1) + 0 === 1. This means that the lock is killed in the next clean up operation. The must instead check for ETA_INFINITE and act accordingly.