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

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.

Activity

  1. waghanza commented on Jun 27, 2018

    @waghanza

    same issue with OpenSSH_7.7p1, OpenSSL 1.1.0h-fips 27 Mar 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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