osbuild/util/fscache: calculate actual size of files
In OSBuild we'll often be operating on sparse files. Let's make the tabulation of the size of files on disk used when determining cache size for pruning consider the actual size of the file usage on disk rather than the size the file reports to be. This means using os.lstat().st_blocks * 512 versus os.lstat().st_size. See https://stackoverflow.com/a/55203604
This commit is contained in:
parent
29e05c689e
commit
9121360f7b
1 changed files with 1 additions and 1 deletions
|
|
@ -288,7 +288,7 @@ class FsCache(contextlib.AbstractContextManager, os.PathLike):
|
|||
return sum(
|
||||
os.lstat(
|
||||
os.path.join(path, f)
|
||||
).st_size for path, dirs, files in os.walk(
|
||||
).st_blocks * 512 for path, dirs, files in os.walk(
|
||||
path_target
|
||||
) for f in files
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue