2) The attribute for directories is always 48/$30 which is faDirectory or faArchive. Why is the faArchive flag always set? This is nonsense.
The documentation of
findFirst says:
- faArchive
- file needs to be archived. Not possible on Unix
An
strace(1) reveals that
findFirst/
findNext do a plain
stat(2). This system call conveys only
limited information (particularly in the
st_mode field).
In order to determine whether a file should be archived, you would [at least] need to
- examine the mount, the 5th field in fstab(5), and
- the file attributes (absence/presence of the d flag).
For the latter you would need to do an additional
ioctl(…, FS_IOC_GETFLAGS, …), confer what
lsattr(1) does.
Evidently this is quite a hassle. I
guess it’s an implementation choice simply marking
all files with
faArchive.
1) Symbolic links are never reported correct. The attribute is shown as 32/$20 which is the value for faArchive. It should be $0400
Again, the documentation of
findFirst reads:
- faAnyFile
- Find any file (this is a combination of the other flags).
The phrase “the other flags” only refers those
six listed flags.
faSymLink is
not one of
them, confer their numeric values.
If you do a
findFirst('*', faAnyFile or faSymLink, info)
(note the
or faSymLink) you will find all information, including symbolic links being reported properly.