Open chaudhryfaisal opened 1 year ago
Oof, this seems like a fundamental design incompatibility that may be hard to fix. It never occurred to me that there might be platforms where the root directory is not readable. The KJ filesystem code likes to open directory file descriptors and then use openat() to open files and subdiroctiers from there. It doesn't actually need to read directory entries, but open() requires you to specify exactly one of O_RDONLY, O_WRONLY, or O_RDWR, and so we specify O_RDONLY, but this leads to access denied I guess. I wish there were an O_NOACCESS mode we could use here.
I suppose the only way around this would be a deep refactoring of the implementation of DiskDirectory
such that "root" and "current directory" can be specified in symbolic ways. For "current directory", we'd then use AT_FDCWD instead of an actual file descriptor. For the root directory, we'd again use AT_FDCWD and also prefix all paths with /
.
But there are complexities. What happens if someone calls getFd()
? Do we return null, or do we lazily try to open an FD at that point?
Unfortunately I don't know if this is something I can work on anytime soon. It may be that the capnp
tool (and kj::newDiskFilesystem()
) simply cannot work in this environment for now... sorry.
trying to compile capnproto in temux on android 11 which does not give access to "/"
I see "/" is used here
if I patch "/" with $PREFIX before:
after
however, it is not able to find sources in the prefix directory
notice it tried to open directory without "/" as prefix openat(3, "data/data/com.termux/files/home/build/capnproto-c++-0.8.0/src", O_RDONLY|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)