JunaidAhamed-7777 opened a new pull request, #2204:
URL: https://github.com/apache/libcloud/pull/2204
### Description
`NoOpLockLocalStorage.__exit__` returns the exception object. A truthy
return suppresses that exception, so disabling locking can cause a failed
upload to report success. Return `False` so the original error propagates.
The regressions cover a source stream that yields data and then raises
`OSError`, a missing source file uploaded over an existing destination, and a
successful streamed upload with locking disabled.
### Reproduction
On `trunk` at `bd9cbb3e393bc42f57684481e7c62e9293007584`, Python 3.12.14 on
Linux:
```python
import tempfile
from libcloud.storage.drivers.local import LocalStorageDriver
def chunks():
yield b"partial data"
raise OSError("source stream failed")
with tempfile.TemporaryDirectory() as root:
driver = LocalStorageDriver(root, ex_use_locking=False)
container = driver.create_container("example")
obj = driver.upload_object_via_stream(chunks(), container, "object")
print(obj.size) # 12; the OSError was suppressed
```
With this change, the original `OSError` propagates. This does not change
partial-file cleanup or the locking-enabled implementation. The bug report is
included here; there is no separate tracking issue.
### Status
Draft. Human review and hosted CI are pending.
### Validation
- Both error regressions fail on the unmodified production code; the success
control passes.
- `pytest -q libcloud/test/storage/test_local.py
libcloud/test/storage/test_base.py`: **35 passed**.
- Black, isort, flake8 and `git diff --check` pass for the changed files.
- Storage-package Pylint passes using the repository's error-only
configuration and driver plugin.
- Full provider tests, other Python versions and live cloud integration
tests were not run.
### Checklist
- [x] Code linting (scope above)
- [ ] Documentation (no API addition)
- [x] Tests
- [ ] ICLA (not signed; small bug fix)
AI assistance: the fix, regression tests and this description were prepared
with OpenAI Codex. Human review is pending.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]