libloc: Fix bug14047 - return 3 when database is latest version

Message ID 20260912103417.14444-1-adolf.belka@ipfire.org
State New
Headers
Series libloc: Fix bug14047 - return 3 when database is latest version |

Commit Message

Adolf Belka 12 Sep 2026, 10:34 a.m. UTC
- Currently libloc returns 0 when the database is the current version. Tha man page says
   it should return 3. The reason is that the return for that check is on its own so it
   defaults to returning 0.
- This patch makes it return 3.
- Fix has been confirmed to return 3 on my vm testbed system.
- A separate patch will be submitted that adds the fix to location.in in the libloc repo
   so that a future update version of libloc will include this fix and the patch in this
   submission can then be removed.

Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Fixes: bug14047
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 lfs/libloc                                            |  3 ++-
 ....19-Return_3_when_database_is_latest_version.patch | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 src/patches/libloc-0.9.19-Return_3_when_database_is_latest_version.patch
  

Patch

diff --git a/lfs/libloc b/lfs/libloc
index 5aee8813f..bfa0234d2 100644
--- a/lfs/libloc
+++ b/lfs/libloc
@@ -1,7 +1,7 @@ 
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2025  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2026  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -81,6 +81,7 @@  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 
 	# https://lists.ipfire.org/pipermail/development/2022-November/014763.html
 	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/libloc-0.9.18-Revert-Install-Perl-files-to-Perl-vendor-directory.patch
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/libloc-0.9.19-Return_3_when_database_is_latest_version.patch
 	cd $(DIR_APP) && ./autogen.sh
 	cd $(DIR_APP) && ./configure \
 			--prefix=/usr \
diff --git a/src/patches/libloc-0.9.19-Return_3_when_database_is_latest_version.patch b/src/patches/libloc-0.9.19-Return_3_when_database_is_latest_version.patch
new file mode 100644
index 000000000..4ebd84c10
--- /dev/null
+++ b/src/patches/libloc-0.9.19-Return_3_when_database_is_latest_version.patch
@@ -0,0 +1,11 @@ 
+--- libloc-0.9.19/src/scripts/location.in.orig	2026-06-02 16:41:25.000000000 +0200
++++ libloc-0.9.19/src/scripts/location.in	2026-09-10 16:00:33.706282553 +0200
+@@ -468,7 +468,7 @@
+ 		# Check the version of the local database
+ 		if db and t and db.created_at >= t:
+ 			log.info("Already on the latest version")
+-			return
++			return 3
+ 
+ 		# Download the database into the correct directory
+ 		tmpdir = os.path.dirname(ns.database)