-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
shutil.disk_usage - Lacking documentation #83006
Comments
https://docs.python.org/3.8/library/shutil.html#shutil.disk_usage There's no mention that this helper function simply calls It's clear as day if you see the code: https://github.com/python/cpython/blob/master/Lib/shutil.py#L1249 But if you're a novice user, this will puzzle your brain. shutil.disk_usage('/dev/sda')
shutil.disk_usage('/dev/sdb')
shutil.disk_usage('/dev/sdc') Which translates to: os.statvfs('/dev/sd?')' -- All I'm asking, is that we add a little note stating: Thanks in advance. |
I modified psutil to shutil since I feel it's a typo. Please revert back if it's incorrect. |
xtreak: You are correct, that was a typo. My apologies. |
This issue is a bit dated, but here goes: On Unix, the function On Windows, the function Looking through the rest of the page, no other functions get into such specifics; maybe this is outside the scope of the document. Maybe the issue should be closed. |
Not even the kernel knows how much space is available on a nonmounted partition. It doesn't know much beyond the fact that it exists and where it exists. There exist tools that can analyze nonmounted partitions, but these will vary by filesystem and operating system. If someone wants to implement solutions for the most common filesystem-OS combinations, then that might be helpful. But considering that no one has done that or even asked for it yet, I'm not sure that doing so is worth the effort. So I agree that documenting it is the best approach. It should be documented such that the limitations are mentioned, not necessarily how it's implemented. If explaining which system calls are used helps explain the limitations, then so be it. Additionally, as far as I'm concerned, there's no reason to restrict other Python implementations from implementing functionality for nonmounted disks. So the limitations should be described as being CPython-specific, akin to what is done for |
Something like this: .. impl-detail:: On Sun, 11 Jul 2021 at 16:18, Tyler Crompton <report@bugs.python.org> wrote:
|
…ted filesystems on Unix (pythonGH-107031) (cherry picked from commit 6e5f223) Co-authored-by: Matthieu Caneill <matthieucan@users.noreply.github.com>
…ted filesystems on Unix (pythonGH-107031) (cherry picked from commit 6e5f223) Co-authored-by: Matthieu Caneill <matthieucan@users.noreply.github.com>
Looks like behaviour is now documented, thanks all! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
shutil.disk_usage
for non-mounted filesystems on Unix #107031shutil.disk_usage
for non-mounted filesystems on Unix (GH-107031) #107047shutil.disk_usage
for non-mounted filesystems on Unix (GH-107031) #107048The text was updated successfully, but these errors were encountered: