Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 446330 - sys-fs/glusterfs-3.3.1 fails to detect peer with python-3 set as system interpreter
Summary: sys-fs/glusterfs-3.3.1 fails to detect peer with python-3 set as system inter...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Alexey Shvetsov
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-07 08:36 UTC by Tiziano Müller (RETIRED)
Modified: 2013-01-06 09:47 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
New ebuild with Tiziano's patch applied (glusterfs-3.3.1.ebuild,4.01 KB, text/plain)
2013-01-05 16:23 UTC, Nathan Shearer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tiziano Müller (RETIRED) gentoo-dev 2012-12-07 08:36:12 UTC
What you get is this:

Executing: gluster peer probe 10.1.120.11 ...
Traceback (most recent call last):
File "/usr/libexec/glusterfs/python/syncdaemon/gsyncd.py", line 16, in 
from ipaddr import IPAddress, IPNetwork
File "/usr/libexec/glusterfs/python/syncdaemon/ipaddr.py", line 1468
ip_int = 0L
^
SyntaxError: invalid syntax

The reason for that is that the gsyncd executable contains an explicit python path "/usr/bin/python"  which points correctly to python2 at build time due to python_set_active_version 2, but points to python3 at runtime if the system interpreter version is set to 3.
In other terms: it ignores the shebangs on most of its python scripts but uses the interpreter it detects at compile time.

This is what I am doing to fix it:
--- /var/repositories/gentoo-x86/sys-cluster/glusterfs/glusterfs-3.3.1.ebuild	2012-12-07 09:34:12.000000000 +0100
+++ glusterfs-3.3.1-r1.ebuild	2012-12-07 08:26:41.000000000 +0100
@@ -60,6 +60,12 @@
 		--docdir=/usr/share/doc/${PF}
 		--localstatedir=/var
 	)
+
+	# glusterfs records the python executable in the gsyncd executable
+	# and executes python scripts without considering their shebang, breaking
+	# things with python3 set as system interpreter. Forcing it to use python2 directly.
+	export PYTHON="${PREFIX}/usr/bin/python2"
+
 	autotools-utils_src_configure
 }
Comment 1 Nathan Shearer 2013-01-05 16:23:34 UTC
Created attachment 334544 [details]
New ebuild with Tiziano's patch applied

The latest stable version of glusterfs (3.3.1) builds and works as expected with this ebuild.
Comment 2 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2013-01-06 09:28:20 UTC
Is that really needed? I have something like this on my box:

$ head -n 1 gsyncd.py
#!/usr/bin/env python2
$ head -n 1 ipaddr.py 
#!/usr/bin/python2
Comment 3 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2013-01-06 09:30:28 UTC
(In reply to comment #2)
> Is that really needed? I have something like this on my box:
> 
> $ head -n 1 gsyncd.py
> #!/usr/bin/env python2
> $ head -n 1 ipaddr.py 
> #!/usr/bin/python2

Nvm, I now understand the issue:
$ strings /usr/libexec/glusterfs/gsyncd | grep python
/usr/bin/python
/usr/libexec/glusterfs/python/syncdaemon/gsyncd.py
exec of /usr/bin/python failed
Comment 4 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2013-01-06 09:47:33 UTC
+  06 Jan 2013; Kacper Kowalik <xarthisius@gentoo.org> glusterfs-3.3.1.ebuild:
+  Force gsyncd to use python2 wrt #446330 by Tiziano Müller <dev-
+  zero@gentoo.org>