From fd6f587668fbf3113db929d8fef0207b802f219f Mon Sep 17 00:00:00 2001 From: Oliver Kurth Date: Fri, 6 Dec 2024 22:10:36 +0000 Subject: [PATCH 1/2] reposync: avoid creating a linked list with a loop Signed-off-by: Oliver Kurth --- client/packageutils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/client/packageutils.c b/client/packageutils.c index 4278d2fd..9c96981f 100644 --- a/client/packageutils.c +++ b/client/packageutils.c @@ -547,6 +547,7 @@ TDNFPkgInfoFilterNewest( { pPkgInfo->pNext = ppPkgInfos[i]; pPkgInfo = ppPkgInfos[i]; + pPkgInfo->pNext = NULL; } } From 260b66ff4af1ce645579eaf85a65bf83f6c0003b Mon Sep 17 00:00:00 2001 From: Oliver Kurth Date: Fri, 6 Dec 2024 22:11:14 +0000 Subject: [PATCH 2/2] add test for reposync which may cause an infinite loop Signed-off-by: Oliver Kurth --- pytests/tests/test_reposync.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pytests/tests/test_reposync.py b/pytests/tests/test_reposync.py index 1073e172..e2ea597f 100644 --- a/pytests/tests/test_reposync.py +++ b/pytests/tests/test_reposync.py @@ -432,3 +432,18 @@ def test_reposync_newest(utils): assert mulversion_pkgname_found shutil.rmtree(synced_dir) + + +# reposync with --newest-only option caused an infinite loop +def test_reposync_newest_multiplerepos(utils): + reponame = "photon-srpms" + workdir = WORKDIR + utils.makedirs(workdir) + + ret = utils.run(['tdnf', + '--enablerepo={}'.format(reponame), + '--newest-only', + '--urls', + 'reposync'], + cwd=workdir) + assert ret['retval'] == 0