From f76061e1386894c00b07e198dc84c91b45053234 Mon Sep 17 00:00:00 2001 From: garbled1 Date: Fri, 16 Feb 2024 09:11:49 -0700 Subject: [PATCH] Fix a potential infinite loop condition, that causes the script to consume all ram on the box and get oom-killed. --- scripts/order-symlinks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/order-symlinks.py b/scripts/order-symlinks.py index c38511676..a0079c806 100755 --- a/scripts/order-symlinks.py +++ b/scripts/order-symlinks.py @@ -61,7 +61,10 @@ def create_symlinks(d): else: order.extend(data["pages"][work]["images"].values()) if "prev" in data["pages"][work]: - work = data["pages"][work]["prev"] + if data["pages"][work]["prev"] == work: + work = None + else: + work = data["pages"][work]["prev"] else: work = None order.reverse()