Bug 842 - type fixes for progressmeter
Summary: type fixes for progressmeter
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp (show other bugs)
Version: -current
Hardware: All All
: P2 normal
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks: V_4_8
  Show dependency treegraph
 
Reported: 2004-04-15 14:03 EST by Darren Tucker
Modified: 2008-03-31 15:20 EST (History)
1 user (show)

See Also:


Attachments
use u_int64_t for progressmeter (2.99 KB, patch)
2004-04-15 14:08 EST, Darren Tucker
no flags Details | Diff
make sftp use off_t (736 bytes, patch)
2007-05-17 20:25 EST, Damien Miller
djm: ok?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darren Tucker 2004-04-15 14:03:16 EST
Some compilers won't cast, eg, int* to unsigned long long* and progressmeter
mixes off_t and u_int64_t which causes problems for them.

off_t can vary depending on many things including platform and large file
support, but the u_int64_t is specified by the sftp protocol.
Comment 1 Darren Tucker 2004-04-15 14:08:46 EST
Created attachment 604 [details]
use u_int64_t for progressmeter
Comment 2 Damien Miller 2005-11-06 03:51:57 EST
Is this still relevant? What compile warnings do you see?
Comment 3 Darren Tucker 2005-11-06 19:22:36 EST
The error is:
sftp-client.c:1051: cannot cast 'unsigned long long *' to 'int *'

The line in question is:
start_progress_meter(local_path, sb.st_size, &offset);

"offset" is u_int64_t, the 3rd arg of start_progress_meter is off_t.

Since off_t is usually signed, it's also a potential signed/unsigned issue.
Comment 4 Damien Miller 2007-05-17 20:25:22 EST
Created attachment 1287 [details]
make sftp use off_t

Perhaps it would be better for sftp to use an off_t here? I don't think the OS would support files with OFF_T_MAX < size <= UINT64_MAX anyway
Comment 5 Darren Tucker 2007-05-17 23:42:24 EST
(In reply to comment #4)
> Perhaps it would be better for sftp to use an off_t here? I don't think
> the OS would support files with OFF_T_MAX < size <= UINT64_MAX anyway

This seems reasonable to me.  The progressmeter code doesn't seem like it would care much if it wrapped anyway, other than producing bogus stats.
Comment 6 Damien Miller 2008-03-31 15:20:11 EST
Fix shipped in 4.9/4.9p1 release.