Export to GitHub

grub4dos-chenall - issue #178

cat --length=0 bug with large files


Posted on Apr 26, 2014 by Happy Kangaroo

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 ???

Comment #1

Posted on Apr 26, 2014 by Happy Kangaroo

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

Comment #2

Posted on Apr 26, 2014 by Happy Kangaroo

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

Comment #3

Posted on Apr 26, 2014 by Happy Kangaroo

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.

Comment #4

Posted on Apr 27, 2014 by Happy Kangaroo

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.

Comment #5

Posted on May 8, 2014 by Happy Kangaroo

Any fix for this please?

Comment #6

Posted on Jun 10, 2014 by Happy Kangaroo

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.

Comment #7

Posted on Aug 4, 2014 by Happy Hippo

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.

Comment #8

Posted on Aug 4, 2014 by Happy Hippo

github.com

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

Comment #9

Posted on Aug 4, 2014 by Happy Kangaroo

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?

Comment #10

Posted on Aug 4, 2014 by Happy Hippo

Ok return -1 over 4GB.

Status: Done

Labels:
Type-Defect Priority-Medium