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

UCG may refuse to open read-only file #119

Open
ZyX-I opened this issue Sep 2, 2017 · 0 comments
Open

UCG may refuse to open read-only file #119

ZyX-I opened this issue Sep 2, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@ZyX-I
Copy link

ZyX-I commented Sep 2, 2017

Tried the following code:

ucg x /var/log/messages

Surprisingly it failed with

ucg: error: GetFileDescriptor(): open(/var/log/messages) failed: Operation not permitted

ag and grep are fine with opening the file. After some research I found that grep opens file with openat and flags O_RDONLY|O_NOCTTY, ag opens file with just O_RDONLY (after attempting to open it as a directory with different set of flags) and ucg tries O_RDONLY|O_NOCTTY|O_NOATIME. The last flag looks like what is causing command to fail: according to man open flag may be used either if EUID matches file owner (not true: owner is root, EUID is zyx) or calling process has CAP_FOWNER capability in … (also not true: not using capabilities anywhere in my system).

I would suggest that ucg should retry without O_NOATIME if it got EPERM.

@gvansickle gvansickle self-assigned this Jul 29, 2022
@gvansickle gvansickle added the bug label Jul 29, 2022
@gvansickle gvansickle added this to the Version 0.4.0 milestone Jul 29, 2022
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

2 participants