www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples

Archive Index This month's Index

Subject: [ libssh2-Bugs-2800958 ] libssh2_scp_send() does not support files >4GB

[ libssh2-Bugs-2800958 ] libssh2_scp_send() does not support files >4GB

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Tue, 07 Jul 2009 11:14:45 +0000

This mailing list has been abandoned! Subscribe to and use the new list
instead: http://cool.haxx.se/mailman/listinfo/libssh2-devel
----------------------------------------------------------------------

Bugs item #2800958, was opened at 2009-06-04 10:59
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2800958&group_id=125852

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: API
Group: None
>Status: Pending
>Resolution: Later
Priority: 5
Private: No
Submitted By: Gaëtan Buchetet (p82420)
Assigned to: Daniel Stenberg (bagder)
Summary: libssh2_scp_send() does not support files >4GB

Initial Comment:
Note: I'm using Solaris 9/10, libssh2 1.1

The 4th parameter of libssh2_scp_send() is of type size_t. With the ILP32 (default) model, size_t is 32-bits wide. That makes impossible to transfer files larger than 4GB. I've not tested the LP64 model (accessible with -m64 on Sun Studio and probably gcc), but that should work. Nevertheless, size_t is not the appropriate C type for file sizes. POSIX uses off_t, which is either long long (-D_FILE_OFFSET_BITS=64 or LP64 model) or long.

See attached patch (I've used the off_t C type, but fill free to use any 64-bit wide type).

Gaëtan

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2009-07-07 13:14

Message:
This issue is now added to the TODO document, so hopefully someone will
work on this at some point.

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2009-06-04 17:51

Message:
Sorry. Quite clearly I am the confused part here. Yes, this API does not
allow any larger size than size_t can hold.

We should fix this but:

A - we can't change this function without breaking the ABI so I would
prefer we added a new function that has a 64bit argument for the file
size.

B - Using off_t in an API is very error-prone and I really think we need
to find another type to use. I would appreciate if we could take that as a
discussion on the mailing list to see what others have to say about how
this is best made.

----------------------------------------------------------------------

Comment By: Gaëtan Buchetet (p82420)
Date: 2009-06-04 15:08

Message:
Because I'm doing something like this on files larger than 4GB:

fd = open(path, O_RDONLY);
channel = libssh2_scp_send(session, path, mode, size);
while (more data to write) {
    len = read(fd, buf, len);
    libssh2_channel_write(channel, buf, len);
}
libssh2_channel_free(channel);

Calling libssh2_scp_send() twice with the same parameters overwrites the
target file.

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2009-06-04 14:52

Message:
This report seems to confuse matters.

libssh2 supports SCP for files larger than 4GB, but it does not support
sending more than 4GB in a single libssh2_scp_send() call on systems where
size_t is 32bit. I can't think of any legitimate use-case where you'd want
to do this.

libssh2_scp_send() is meant to be called repeatedly over and over with
data to send.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2800958&group_id=125852

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-07-07

the libssh2 team