Date: Sat, 20 Apr 2002 03:08:39 +0200 From: Matthias Buelow <mkb@mukappabeta.de> To: Paul Everlund <tdv94ped@cs.umu.se> Cc: jonc@chen.org.nz, freebsd-questions@FreeBSD.ORG Subject: Re: cat: A bug or just as it should be? Message-ID: <20020420030839.7d37a443.mkb@mukappabeta.de> In-Reply-To: <3CC099F8.531ECECE@cs.umu.se> References: <3CC08E8E.B5EEEA90@cs.umu.se> <20020419174541.A47020@rochester.rr.com> <3CC0954C.18B62401@cs.umu.se> <20020420102030.A6992@grimoire.chen.org.nz> <3CC099F8.531ECECE@cs.umu.se>
next in thread | previous in thread | raw e-mail | index | archive | help
Paul Everlund <tdv94ped@cs.umu.se> writes: >Yep. But why does REMOVED directories show up? In another directory >removed files too shows up. Is this good? I can understand that dirs >and files that are on the HDD shows, but removed ones? Is this due >to left behind references of some kind? On BSD, you can read (local UFS) directories just as they were ordinary files (System V blocks this with an error message since quite some time ago) and thus the internal structure of a directory "file" is exposed to you as binary data. In the past, when there was only one filesystem, programs like ls(1) would read the directories directly instead of via the appropriate library/system-calls. Only with the incorporation of other filesystems such as UFS/FFS and RFS/NFS into Unix came functions which were disk-structure independent since programs couldn't rely on getting a S5fs/V7-style directory anymore. As directory slots aren't zeroed-out when the appropriate entry is removed, you can see filenames of entries already removed. Exposing directories as ordinary files in that way to the userland is (arguably) more elegant, in the somewhat naive way that it shows Unix' simplistic roots but OTOH, is rarely useful. You may find out that you can't open them for writing anyways. [This is similar to what some people might know from using a binary block editor on a DOS filesystem; if you view the FAT structure there, you'd also see old filenames, only with the difference that the first character is changed into some magic char which is the clue for DOS that the file has been deleted.] --mkb To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020420030839.7d37a443.mkb>