Interesting shenanigans

George Toft plug-discuss@lists.plug.phoenix.az.us
Fri, 10 Jan 2003 16:34:34 -0500


"David A. Sinck" wrote:
> 
> I discovered something interesting.  Both of these run as a user
> without privileges on a RH7.3 + updates box:
> 
>  dd if=/dev/zero of=oink
>  yes 'abcdabcd' > oink
> 
> Other than the contents of the file being pushed to disk, these are
> the same essential thing, right?: fill the local disk partition up.
> 
> Wrong.  Thank you for playing.
> 
> The first one *does* fill the disk.
> 
> The second one hits a filesize limit.
> 
>  | magnitude spare:0:267} dd if=/dev/zero of=oink
>  | dd: writing to `oink': No space left on device
>  | 19052521+0 records in
>  | 19052520+0 records out
>  | magnitude spare:1:268} df .
>  | Filesystem           1k-blocks      Used Available Use% Mounted on
>  | /dev/hda11            10080488   9568420         0 100% /mnt/spare
>  | magnitude spare:0:269} ls
>  | lost+found/  oink
>  | magnitude spare:0:270} rm oink
>  | magnitude spare:0:271} ls /dev/one
>  | ls: /dev/one: No such file or directory
>  | magnitude spare:1:272} yes 'abcdabcd' > oink
>  | Filesize limit exceeded
>  | magnitude spare:153:273} df .
>  | Filesystem           1k-blocks      Used Available Use% Mounted on
>  | /dev/hda11            10080488   2132044   7436376  23% /mnt/spare
> 
> After a bit more thought during typing the email, we have another dd
> running in the background and wala!:
> 
>  | magnitude spare:0:280} ls -l
>  | total 7450844
>  | drwx------    2 root     root        16384 Mar 17  2002 lost+found/
>  | -rw-r--r--    1 sinck    sinck    2147483647 Jan  9 06:12 oink
>  | -rw-r--r--    1 sinck    sinck    5474697728 Jan  9 06:28 oink2
> 
> So... a 2G file limit.  What?
> 
> :-)
> 
> Good morning.
> 
> David
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change  you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


I had the same discussion on another list, so I will share the answer.

I was recording streaming media from the Internet.  If I used xmms, it
would get to 2.1G and segfault.  Using dd, I could create a 4 GB file. 
Using mplayer, I can create a 4 GB mp3 (my current stream is 2589036544
bytes in size - clearly larger than 2.1 GB).  So it is not the
filesystem - it is the application's ability to deal with large files. 
xmmx cannot, mplayer can.  dd can, and apparently, yes cannot.

Likewise, xmmx can play a 2.1 GB mp3, but it's display cannot handle a 4
GB mp3.

2.1 GB is the maximum size of a signed 32 bit integer.  Seems strange to
me that one would use a signed integer vice an unsigned int for files,
but then, I gave up programming a long time ago.

George