Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] realpath doesn't fail on non-existent paths on old devices #1260

Closed
DanAlbert opened this issue May 15, 2020 · 7 comments
Closed

[BUG] realpath doesn't fail on non-existent paths on old devices #1260

DanAlbert opened this issue May 15, 2020 · 7 comments
Labels

Comments

@DanAlbert
Copy link
Member

It looks like this was probably fixed in kitkat with https://android-review.googlesource.com/c/platform/bionic/+/52650 (that's when the test was added). The bug is definitely present on Jelly Bean.

This causes std::filesystem::canonical to incorrectly succeed on non-existent paths.

@enh-google
Copy link
Collaborator

(given https://android-review.googlesource.com/c/platform/bionic/+/1156838 we could potentially inline this if we cared enough about pre-KitKat.)

@yujincheng08
Copy link

Is anyone working on it? It also destroys libc.a for API 22, preventing static binary using realpath with kernel version < 3.6. My current workaround is LD_FLAGS += --wrap=realpath to override the old implementation.

@vvb2060
Copy link

vvb2060 commented Mar 19, 2022

I don't know why ndk thinks supporting kernel versions smaller than 3.6 is unimportant.

@enh-google
Copy link
Collaborator

for Google devices at least, kernel 3.6 was the jellybean kernel, and jellybean is no longer a supported NDK target. that does mean that devices that shipped with jellybean but saw a couple of dessert updates are still supported by the NDK, but our assumption is that the number of such devices is relatively small --- and that if this hasn't been a major problem in the years where those devices represented a larger fraction of devices, it's not going to be a major problem as those numbers dwindle to nothing.

this is actually something i don't think we'd realized though... the point being that (quoting https://man7.org/linux/man-pages/man2/open.2.html), although O_PATH is available since Linux 2.6.39, it only works with fstat(2) since Linux 3.6, and https://android-review.googlesource.com/c/platform/bionic/+/1156838 uses fstat(2). this means that when we say that adding the new implementation to the headers fixes everything back to "kitkat", we actually only mean "back to devices that launched with kitkat", not ones that were upgraded to it.

@DanAlbert
Copy link
Member Author

I don't know why ndk thinks supporting kernel versions smaller than 3.6 is unimportant.

Not sure what led you to believe that. If we didn't care this bug would be closed wontfix. We have a lot of other tasks on our plate in addition to this one.

@yujincheng08
Copy link

@enh-google Looks like my finding is another issue. So I opened another issue here: #1686

@DanAlbert
Copy link
Member Author

Given that a CTS test was added to kitkat, and our minimum supported OS is now lollipop, this is probably obsolete? There's a chance that some devices upgrading from JB to L will have been given waivers, but I don't have access to that data afaik. If anyone knows that this is still a problem, lmk. I'm not really sure what can actually be done about this anyway.

@DanAlbert DanAlbert closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants