Open dangerdyke opened 5 months ago
A further discovery regarding the latter problem:
It turns out in my above example, the attributes
function was indeed expanding the symlink and stat
ing the file it points to, meaning that the filetype decoding issue was actually not the cause of the filetype being listed as normal. However, breaking the symlink causes the library to stat the intended inode. This causes the permission bits to be decoded correctly, but the detected filetype to be even more incorrect: the filetype was decoded as being both a normal file and a block device. This makes sense since the filetype enumeration for symlinks is 0b1010...
, which would flag 2 different attributes using the internal decode-bitfield
function
The way
decode-file-attributes
decodes inode attributes for the linux and unix backends is wrong.for example, i can make a symbolic link, and confirm that it is indeed a symbolic link, like so:
But if I look at the decoded attributes of the created link, the returned plist says it is a normal file, rather then a link. Furthermore, the permissions are wrong; CLI
stat
shows0777
, yet the plist indicates equivalent to0644
(the same as the file the link points to)The issue with the inode type is caused by simplistic assumptions about unix file mode bitfields: rather then being a single bit, the type enumeration is represented by matching a number of different 4-bit integer constants. From the linux manpage for
inode
(masks in octal):The permissions issue may require some more investigation on my part. I suspect it may have to do with how pathnames of symlinks are expanded in the lisp code.