-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
gh-116541: Handle errors correctly in _pystatvfs_fromstructstatvfs
#116542
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
Conversation
SET_RESULT(PyLong_FromLong((long) st.f_bsize)); | ||
SET_RESULT(PyLong_FromLong((long) st.f_frsize)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that some code is the same in both branches.
Also, on Linux some of fields are defined as unsigned long
instead of long
. Did not check other Posix systems. There may be a problem, but this is another issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I found this:
struct statvfs {
unsigned long f_bsize; /* Filesystem block size */
unsigned long f_frsize; /* Fragment size */
fsblkcnt_t f_blocks; /* Size of fs in f_frsize units */
fsblkcnt_t f_bfree; /* Number of free blocks */
fsblkcnt_t f_bavail; /* Number of free blocks for
unprivileged users */
fsfilcnt_t f_files; /* Number of inodes */
fsfilcnt_t f_ffree; /* Number of free inodes */
fsfilcnt_t f_favail; /* Number of free inodes for
unprivileged users */
unsigned long f_fsid; /* Filesystem ID */
unsigned long f_flag; /* Mount flags */
unsigned long f_namemax; /* Maximum filename length */
};
My proposal:
- Let's keep this PR focused on a new error handling
- I will open a new issue about this and do more research: why is it like this
- Probably I will send a second PR fixing the type
Since posixmodule
is rather hard, I would prefer not to do any semantic changes now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are going to backport this change, you can merge it first. Otherwise it is better to wait until the other issue be solved.
I am going to backport this change, like all others. Thanks a lot for finding this and reviewing my PRs! 👍 Here's a link for the |
Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
…tvfs` (pythonGH-116542) (cherry picked from commit f8147d0) Co-authored-by: Nikita Sobolev <[email protected]>
GH-116643 is a backport of this pull request to the 3.12 branch. |
…tvfs` (pythonGH-116542) (cherry picked from commit f8147d0) Co-authored-by: Nikita Sobolev <[email protected]>
GH-116644 is a backport of this pull request to the 3.11 branch. |
_pystatvfs_fromstructstatvfs
inposixmodule
#116541