Bug 67362

Summary: rcp doesn't work with large files
Product: [Retired] Red Hat Linux Reporter: Need Real Name <mp>
Component: rshAssignee: Phil Knirsch <pknirsch>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: andre.steigerwald, pmatilai, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-01-17 16:38:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Fix rcp with filesizes > 2GB none

Description Need Real Name 2002-06-23 15:55:05 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0)

Description of problem:
rcp, as derived from the netkit-rsh-0.17 source in Red Hat 7.x, doesn't handle 
files larger than 2GB.  There are two types of failure:

- an existing large file can't be opened by rcp (the open() call fails with 
EFBIG)

- trying to write a file on a Red Hat system that the remote side claims is 
larger than 2GB will result in the size variable in sink(), which is declared 
as an int, not to reflect the actual size of the file (it might be negative, or 
it might be filesize%4GB, because of the overflow) and the copy will be aborted 
prematurely after the Red Hat system's rcp believes it has read in the correct 
number of bytes.

Fix:
more recent versions of freebsd's rcp fix the C code.  The snprintf expression 
involving stb.st_size should cast it to (long long) and use %lld instead of %
ld.  size should be declared as off_t rather than int.  And appropriate CFLAGS 
should be defined in the Makefile so that 64-bit versions of off_t, open(), and 
stat() get used; I happened to fix this by adding "CFLAGS += -
D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" to the Makefile.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. rcp largefile remote:destfile
2. (from another system whose rcp supports large files) rcp largefile 
redhatsystem:destfile
3.
	

Additional info:

Comment 1 Panu Matilainen 2003-01-17 14:32:03 UTC
This is still present in phoebe/rawhide and RHL 8.0 as well. Adding this to the
MCONFIG-editing part and patching it as described by mp above fixes it for me:

s,-O2,\$(RPM_OPT_FLAGS) -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64,;

Comment 2 Panu Matilainen 2003-01-17 14:33:25 UTC
Created attachment 89423 [details]
Fix rcp with filesizes > 2GB

Comment 3 Phil Knirsch 2003-01-17 16:38:53 UTC
Fixed in rsh-0.17-13 (available via rawhide shortly).

Read ya, Phil

Comment 4 Phil Knirsch 2003-06-25 15:04:34 UTC
*** Bug 87860 has been marked as a duplicate of this bug. ***