Re: 64 Bits from Larry McVoy

Christian Hardmeier (chrigi@darkstar.chrigi.net)
Tue, 5 Nov 1996 17:57:30 +0100 (MET)


On Mon, 4 Nov 1996, Oleg Kibirev wrote:

> Jim Nance wrote:
> > Well Larry,
> > I was almost sure you were wrong, so I wrote the following test program.
> > Unfortunatly, I did manage to tickle enough linux bugs so that you can
> > claim you are right :-) So instead of claiming victory, I will submit
> > a bug report :-( For those intrested in reproducing this, I am running
> > Redhat 4.0 with redhats kernel, and the partition I am working contains an
> > 800MB ext2 file system. Here is the program. It tries to make a large
> > sparse file:
> >
> >
> > int main()
> > {
> > off_t offset;
> > int fd = open("bigfile", O_CREAT|O_TRUNC|O_WRONLY);
> >
>
> An open with O_CREAT should have a mode (for example 0666) as the 3rd
> argument. If it's omitted, the call with usually pick up some garbage
> from the stack and use it as file's permissions.
>
> So, unlike the printk, this is program's rather than system bug.
>
> > The first thing to notice is that I have divided GB by 2. If I don't do
> > this the program fails after making a 1G file, and I get a nice printk()
> > from the ext2fs. So I divided by two and reran. Now I can make a very
> > large file, but something is still wrong:
> >
> > total 76
> > -rwxrwxrwx 1 jlnance users 14378 Nov 4 07:39 a.out*
> > -rw-rw-rw- 1 jlnance users 544 Nov 4 07:38 big.c
> > -r-xrwS--T 1 jlnance users 10200547329 Nov 4 07:43 bigfile*
> >
>

I patched the program to use _llseek, and to specify a correct mode on
open ;-).
I never got a nice printk() from ext2fs. But from a certain file length on
(I didn't check but I figure it's when 32 bit can't hold the offset any
more) write fails with EFBIG: File too large. Very normal, controlled
behaviour...

Christian