I think Zig is trying to be the C to Rust's C++ but the scope creep of "well since we're already linked against libclang we might as well bundle a C compiler and a bunch of libc sources so we can statically cross-compile against anything we desire" is kinda annoying

but I think it has some chance of success. it passes my /bin/false test much better than C does. the result is comparable in size to static C builds if not better, but the strace output is much much shorter

@314 opinion: /bin/false should be an executable broken symlink

@sir is it even possible to have an executable broken symlink?

@314 sure, the executable bit is a property of the dirent, not the inode. Though now that I think of it I'm not sure how much of a symlink is in the directory and how much is in the node heap

@sir @314
WTF no. The perms are all in the inode.
- the permissions on symlinks are ignored
- tools won't allow you to change them to anything other than 777
(not sure if POSIX requires it, but all implementations I've seen do it)


@sir @314
Also, all of the symlink is in the inode. So in theory you could have any perms there.

@Wolf480pl @314 since when is the perm in the inode :< my life is a lie

@sir @314

man 7 inode

or just hexdump your filesystem and see it for yourself.

Or chmod -r all files in a directory, try running ls, and observe what it spits out when stat(3p) fails.

@sir @314
hmm... nvm that stat thing, only happens on android with SELinux

@sir @314
Oh, I know how to reproduce:

mkdir foo
touch foo/bar
chmod a-x foo
ls -l foo

You'll be able to read the directory, but not access any file inside it. Stat will fail, you'll see:

-????????? ? ? ? ? ? bar

@Wolf480pl so the inode for the symlink has mode bits, but they are almost universally ignored. Also, only some short symlinks are stored in the inode itself. This was an optimization introduced in BSD 4.3 I think? The target of the symlink is stored in the space for the inode block pointers, if it fits. If it doesn't fit, a data block is allocated and the target is stored there. (Undoubtedly some more variation by filesystem since the 80s.)

@tedu yeah, haven't actually checked how the path is stored but what you describe sounds very reasonable

Sign in to participate in the conversation

Welcome to your niu world ! We are a cute and loving international community O(≧▽≦)O !