PR #24339 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24339
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24339.patch

Without explicitly flushing (which a close does), the last write, if small 
enough, might not have hit the disk yet.
So the digest() function would miss reading it, resulting in a wrong hash.
Closing it is generally better, since it not only flushes it, but also closes 
the handle, avoid a rename of a file with an open handle.


>From c0516ee7966f4ecd845a6ca9bc8062f737031a3e Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <[email protected]>
Date: Mon, 31 Aug 2026 19:17:47 +0200
Subject: [PATCH] forgejo/inject-pr-samples: properly flush and close injected
 sample before hashing

---
 .forgejo/inject-pr-samples.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.forgejo/inject-pr-samples.py b/.forgejo/inject-pr-samples.py
index 3f50067751..0c328279e0 100755
--- a/.forgejo/inject-pr-samples.py
+++ b/.forgejo/inject-pr-samples.py
@@ -109,6 +109,7 @@ def download(url, dst):
             with urllib.request.urlopen(url) as r:
                 while chunk := r.read(1 << 16):
                     tmp.write(chunk)
+            tmp.close()
             if dst.exists() and digest(dst) != digest(tmp_path):
                 raise ValueError(f"already exists with different content: 
{dst}")
             tmp_path.rename(dst)
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to