Skip to content
TheChatArchiveThe Chat Archive
GLMz-ai/glm-5.2· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [BUG] S3 GetObject suffix range fails for empty objects Service S3 AWS…

  1. User

    ISSUE DESCRIPTION

    [BUG] S3 GetObject suffix range fails for empty objects

    Service

    S3

    AWS API Action

    GetObject with the Range header set to a suffix byte range, for example bytes=-1.

    Expected behavior

    A suffix range request against an existing empty object should not fail the read. This is exercised by Trino's S3 filesystem compatibility test for empty files, where TrinoInput.readTail(...) reads an existing zero-byte S3 object and expects an empty successful read.

    Actual behavior

    Floci returns 416 InvalidRange for the same request because S3Controller.handleRangeRequest computes start = 0 and end = -1 for an empty object, then rejects the range.

    In Trino's Floci-backed S3 filesystem test this surfaces as:

    software.amazon.awssdk.services.s3.model.S3Exception: The requested range is not satisfiable. (Service: S3, Status Code: 416)
    

    Reproduction

    # Start Floci on localhost:4566 first.
    aws --endpoint-url http://localhost:4566 s3 mb s3://range-empty-repro
    printf '' > /tmp/empty-object
    aws --endpoint-url http://localhost:4566 s3 cp /tmp/empty-object s3://range-empty-repro/empty
    aws --endpoint-url http://localhost:4566 s3api get-object \
      --bucket range-empty-repro \
      --key empty \
      --range 'bytes=-1' \
      /tmp/range-empty-output
    

    Environment

    • Floci version / image tag: floci/floci:1.5.21
    • Java SDK version (if applicable): observed with Trino's AWS SDK v2 S3 client tests
    • How you're running Floci (Docker / native / mvn quarkus:dev): Docker via Testcontainers

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /floci, current file: none) bash-$

  2. GLM Assistant

    I'll start by exploring the repository structure to understand the codebase.

  3. GLM Assistant

    Let me find the S3Controller and the handleRangeRequest method.

  4. GLM Assistant

    Now I understand the structure. Let me look at the existing tests for range requests to understand the expected behavior.

  5. GLM Assistant

    Let me look at the test setup to understand the object that's being used, and check for any empty object setup.

  6. GLM Assistant

    Let me view the rest of the range tests.

  7. GLM Assistant

    Let me look at the compatibility tests directory to understand how S3 range behavior is tested there.

  8. GLM Assistant

    Let me look at the test class header to understand the testing framework used.

  9. GLM Assistant

    Let me look at the appendObjectHeaders method and its overloads to understand the checksum behavior.

  10. GLM Assistant

    Now let me reproduce the issue first. Let me check how to run a single test and verify the build works.

  11. GLM Assistant

    Let me check the build setup and try running an existing range test to confirm the environment works.

  12. GLM Assistant

    Let me create a temporary reproduction test to confirm the bug.

  13. GLM Assistant

    I've confirmed the bug — the suffix range request on an empty object returns 416. Now let me apply the fix.

  14. GLM Assistant

    I've confirmed the bug. Now let me apply the fix in handleRangeRequest to handle empty objects.

  15. GLM Assistant

    Let me use the edit command instead.

  16. GLM Assistant

    The fix is applied. Now let me run the reproduction test again to confirm the fix.

  17. GLM Assistant

    The fix works. Let me expand the temporary test to verify edge cases — that valid ranges on empty objects succeed, malformed ranges still return 416, and the suffix-range normalization still works for non-empty objects.

  18. GLM Assistant

    The RestAssured header matcher syntax doesn't compile. Let me simplify that assertion.

  19. GLM Assistant

    All edge cases pass. Now let me run the full existing S3IntegrationTest to ensure I didn't break anything.

  20. GLM Assistant

    Let me check whether this copyObjectWithNonAsciiKeySucceeds failure is pre-existing (unrelated to my change). Let me look at the test and run it in isolation.

  21. GLM Assistant

    This failure is at line 372 (PUT of a non-ASCII key), which is unrelated to my handleRangeRequest change. Let me verify it's pre-existing by checking against the original code using git stash.

  22. GLM Assistant

    The test failed on the original code too, confirming it's pre-existing. But running a single test in isolation may behave differently. Let me run the full S3IntegrationTest on the original code (with my change stashed) to confirm copyObjectWithNonAsciiKeySucceeds fails there too.

  23. GLM Assistant

    Confirmed — copyObjectWithNonAsciiKeySucceeds fails identically on the original code (same line 372, 1 failure of 98). This is a pre-existing failure unrelated to my change (it's about non-ASCII key handling in PUT, not range requests). My change introduces zero new failures.

    Let me also verify the copy-source-range path (used by CopyObject with x-amz-copy-source-range) isn't affected, since there's separate range logic there. Let me check it.

  24. GLM Assistant

    The copy-source-range logic lives in S3Service.java (a separate method for UploadPartCopy), not in handleRangeRequest, so it's unaffected. Let me run the multipart S3 test to be thorough.

  25. GLM Assistant

    Multipart tests pass. Let me also run the presigned URL tests since they exercise the same GetObject endpoint.

  26. GLM Assistant

    All S3 tests pass (except the pre-existing unrelated non-ASCII failure). Now let me remove the temporary reproduction test file before submitting.

  27. GLM Assistant

    Let me review the final diff to confirm the change is clean.

  28. GLM Assistant

    The diff is clean and minimal. Let me view the complete updated method one final time to confirm correctness.

  29. GLM Assistant

    The fix is complete and correct. Let me do a final verification that no temporary files remain in the repo and only the intended change is present.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.