Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1206663

Summary: Can't Drag'n'Drop file 2.4GB client->guest
Product: Red Hat Enterprise Linux 6 Reporter: Andrei Stepanov <astepano>
Component: spice-vdagentAssignee: Default Assignee for SPICE Bugs <rh-spice-bugs>
Status: CLOSED ERRATA QA Contact: SPICE QE bug list <spice-qe-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.6CC: ashankar, astepano, cfergeau, dblechte, fidencio, marcandre.lureau, mnewsome, pfrankli, rbalakri, spoyarek, tpelka
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spice-vdagent-0.14.0-7.el6 Doc Type: Bug Fix
Doc Text:
No doc needed
Story Points: ---
Clone Of:
: 1331490 (view as bug list) Environment:
Last Closed: 2015-07-22 07:28:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1331490    

Description Andrei Stepanov 2015-03-27 16:39:25 UTC
Description of problem:
D'N'D does not work for big files.

Version-Release number of selected component (if applicable):
Guest:
spice-vdagent-0.14.0-5.el6.i686
Client:
spice-vdagent-0.14.0-4.el6.x86_64
spice-gtk-0.22-7.el6.x86_64
spice-xpi-2.7-25.el6.x86_64
spice-glib-0.22-7.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create big file on client: dd if=/dev/zero of=bigone bs=1M count=2500
2. Try to drag-and-drop it to guest

Actual results:
Mar 27 17:29:35.526930 spice-vdagent[2646]: err: file-xfer: err reserving 2621440020 bytes for /home/astepano/Desktop/sbig: Invalid argument
Mar 27 17:29:35.526947 spice-vdagent[2646]: err: file-xfer: Removing task 5 and file /home/astepano/Desktop/sbig due to error

I have to notice, that guest has enough free space:

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_rhel6732-lv_root 19G  3.8G   15G  22% /

I can create file on guest with required size. It is not a free space problem.

Comment 2 Andrei Stepanov 2015-03-27 16:54:52 UTC
Is not reproducible on x86_64

Comment 3 Marc-Andre Lureau 2015-03-27 16:59:19 UTC
(In reply to Andrei Stepanov from comment #0)
> 1. Create big file on client: dd if=/dev/zero of=bigone bs=1M count=2500
> 2. Try to drag-and-drop it to guest
> 
> Actual results:
> Mar 27 17:29:35.526930 spice-vdagent[2646]: err: file-xfer: err reserving
> 2621440020 bytes for /home/astepano/Desktop/sbig: Invalid argument
...
> I can create file on guest with required size. It is not a free space
> problem.

    if (ftruncate(task->file_fd, task->file_size) < 0) {
        syslog(LOG_ERR, "file-xfer: err reserving %"PRIu64" bytes for %s: %s",
               task->file_size, path, strerror(errno));
        goto error;
    }

I guess we need ftruncte64 for this.

Comment 4 Marc-Andre Lureau 2015-03-27 17:31:35 UTC
According to truncate(2):
"Linux 2.4 added truncate64() and ftruncate64() system calls that handle large files.   However, these details can be ignored by applications using glibc, whose wrapper functions transparently employ the more recent system calls where they are available."
"A header file bug in glibc 2.12 meant that the minimum value of _POSIX_C_SOURCE required to expose the declaration of ftruncate() was 200809L instead of 200112L.  This has been fixed in later glibc versions."


I don't have 686 guest to test with, could you gcc/run this:

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>

int main()
{
  int fd = open("foo", O_CREAT | O_WRONLY, 0644);
  assert (ftruncate(fd, 2621440020) == 0);
}

It shouldn't assert if you have enough disk space, I think. If it does, it might be a glibc backport missing, or we need to recompile the agent perhaps..

Comment 6 Marc-Andre Lureau 2015-03-30 09:58:09 UTC
moving to glibc maintainers for help.

Shouldn't the program in comment 4 work on i686, or it should be using ftruncate64 there?

Comment 8 Christophe Fergeau 2015-04-09 14:51:29 UTC
(In reply to Marc-Andre Lureau from comment #6)
> moving to glibc maintainers for help.
> 
> Shouldn't the program in comment 4 work on i686, or it should be using
> ftruncate64 there?

I can reproduce the failed assert when building on i686 with 
gcc ftruncate.c

However, gcc -D_FILE_OFFSET_BITS=64 ftruncate.c does not assert.

Checked with nm that in the former case, ftruncate@@GLIBC_2.0 is used, in the latter case, ftruncate64@@GLIBC_2.1 is used.

Similar situation when building spice-vdagent, without AC_SYS_LARGEFILE in configure.ac, ftruncate is used, with AC_SYS_LARGEFILE, ftruncate64 is used.

Comment 9 Siddhesh Poyarekar 2015-04-10 11:31:01 UTC
Clearing needinfo since comment 8 resolves this; -D_FILE_OFFSET_BITS=64 is needed to transparently substitute ftruncate with ftruncate64.

Comment 11 errata-xmlrpc 2015-07-22 07:28:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1392.html