MaxTyutyunnikov / grub4dos-chenall

Automatically exported from code.google.com/p/grub4dos-chenall
0 stars 0 forks source link

cat --length=0 bug with large files #178

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

On an NTFS USB HDD

create a 20GB file - /TEST200.IMG
create a 2.5GB file /TEST025.IMG

cat --length=0 /TEST025.IMG && echo fred
cat --length=0 /TEST200.IMG && echo fred

What is the expected output? What do you see instead?

smaller file echo's 'fred' but large 20GB file does not.

What version of the product are you using? On what operating system?
0.45c 2014 version

Please provide any additional information below.

problem with sizes over 0x100000000  4GB ???

Original issue reported on code.google.com by Steve6375 on 26 Apr 2014 at 10:37

GoogleCodeExporter commented 9 years ago
PS A file over 4GB does work - for 4572839936 byte file

cat returns  filesize is 0x11090000  and echos 'fred'

but 20GB file 21474836480 bytes gives 0x500000000 and does not echo fred

Original comment by Steve6375 on 26 Apr 2014 at 11:11

GoogleCodeExporter commented 9 years ago
I think but is that it only looks at lower 4 bytes of 8 byte returned value.
Because my file is exactly 0x50,0000,0000  it sees the 0000,0000 as being 0

Original comment by Steve6375 on 26 Apr 2014 at 11:30

GoogleCodeExporter commented 9 years ago
Note: On an NTFS partition

cat --length=0 /a_folder 

displays 'filesize is 0x0'  but it is not a file, it is a folder/directory!

On a FAT32 partition, it does not display 'filesize is 0x0' but gives an 'error 
1: Filename must be an absolute pathname or a blocklist' message.

Original comment by Steve6375 on 26 Apr 2014 at 11:14

GoogleCodeExporter commented 9 years ago
If this is difficult to fix, can the result returned just be maximum 3.999GB?

i.e. 

3GB file >>> 3GB
5GB file >>>> 3.9990GB  0xFFFFFFFF
20GB file >>> 3.999GB   0xFFFFFFFF

That way we know the file is not 0 length at least.

Original comment by Steve6375 on 27 Apr 2014 at 6:43

GoogleCodeExporter commented 9 years ago
Any fix for this please?

Original comment by Steve6375 on 8 May 2014 at 9:07

GoogleCodeExporter commented 9 years ago
I wish to compare the file size of two large files.
One is 4.3GB and the other may be larger or smaller.
How can I check to see if the other file is larger or smaller

cat --length=0 /FILE43GB
echo %@retval%

does not return correct size.

Original comment by Steve6375 on 10 Jun 2014 at 7:58

GoogleCodeExporter commented 9 years ago
The @retval is a 32-bit.

and all grub4dos builtin cmd return a 32-bit number.

current cant try below

cat --length=0 /FILE43GB
read 0x8290 || read 0x8294 || echos 'fred'

I think we can make a patch to this,
cat --length=0 /XXXX  return 1 when file size over 4GB.

Original comment by chenall.cn on 4 Aug 2014 at 8:32

GoogleCodeExporter commented 9 years ago
github.com

https://github.com/chenall/grub4dos/issues/6

Original comment by chenall.cn on 4 Aug 2014 at 8:40

GoogleCodeExporter commented 9 years ago
What if file is 1 byte - I will think it is >4GB?

Largest number is 1.999GB  (as signed number??)  or 3.999GB

Why not return max size for 32-bit number?

Original comment by Steve6375 on 4 Aug 2014 at 8:47

GoogleCodeExporter commented 9 years ago
Ok return -1 over 4GB.

Original comment by chenall.cn on 4 Aug 2014 at 9:40