On 2018-06-07 12:47:15 +0000, Steven D'Aprano wrote: > But it doesn't do that. "Pathnames cannot contain NUL" is a falsehood > that programmers wrongly believe about paths. HFS Plus and Apple File > System support NULs in paths. [...] > But in the spirit of compromise, okay, let's ignore the existence of file > systems like HFS which allow NUL. Apart from Mac users, who uses them > anyway? Let's pretend that every file system in existence, now and into > the future, will prohibit NULs in paths.
Could you (or anybody else who owns a Mac) please do the following:
* Create an empty directory
* In this directory, create two files:
* One with an embedded \0 in the file name
* One with an embedded / in the file name
* Compile and run this C program in the directory and post the output:
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
int main(void) {
DIR *dp;
struct dirent *de;
char *p;
dp = opendir(".");
while ((de = readdir(dp)) != NULL) {
printf("%ld -", (long)de->d_ino);
for (p = de->d_name; *p; p++) {
printf(" %02x", (unsigned char)*p);
}
printf("\n");
}
return 0;
}
Bonuspoints for doing this on an USB stick and then mounting the USB
stick on a Linux system and posting the output there as well.
I'm really curious how MacOS maps those characters in the POSIX API.
hp
--
_ | Peter J. Holzer | we build much bigger, better disasters now
|_|_) | | because we have much more sophisticated
| | | [email protected] | management tools.
__/ | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman/listinfo/python-list
