Version in base suite: 1.8.1-1 Base version: python-internetarchive_1.8.1-1 Target version: python-internetarchive_1.8.1-1+deb10u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/p/python-internetarchive/python-internetarchive_1.8.1-1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/p/python-internetarchive/python-internetarchive_1.8.1-1+deb10u1.dsc changelog | 6 ++ patches/0001-close-file-after-getting-md5.patch | 55 ++++++++++++++++++++++++ patches/series | 1 3 files changed, 62 insertions(+) diff -Nru python-internetarchive-1.8.1/debian/changelog python-internetarchive-1.8.1/debian/changelog --- python-internetarchive-1.8.1/debian/changelog 2018-09-25 03:08:05.000000000 +0000 +++ python-internetarchive-1.8.1/debian/changelog 2020-01-31 20:00:57.000000000 +0000 @@ -1,3 +1,9 @@ +python-internetarchive (1.8.1-1+deb10u1) buster; urgency=medium + + * hotfix: close file after getting md5 (Closes: #950289) + + -- Antoine Beaupré Fri, 31 Jan 2020 15:00:57 -0500 + python-internetarchive (1.8.1-1) unstable; urgency=low * Package internetarchive library for Debian (Closes: #909550) diff -Nru python-internetarchive-1.8.1/debian/patches/0001-close-file-after-getting-md5.patch python-internetarchive-1.8.1/debian/patches/0001-close-file-after-getting-md5.patch --- python-internetarchive-1.8.1/debian/patches/0001-close-file-after-getting-md5.patch 1970-01-01 00:00:00.000000000 +0000 +++ python-internetarchive-1.8.1/debian/patches/0001-close-file-after-getting-md5.patch 2020-01-31 20:00:57.000000000 +0000 @@ -0,0 +1,55 @@ +From 086e2e65fc840fd827b02e1022fad084ee700d7c Mon Sep 17 00:00:00 2001 +From: kpcyrd +Date: Fri, 31 Jan 2020 14:53:05 -0500 +Subject: [PATCH] close file after getting md5 + +I've tried to upload to archive.org and noticed ia crashes on +large folders. + + $ ulimit -n + 1024 + $ ia upload asdf ./folder-with-more-than-1024-files/ + [...] + OSError: [Errno 24] Too many open files + [...] + $ + +The bug is present in src:python-internetarchive, I found a patch that +resolves the issue from 2018 that was never applied. You can find a +patch that cleanly applies to the current debian/sid below. The original +author is github.com/Arkiver2. + +Upstream patch: +https://github.com/jjjake/internetarchive/commit/4e4120f07c98ea98c61791293835df2797bfee61 + +Debian Bug: #950289 +--- + internetarchive/utils.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/internetarchive/utils.py b/internetarchive/utils.py +index db8412a..2f3e04e 100644 +--- a/internetarchive/utils.py ++++ b/internetarchive/utils.py +@@ -235,14 +235,16 @@ def recursive_file_count(files, item=None, checksum=False): + is_dir = False + if is_dir: + for x, _ in iter_directory(f): +- lmd5 = get_md5(open(x, 'rb')) ++ with open(x, 'rb') as f_: ++ lmd5 = get_md5(f_) + if lmd5 in md5s: + continue + else: + total_files += 1 + else: + try: +- lmd5 = get_md5(open(f, 'rb')) ++ with open(f, 'rb') as f_: ++ lmd5 = get_md5(f_) + except TypeError: + # Support file-like objects. + lmd5 = get_md5(f) +-- +2.20.1 + diff -Nru python-internetarchive-1.8.1/debian/patches/series python-internetarchive-1.8.1/debian/patches/series --- python-internetarchive-1.8.1/debian/patches/series 2018-09-25 03:08:05.000000000 +0000 +++ python-internetarchive-1.8.1/debian/patches/series 2020-01-31 20:00:57.000000000 +0000 @@ -1 +1,2 @@ 0001-v1.8.1.patch +0001-close-file-after-getting-md5.patch