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

conf: Return an error if zlog_init is called with a non-regular file #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iancuivasciuc
Copy link

Currently, calling zlog_init with a non-regular file (e.g., a directory) didn’t return an error. The logger would have been configured the same as with an empty file.

The file is now checked to ensure it is regular, and an error is returned if it is not.

Fixes #278.

@deemar
Copy link
Collaborator

deemar commented Nov 11, 2024

I think a symbolic link should be accepted too.

@iancuivasciuc
Copy link
Author

I don’t have extensive experience, so I could be mistaken. If I only check that the file is a symlink, it could still point to something other than a regular file, which should be avoided.

Shouldn't the stat command be used directly? I also noticed that stat is used directly in other parts of the project.

Currently, calling zlog_init with a non-regular file (e.g., a directory)
didn’t return an error. The logger would have been configured the same
as with an empty file.

The file is now checked to ensure it is regular, and an error is returned
if it is not.

Fixes HardySimpson#278.
@deemar
Copy link
Collaborator

deemar commented Nov 15, 2024

I don’t have extensive experience, so I could be mistaken. If I only check that the file is a symlink, it could still point to something other than a regular file, which should be avoided.

Shouldn't the stat command be used directly? I also noticed that stat is used directly in other parts of the project.

you can use realpath first

@iancuivasciuc
Copy link
Author

iancuivasciuc commented Nov 16, 2024

you can use realpath first

But is there a problem with the current pr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

conf: zlog_init doesn't return an error when given a non-regular file path for initialization
2 participants