Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Nil Trace error in SSH2::SFTP::File #17

@vonKingsley

Description

@vonKingsley

I came across an error doing the following.
I updated for Crystal 24 based on the pull request.

Came across this bug using the following require "ssh2"; HTTP::Client.get "http://website.com"
Error:

in /usr/local/Cellar/crystal-lang/0.24.1_1/src/http/client.cr:491: instantiating 'IO+#rewind()'

    request.body.try &.rewind

instantiating 'IO+#rewind(Tuple(), NamedTuple())'
in lib/ssh2/src/sftp/file.cr:20: instantiating 'seek(Int32)'

      seek(0)
      ^~~~

in lib/ssh2/src/sftp/file.cr:16: instantiating 'check_error(Nil)'

      check_error(ret)
      ^~~~~~~~~~~

in lib/ssh2/src/sftp/base.cr:25: instantiating 'SSH2::SessionError:Class#check_error(SSH2::Session, Nil)'

    SessionError.check_error(@session, code)
                 ^~~~~~~~~~~

in lib/ssh2/src/ssh2.cr:15: undefined method '>=' for Nil

      if code >= LibSSH2::ERROR_NONE || code == LibSSH2::ERROR_EAGAIN

This traces here
I found that libssh2_sftp_seek64 returns Void.

I did a quick fix and just removed the return and check_error method from seek(). I can send up a pull request, but wanted to check with you to see if you think there is a better solution for seek. I don't see anything in the header to indicate a success or failure for seek.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions