Skip to contentSkip to conversation

package/fail2ban: fix fail2ban-python symlink

PATCH New Peter Korsgaard 2 participants 4 messages Oct 5, 2020 – Oct 10, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/fail2ban: fix fail2ban-python symlink

Fixes (reproducible):
http://autobuild.buildroot.net/results/50f/50f199bfe06d054cc6770760e73ac0de594a0670/diffoscope-results.txt

Fail2ban installs the fail2ban-python symlink pointing to the host python intepreter used to run setup.py, which is naturally not valid at runtime and breaks the reproducible tests as shown in the diffoscope results:

? -lrwxrwxrwx   0        0        0        0 2020-10-04 10:50:38.000000 ./usr/bin/fail2ban-python -> /home/naourr/work/instance-0/output-1/host/bin/python
? +lrwxrwxrwx   0        0        0        0 2020-10-04 10:50:38.000000 ./usr/bin/fail2ban-python -> /home/naourr/work/instance-0/output-2/host/bin/python

As a workaround, update the symlink after installation to point to the correct target python.

---
 package/fail2ban/fail2ban.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/fail2ban/fail2ban.mk +7 -0
index a0a2dc704b..a4ee0852cc 100644
@@ -27,6 +27,13 @@ define FAIL2BAN_FIX_DEFAULT_CONFIG
 endef
 FAIL2BAN_POST_INSTALL_TARGET_HOOKS += FAIL2BAN_FIX_DEFAULT_CONFIG
 
+# fail2ban-python points to host python
+define FAIL2BAN_FIX_FAIL2BAN_PYTHON_SYMLINK
+	ln -snf $(if $(BR2_PACKAGE_PYTHON),python,python3) \
+		$(TARGET_DIR)/usr/bin/fail2ban-python
+endef
+FAIL2BAN_POST_INSTALL_TARGET_HOOKS += FAIL2BAN_FIX_FAIL2BAN_PYTHON_SYMLINK
+
 define FAIL2BAN_INSTALL_INIT_SYSV
 	$(INSTALL) -D -m 755 package/fail2ban/S60fail2ban \
 		$(TARGET_DIR)/etc/init.d/S60fail2ban
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/fail2ban: fix fail2ban-python symlink

Quoted 10 lines · On Mon, 5 Oct 2020 07:58:08 +0200 Peter Korsgaard <[email protected]> wrote:

Fixes (reproducible):
http://autobuild.buildroot.net/results/50f/50f199bfe06d054cc6770760e73ac0de594a0670/diffoscope-results.txt

Fail2ban installs the fail2ban-python symlink pointing to the host python intepreter used to run setup.py, which is naturally not valid at runtime and breaks the reproducible tests as shown in the diffoscope results:

? -lrwxrwxrwx   0        0        0        0 2020-10-04 10:50:38.000000 ./usr/bin/fail2ban-python -> /home/naourr/work/instance-0/output-1/host/bin/python
? +lrwxrwxrwx   0        0        0        0 2020-10-04 10:50:38.000000 ./usr/bin/fail2ban-python -> /home/naourr/work/instance-0/output-2/host/bin/python
Quoted 7 lines

As a workaround, update the symlink after installation to point to the correct target python.

---
 package/fail2ban/fail2ban.mk | 7 +++++++
 1 file changed, 7 insertions(+)

It would have been nicer to have something supported by upstream fail2ban. I guess like me you looked at the setup.py logic, and realized that it was too convoluted to find a reasonably simple fix?

So applied to master. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/fail2ban: fix fail2ban-python symlink

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 3 lines

It would have been nicer to have something supported by upstream fail2ban. I guess like me you looked at the setup.py logic, and realized that it was too convoluted to find a reasonably simple fix?

Indeed ;)

Quoted 1 line

So applied to master. Thanks!

Thanks!

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/1 package/fail2ban: fix fail2ban-python symlink

In reply to Peter Korsgaard
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Fixes (reproducible):
http://autobuild.buildroot.net/results/50f/50f199bfe06d054cc6770760e73ac0de594a0670/diffoscope-results.txt

Fail2ban installs the fail2ban-python symlink pointing to the host python intepreter used to run setup.py, which is naturally not valid at runtime and breaks the reproducible tests as shown in the diffoscope results:

Quoted 7 lines
? -lrwxrwxrwx   0        0        0        0 2020-10-04 10:50:38.000000 ./usr/bin/fail2ban-python -> /home/naourr/work/instance-0/output-1/host/bin/python
? +lrwxrwxrwx   0        0        0        0 2020-10-04 10:50:38.000000 ./usr/bin/fail2ban-python -> /home/naourr/work/instance-0/output-2/host/bin/python

As a workaround, update the symlink after installation to point to the correct target python.

Committed to 2020.02.x, 2020.05.x and 2020.08.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard