Skip to content

Conversation

@u3s
Copy link
Contributor

@u3s u3s commented Jun 30, 2025

  • generate unique file handles

@u3s u3s self-assigned this Jun 30, 2025
@u3s u3s added the team:PS Assigned to OTP team PS label Jun 30, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jun 30, 2025

CT Test Results

    2 files     29 suites   18m 47s ⏱️
  481 tests   475 ✅  6 💤 0 ❌
1 686 runs  1 660 ✅ 26 💤 0 ❌

Results for commit 981a866.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@u3s u3s changed the base branch from master to maint June 30, 2025 15:40
@u3s u3s added the testing currently being tested, tag is used by OTP internal CI label Jun 30, 2025
@u3s u3s requested a review from IngelaAndin July 1, 2025 08:12
IngelaAndin
IngelaAndin previously approved these changes Jul 2, 2025
@u3s u3s requested a review from Copilot July 4, 2025 15:09

This comment was marked as outdated.

@u3s u3s force-pushed the kuba/ssh/fix_new_handle/OTP-19691 branch from 34b4aac to ba19a35 Compare July 7, 2025 14:46
@u3s u3s requested a review from Copilot July 7, 2025 14:46

This comment was marked as outdated.

@u3s u3s force-pushed the kuba/ssh/fix_new_handle/OTP-19691 branch from ba19a35 to 6458011 Compare July 7, 2025 15:04
@u3s u3s requested a review from Copilot July 7, 2025 15:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the SFTP server’s handle ID generation to ensure unique IDs and reuse freed gaps, and updates the test suite to verify this behavior.

  • Introduce new_handle_id and find_gap to replace the old recursive new_handle, finding the lowest unused handle ID and reusing gaps.
  • Update ssh_sftpd_SUITE.erl to generate multiple file handles, assert uniqueness, and test gap reuse.
  • Add binary_to_integer/1 for parsing handles and include assert.hrl.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

File Description
lib/ssh/src/ssh_sftpd.erl Replaced new_handle/2 with new_handle_id + find_gap, and updated handle parsing to binary_to_integer/1.
lib/ssh/test/ssh_sftpd_SUITE.erl Added test logic to write multiple files, collect handles, assert uniqueness, reuse gaps, and included assert.hrl.
lib/ssh/test/ssh_sftpd_SUITE_data/* Added ED25519 public/private key test fixtures.
Comments suppressed due to low confidence (3)

lib/ssh/test/ssh_sftpd_SUITE.erl:734

  • Consider adding a test case for the initial empty handle list (no existing handles) to verify that the first generated handle ID is 0.
    %% repeat procedure to make sure uniq file handles are generated

lib/ssh/test/ssh_sftpd_SUITE.erl:63

  • The assert.hrl include appears unused since ?assertEqual comes from ct.hrl. Consider removing this include to reduce unnecessary dependencies.
-include_lib("stdlib/include/assert.hrl").

lib/ssh/src/ssh_sftpd.erl:451

  • binary_to_integer/1 was introduced in OTP 25. If this library needs to support older OTP releases, consider adding a fallback (e.g., list_to_integer(binary_to_list(BinHandle))).
    case (catch binary_to_integer(BinHandle)) of

@u3s u3s force-pushed the kuba/ssh/fix_new_handle/OTP-19691 branch from 6458011 to 563241b Compare July 7, 2025 16:09
@u3s u3s force-pushed the kuba/ssh/fix_new_handle/OTP-19691 branch from 563241b to 981a866 Compare July 7, 2025 16:12
@u3s u3s requested a review from IngelaAndin July 7, 2025 16:57
@u3s u3s merged commit 37b5b05 into erlang:maint Jul 9, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team:PS Assigned to OTP team PS testing currently being tested, tag is used by OTP internal CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants