chitralverma commented on PR #9379:
URL: https://github.com/apache/opendal/pull/9379#issuecomment-7257031379

   (AI-generated reply)
   
   Re [your 
review](https://github.com/apache/opendal/pull/9379#pullrequestreview-6103186572):
 fixed in 6979cc6654004cf408ca4349de53697cf8938141 as a fixup commit. It sits 
on top of 0aa1a40, which merges main at f8d039a (#9378, which changes only C++ 
output; regenerating C and Go gives no diff from it).
   
   The `length` doc is rendered by C's `opendal_read_options.length` and 
`opendal_read_options_set_range`, and by Go's `ReadWithRange`. It now reads:
   
   > Read this many bytes from `offset`.
   >
   > A `length` of `0` validates the other options, then returns an empty 
buffer without accessing storage. When `length` is positive, a file that ends 
before `offset` plus `length` fails the read.
   
   This follows the Python wording from #9377 ("When `size` is positive, …"). 
The generator's doc test expects the new sentence as a literal. With the old 
sentence put back in the generator, `test_docs_come_from_core` fails at "C 
member `length`".
   
   I reproduced the cases through C (`opendal_operator_read_with`) and Go 
(`Operator.Read`) on builds of the head, reading the 6-byte file `abcdef` on 
`memory` and `fs`, each with and without `chunk` = 4:
   - Offset 7 or 6, length 0: empty buffer.
   - Offset 7 or 6, length 1: `OPENDAL_RANGE_NOT_SATISFIED` in C, 
`CodeRangeNotSatisfied` in Go.
   - Offset 4, length 4: `OPENDAL_UNEXPECTED` / `CodeUnexpected`, except on 
`fs` with `chunk`, which returns `OPENDAL_RANGE_NOT_SATISFIED` / 
`CodeRangeNotSatisfied`.
   - Offset 4, length 2: `ef`.
   
   Tests: `tests/read.cpp` and `options_test.go` now also read the 16-byte 
memory file at offset 17:
   - With length 0 and `chunk` = 4, the read must return an empty buffer.
   - With length 1, the read must fail with `RangeNotSatisfied`.
   
   A scratch conversion that treats a zero `length` as unset fails both tests, 
because with `chunk` the resulting open-ended read from offset 17 fails.
   
   Checks on 6979cc6:
   - Every `ci_odev.yml` generator plus every binding's `cargo fmt`, then `git 
diff --exit-code`: clean.
   - `dev`: fmt, clippy `-D warnings`, and `cargo test` (152 passed).
   - `bindings/c`: clippy `--all-targets -D warnings`, `cargo test` (26 
passed), and the ASan CMake build with GCC 16, where `tests` passed 36 of 36.
   - `bindings/go`: golangci-lint 2.12.2 (0 issues) and `go test .` against the 
C library (89 passed).
   - The C and Go test steps also pass in an Ubuntu 24.04 arm64 container.
   
   The PR description now covers these cases.


-- 
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]

Reply via email to