diff -Nru targetcli-fb-2.1.53/debian/changelog targetcli-fb-2.1.53/debian/changelog --- targetcli-fb-2.1.53/debian/changelog 2024-05-25 10:20:10.000000000 +0200 +++ targetcli-fb-2.1.53/debian/changelog 2025-07-26 09:27:03.000000000 +0200 @@ -1,3 +1,12 @@ +targetcli-fb (1:2.1.53-1.3) unstable; urgency=medium + + * Non-maintainer upload. + + [Fiona Ebner] + * fix Python exception when creating LUNs with ACLs present (Closes: #1109887) + + -- Fabian Grünbichler Sat, 26 Jul 2025 09:27:03 +0200 + targetcli-fb (1:2.1.53-1.2) unstable; urgency=medium * Non-maintainer upload. diff -Nru targetcli-fb-2.1.53/debian/patches/fix-mapping-the-new-lun-to-the-node-acl.patch targetcli-fb-2.1.53/debian/patches/fix-mapping-the-new-lun-to-the-node-acl.patch --- targetcli-fb-2.1.53/debian/patches/fix-mapping-the-new-lun-to-the-node-acl.patch 1970-01-01 01:00:00.000000000 +0100 +++ targetcli-fb-2.1.53/debian/patches/fix-mapping-the-new-lun-to-the-node-acl.patch 2025-07-26 09:27:03.000000000 +0200 @@ -0,0 +1,30 @@ +From: Maurizio Lombardi +Date: Tue, 30 Jan 2024 13:03:08 +0100 +X-Dgit-Generated: 1:2.1.53-1.3 f08f99b5ffac3186a2f9162d6baf882662cf77ac +Subject: Fix mapping the new LUN to the node ACL + +Signed-off-by: Maurizio Lombardi +Bug-Debian: https://bugs.debian.org/1109887 +Origin: https://github.com/open-iscsi/targetcli-fb/commit/560993168d85ec7c84e9aacba5659aa17b40588c +Last-Update: 2025-07-25 + +--- + +diff --git a/targetcli/ui_target.py b/targetcli/ui_target.py +index 2c46765..65df61f 100644 +--- a/targetcli/ui_target.py ++++ b/targetcli/ui_target.py +@@ -1151,10 +1151,9 @@ class UILUNs(UINode): + possible_mlun += 1 + mapped_lun = possible_mlun + +- else: +- mlun = MappedLUN(acl, mapped_lun, lun_object, write_protect=False) +- self.shell.log.info("Created LUN %d->%d mapping in node ACL %s" +- % (mlun.tpg_lun.lun, mlun.mapped_lun, acl.node_wwn)) ++ mlun = MappedLUN(acl, mapped_lun, lun_object, write_protect=False) ++ self.shell.log.info("Created LUN %d->%d mapping in node ACL %s" ++ % (mlun.tpg_lun.lun, mlun.mapped_lun, acl.node_wwn)) + self.parent.refresh() + + return self.new_node(ui_lun) diff -Nru targetcli-fb-2.1.53/debian/patches/series targetcli-fb-2.1.53/debian/patches/series --- targetcli-fb-2.1.53/debian/patches/series 2021-01-11 17:50:17.000000000 +0100 +++ targetcli-fb-2.1.53/debian/patches/series 2025-07-26 09:27:03.000000000 +0200 @@ -1 +1,3 @@ use-rtslib-fb-target-instead-of-etc-target.patch +target-remove-the-reference-to-max_lun.patch +fix-mapping-the-new-lun-to-the-node-acl.patch diff -Nru targetcli-fb-2.1.53/debian/patches/target-remove-the-reference-to-max_lun.patch targetcli-fb-2.1.53/debian/patches/target-remove-the-reference-to-max_lun.patch --- targetcli-fb-2.1.53/debian/patches/target-remove-the-reference-to-max_lun.patch 1970-01-01 01:00:00.000000000 +0100 +++ targetcli-fb-2.1.53/debian/patches/target-remove-the-reference-to-max_lun.patch 2025-07-26 09:27:03.000000000 +0200 @@ -0,0 +1,41 @@ +From: Maurizio Lombardi +Date: Thu, 19 Oct 2023 14:15:54 +0200 +X-Dgit-Generated: 1:2.1.53-1.3 ae9718771e0894b5cb3d6f17e9109b44e364d0c8 +Subject: target: remove the reference to MAX_LUN + +The MappedLUN.MAX_LUN symbol has been removed from rtslib. +Remove the reference to it. + +Signed-off-by: Maurizio Lombardi +Bug-Debian: https://bugs.debian.org/1109887 +Origin: https://github.com/open-iscsi/targetcli-fb/commit/4424eba4ba9f5c66c0cd8691fd4aad87ee19640f +Last-Update: 2025-07-25 + +--- + +diff --git a/targetcli/ui_target.py b/targetcli/ui_target.py +index e8ba6c6..2c46765 100644 +--- a/targetcli/ui_target.py ++++ b/targetcli/ui_target.py +@@ -1146,16 +1146,11 @@ class UILUNs(UINode): + mapped_lun = 0 + existing_mluns = [mlun.mapped_lun for mlun in acl.mapped_luns] + if mapped_lun in existing_mluns: +- mapped_lun = None +- for possible_mlun in six.moves.range(MappedLUN.MAX_LUN): +- if possible_mlun not in existing_mluns: +- mapped_lun = possible_mlun +- break +- +- if mapped_lun == None: +- self.shell.log.warning( +- "Cannot map new lun %s into ACL %s" +- % (lun_object.lun, acl.node_wwn)) ++ possible_mlun = 0 ++ while possible_mlun in existing_mluns: ++ possible_mlun += 1 ++ mapped_lun = possible_mlun ++ + else: + mlun = MappedLUN(acl, mapped_lun, lun_object, write_protect=False) + self.shell.log.info("Created LUN %d->%d mapping in node ACL %s"