On 08/27/2014 08:26 AM, Bernhard Voelker wrote:
On 08/27/2014 01:40 PM, Anton Aylward wrote:
I do know from experience that it works for embedded nulls
(Binary) nulls are definitely not possible in file names - Dirk mentioned that already.
Lets be precise here. The CREATE(2) system call kernel code parses the string handed as a parameter in the way that C code normally works, that the string is null terminated. So you can't 'creat' a file whose name has embedded nulls.
File names can consist of *any* character except the directory separator ('/' on Linux), and the binary Null (because that is the string termination character). I.e., a file name can very well include unusual characters like a newline character, or any other binary or otherwise non-printable character.
The problem for passing such names to command line tools like rm arises when your keyboard doesn't have a key for it. E.g. my keyboards don't have German umlauts, but hitting TAB to trigger bash's tab-completion feature helps in most of the cases.
The real problem arises when file systems get corrupt and things walk over the inode. That's why we have FSCK. Yes, this was worse in the days of the V7 FS and even the later 20th century file systems where the inode space was separate from the data space. The V7 file system was the limiting case of that! With b-tree based FS the distinction either no longer exists or is very fuzzy. But an intermediate problem is when the file-that-is-the-directory gets corrupted. Plonk random characters in that and who knows. Essentially the structure used by readdir has the name and inode. The name _should_ be null terminated. If the directory entry gets corrupted in just the right way, that is the name gets hit rather than the inode field or one of the other supported fields then we have the oddity that the record size and the name length don't match. Yes its a YMMV situation, but I've BTDT. Often you recognise it by very weird 'ls' listings or names you know getting truncated. And yes, it is it not the normal situation. And yes you need to do more than FSCK can do. Yu might have to do binary edit on the disk itself. Nerve racking stuff. BTDT. Don't ever want to do it again. As for 'passing file names' well isn't that what 'find' and pipes and 'xargs' are for? -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org