Bug 64418

Summary: load -m disk truncates files loaded
Product: [Retired] eCos Reporter: Need Real Name <rorybolt>
Component: RedBootAssignee: eCos bugs internal list <es-ecos-bugs-int>
Status: CLOSED WONTFIX QA Contact: eCos bugs internal list <es-ecos-bugs-int>
Severity: medium Docs Contact:
Priority: medium    
Version: CVS   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-06-20 16:15:48 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:

Description Need Real Name 2002-05-04 02:07:08 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)

Description of problem:
If the length of a file loaded from disk is not an integer multiple of 256 
bytes in length, the last (file_len modulo 256) bytes are not loaded

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


How reproducible:
Always

Steps to Reproduce:
1.Configure RedBoot to support load from IDE disk
2. Attempt to load a file with a length that is not an even multiple of 256 
bytes
3. Note the output of the load command... the number of bytes loaded is rounded 
down to the nearest 256 byte boundary
	

Actual Results:  A file of length 514 bytes only loads the first 512 bytes.

Expected Results:  All 514 bytes should be loaded

Additional info:

In the file $ECOS_REPOSITORY/packages/redboot/current/src/fs/disk.c,
the function disk_stream_read() contains a line:

if ((nread = (file_part->funs->read)(fileptr, buf, size)) != size) {

which should be changed to:

if ((nread = (file_part->funs->read)(fileptr, buf, size)) < 0) {

Since the file system parsing code will not read past EOF but just return a 
short read instead. The file system parsing code will return a negative number 
for errors.

Comment 1 Alex Schuilenburg 2003-06-20 16:15:48 UTC
This bug has moved to http://bugs.ecos.sourceware.org/show_bug.cgi?id=64418