Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libssh2_sftp_fstat_ex returns LIBSSH2_ERROR_SFTP_PROTOCOL on a file of zero size #774

Open
rgbrt opened this issue Nov 17, 2022 · 2 comments

Comments

@rgbrt
Copy link

rgbrt commented Nov 17, 2022

Describe the bug
libssh2_sftp_fstat_ex (both the get and set variants) returns LIBSSH2_ERROR_SFTP_PROTOCOL on a newly created file of zero size

To Reproduce

  1. Open/Create file which does not exist on the server. This works as confirmed with libssh2_session_last_errno(session)
sftp_handle = libssh2_sftp_open_ex(sftp_session, sftppath.c_str(),
                                (unsigned int)strlen(sftppath.c_str()),
                                LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT,
                                LIBSSH2_SFTP_S_IRUSR|LIBSSH2_SFTP_S_IWUSR, LIBSSH2_SFTP_OPENFILE)
  1. Run fstat (either variant). It returns -31 which corresponds to LIBSSH2_ERROR_SFTP_PROTOCOL.
        LIBSSH2_SFTP_ATTRIBUTES attrs;
        libssh2_sftp_fstat_ex(sftp_handle, &attrs, 0);
        //or
        attrs.flags = LIBSSH2_SFTP_ATTR_SIZE;
        attrs.filesize = 0;
        libssh2_sftp_fstat_ex(sftp_handle, &attrs, 1);

Expected behavior
Should have been successful

Version (please complete the following information):

  • OS and version: Rocky Linux 4.18.0-372.19.1.el8_6.x86_64
  • libssh2 version: 1.10
  • crypto backend: OpenSSL
@vszakats
Copy link
Member

Can you post the log output with debug logging enabled?

@vszakats
Copy link
Member

vszakats commented May 6, 2023

We merged a patch that may be related to this: #1019

@vszakats vszakats added the bug label May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants