After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 338893 - nautilus reports only up 2gb for the filesize whith large files over ftp
nautilus reports only up 2gb for the filesize whith large files over ftp
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: Module: ftp
2.14.x
Other Linux
: Normal major
: ---
Assigned To: Federico Mena Quintero
gnome-vfs maintainers
Depends on:
Blocks:
 
 
Reported: 2006-04-18 14:31 UTC by Sebastien Bacher
Modified: 2006-05-11 16:15 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
gnome-vfs2-171156-ftp-large-files.diff (3.69 KB, patch)
2006-05-03 01:21 UTC, Federico Mena Quintero
committed Details | Review

Description Sebastien Bacher 2006-04-18 14:31:23 UTC
That bug has been opened on https://launchpad.net/distros/ubuntu/+source/nautilus/+bug/39794

"Connect to an FTP server with large files (larger than 2GB, I used 4.7GB). nautilus will report these files as being 2GB insize, after transferring them it will also use this number for the progress bar and apear to hang at 2gb, since it looks finished.. but it still needs to transfer more data (2.7gb in my case)
I've noticed this in dapper drake"

example:

$ gnomevfs-ls ftp://ie.releases.ubuntu.com/ubuntu-cdimage/releases/5.10/release | grep amd64.iso
ubuntu-5.10-dvd-amd64.iso               (Regular, application/x-cd-image)       size 2147483647

lftp about the same .iso:
"-rw-rw-r--  1 1000  1000  3075670016 Oct 12  2005 ubuntu-5.10-dvd-amd64.iso"
Comment 1 Christophe Fergeau 2006-04-18 14:54:55 UTC
in modules/ftp-method.c, changing the strtol in 
       if (strlen (ls) > 35) {
                file_info->size = strtol (ls + 35, NULL, 0);
                file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SIZE;
       }

to strtoull will probably help (dunno if it will compile on all platforms we support though :-/)
Comment 2 Sebastien Bacher 2006-04-18 15:26:57 UTC
strtoull doesn't make a difference
Comment 3 Christophe Fergeau 2006-04-18 15:35:43 UTC
Let's try s/atol/atoll in gnome-vfs-parse-ls.c:627 then ;)
                /* Common file size */
                if (!is_num (columns[idx2]))
                        goto error;

                s->st_size = (gsize) atol (columns [idx2]);
Comment 4 Sebastien Bacher 2006-04-18 15:43:36 UTC
with that change:

"...
Size              : 3075670016
Blocks            : 13256429026312501376
..."

Blocks has still a weird value but the size is correct
Comment 5 Federico Mena Quintero 2006-05-03 01:21:36 UTC
Created attachment 64712 [details] [review]
gnome-vfs2-171156-ftp-large-files.diff

This is the patch which I'm using for the corresponding bug in the Novell bugzilla.

- Fixes parsing of the file size, with atoll() and an atof() fallback.

- Fixes the things we check for in configure.in.

- Fixes the usage of the HAVE_STRUCT_STAT_* macros.
Comment 6 Federico Mena Quintero 2006-05-11 16:15:42 UTC
Committed to the HEAD and gnome-2-14 branches.

2006-05-02  Federico Mena Quintero  <federico@novell.com>

	Fix http://bugzilla.gnome.org/show_bug.cgi?id=338893: file size is
	reported wrong in the FTP method for files larger than 2 GB.

	* configure.in.orig: Check for atoll() to AC_CHECK_FUNCS().
	Check for stat.st_blksize stat.st_rdev, and AC_STRUCT_ST_BLOCKS
	(without these, we were never entering the corresponding #ifdef
	blocks in gnome-vfs-parse-ls.c, and thus not filling in certain
	fields of struct stat).

	* libgnomevfs/gnome-vfs-parse-ls.c (gnome_vfs_parse_ls_lga): Use
	atoll() when available for stat.st_size, or atof() if it's not
	available.  Use HAVE_STRUCT_STAT_ST_RDEV,
	HAVE_STRUCT_STAT_ST_BLOCKS, and HAVE_STRUCT_STAT_ST_BLKSIZE instead of
	HAVE_ST_RDEV, HAVE_ST_BLOCKS, and HAVE_ST_BLKSIZE, respectively.