Infinite storage space????

Pyro Pilots Lounge. For all topics *not* covered in other DBB forums.

Moderators: fliptw, roid

Post Reply
User avatar
sdfgeoff
DBB Ace
DBB Ace
Posts: 498
Joined: Wed Jan 12, 2011 1:07 am
Location: Low Earth Orbit
Contact:

Infinite storage space????

Post by sdfgeoff »

I made something cool on the computer, and wanted to show it to you. So I stuck it in a zip folder. It never zipped. It is impossible for it to zip!

What it is is 4 folders called "recursion 1" through "recursion 4" Inside each of these folders are 4 links to the other folders. You can go infinite layers deep into this file-system, thus there are an infinite number of folders, and thus an infinite amount of space on my computers hard drive!!!!
A bit like a klein bottle.

Unzipped it is 20kb. Zipped? Well, it says "getting file list" and then get's stuck. Eats up ram too.

So what is it good for, nothing really, except saying to a family member "I've lost a file, I know it's somewhere in this folder......"


For you guys on Linux you can repeat it easily, probably on other platforms too.
Eh?
User avatar
Alter-Fox
The Feline Menace
Posts: 3164
Joined: Thu May 24, 2007 12:49 pm
Location: the realms of theory
Contact:

Re: Infinite storage space????

Post by Alter-Fox »

Lol nice. It would be awesome if that actually could give you infinite storage space, too bad even on computers disk space is a physical thing.
Ship's cat, MPSV Iberia: beware of cat.
...
Beware my original music, at http://soundcloud.com/snowfoxden.
User avatar
sdfgeoff
DBB Ace
DBB Ace
Posts: 498
Joined: Wed Jan 12, 2011 1:07 am
Location: Low Earth Orbit
Contact:

Re: Infinite storage space????

Post by sdfgeoff »

A word of caution here too. Delete it before running a file-system check. I imagine it would get stuck the same way the archive manager did.
Eh?
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6522
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Re: Infinite storage space????

Post by Jeff250 »

I've also seen an analogous trick used to create gzip files that infinitely recurse *decompressing*. People use these kinds of tricks to DoS antivirus programs.
User avatar
Aggressor Prime
DBB Captain
DBB Captain
Posts: 763
Joined: Wed Feb 05, 2003 3:01 am
Location: USA

Re: Infinite storage space????

Post by Aggressor Prime »

Hmmm, didn't work for me. I tried on Windows 7 and used WinRAR. There was no lockup and the file size was normal.
User avatar
sdfgeoff
DBB Ace
DBB Ace
Posts: 498
Joined: Wed Jan 12, 2011 1:07 am
Location: Low Earth Orbit
Contact:

Re: Infinite storage space????

Post by sdfgeoff »

For once windows may be smarter than linux!
Actually it's just the zip tool. When I look at it using the "tree" terminal command, it realizes it's a loop and stops at the forth time through.

In windows I suspect that the links are really links (ie a physical file) rather than another reference/access point to the same folder.
Eh?
User avatar
snoopy
DBB Benefactor
DBB Benefactor
Posts: 4435
Joined: Thu Sep 02, 1999 2:01 am

Re: Infinite storage space????

Post by snoopy »

Did you make a hard link, or a symbolic link?
Arch Linux x86-64, Openbox
"We'll just set a new course for that empty region over there, near that blackish, holeish thing. " Zapp Brannigan
User avatar
sdfgeoff
DBB Ace
DBB Ace
Posts: 498
Joined: Wed Jan 12, 2011 1:07 am
Location: Low Earth Orbit
Contact:

Re: Infinite storage space????

Post by sdfgeoff »

Um, I remember there being two types of link, but I just right-click and "make link"
Oh, and something I read the other day made me think that a zip file when opened on windows can't have more than 7 parent directories. Any conformation for this?
Eh?
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6522
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Re: Infinite storage space????

Post by Jeff250 »

In linux, you can't hard link directories, only symlink them.
User avatar
snoopy
DBB Benefactor
DBB Benefactor
Posts: 4435
Joined: Thu Sep 02, 1999 2:01 am

Re: Infinite storage space????

Post by snoopy »

Jeff250 wrote:In linux, you can't hard link directories, only symlink them.
Nice, you learn something new every day.

Now, if I'm correct, the FS treats a symlink as it's own entity, so it really kinda the zip utility's bad for treating the symlink like a link instead of like a file.
Arch Linux x86-64, Openbox
"We'll just set a new course for that empty region over there, near that blackish, holeish thing. " Zapp Brannigan
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6522
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Re: Infinite storage space????

Post by Jeff250 »

Right--if you could hard link directories, then you'd have to check the inode of every directory you recurse. (Even with symlinks, if you wanted to recurse them, then you'd only have to check the path that symlinks point to to avoid cycles.)

Probably another reason you can't hard link directories is for symmetry with rmdir(). Normally, you can't rmdir() a directory with files in it. But what if you call rmdir() on a non-empty directory whose inode has multiple file system links? Whether you choose to allow that or not would be surprising in one situation or another. So that's another good reason to only allow out-of-band *sym*links for directories.

There are probably other oddities this would lead to as well.
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6522
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Re: Infinite storage space????

Post by Jeff250 »

And something more relevant to the original discussion, if you use tar, then it should preserve the symlink as a symlink inside the archive.
Post Reply