Bug 620298 - FTBFS - cyphesis doesn't build on F-14/rawhide
FTBFS - cyphesis doesn't build on F-14/rawhide
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: cyphesis (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: Bruno Wolff III
Fedora Extras Quality Assurance
:
Depends On: 544254
Blocks: Python27Rebuild
  Show dependency treegraph
 
Reported: 2010-08-01 22:55 EDT by Orcan Ogetbil
Modified: 2011-12-30 14:14 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-30 14:14:55 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Orcan Ogetbil 2010-08-01 22:55:56 EDT
This was one of the packages we wanted to rebuild for python-2.7. However had a few problems.

- It wasn't detecting python-2.7. This was fixed by dmalcolm
- It failed compile against gcc-4.5. I fixed this
- It failed during linking. I fixed this by adding the necessary flags to the 
  linker when building an object.

Now the build fails at tests:

2010-08-02T02:41:09 SCRIPT_ERROR Traceback (most recent call last):
2010-08-02T02:41:09 SCRIPT_ERROR   File "<string>", line 1, in <module>
2010-08-02T02:41:09 SCRIPT_ERROR TypeError: function takes exactly 1 argument (0 given)
2010-08-02T02:41:09 SCRIPT_ERROR Traceback (most recent call last):
2010-08-02T02:41:09 SCRIPT_ERROR   File "<string>", line 1, in <module>
2010-08-02T02:41:09 SCRIPT_ERROR TypeError: integer argument expected, got float
Py_WorldTimetest: Py_WorldTimetest.cpp:33: int main(): Assertion `PyRun_SimpleStringFlags("WorldTime(23.1)", __null) == 0' failed.
/bin/sh: line 5: 19414 Aborted                 (core dumped) ${dir}$tst
FAIL: Py_WorldTimetest

...

=========================================
1 of 108 tests failed
Please report to alriddoch@googlemail.com
=========================================
make[2]: Leaving directory `/builddir/build/BUILD/cyphesis-0.5.21/tests'
make[2]: *** [check-TESTS] Error 1
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/builddir/build/BUILD/cyphesis-0.5.21/tests'
make: *** [check-recursive] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.PPZe97 (%check)



I worked a lot on this but I give up for now. The other fixes are committed to the rawhide branch. I'm hoping someone will pick this up from here. Here is the latest rawhide build that failed:
   http://koji.fedoraproject.org/koji/buildinfo?buildID=187662
Comment 1 Dave Malcolm 2010-08-02 09:14:03 EDT
Code in question is cyphesis-0.5.21/tests/Py_WorldTimetest.cpp:33
  assert(PyRun_SimpleString("WorldTime(23.1)") == 0);
The python code is raising an exception:

2010-08-02T09:06:12 SCRIPT_ERROR Traceback (most recent call last):
2010-08-02T09:06:12 SCRIPT_ERROR   File "<string>", line 1, in <module>
2010-08-02T09:06:12 SCRIPT_ERROR TypeError: integer argument expected, got float

and this leads to PyRun_SimpleString returning -1 (signifying an error), rather than 0, hence the C++-level assertion fails, and dumps core.

The Python exception is coming from the WorldTime tp_init callback in cyphesis-0.5.21/rulesets/Py_WorldTime.cpp:
static int WorldTime_init(PyWorldTime * self, PyObject * args, PyObject * kwds)
B {
      int seconds;

      if (!PyArg_ParseTuple(args, "i", &seconds)) {
  =>      return -1;
      }

which is clearly requiring an int, not a float.

Did this code ever pass?
Comment 2 Dave Malcolm 2010-08-02 09:14:49 EDT
BTW, there are _lots_ of Python exceptions in the selftest logs, not just this one.
Comment 3 Dave Malcolm 2010-08-02 09:30:25 EDT
The specific exception in comment #1 appears to be this Python 2.7 change:  
  http://bugs.python.org/issue5080
i.e. the deprecation warning when passing floats became a TypeError.

Simplest fix appears to be to change:
 assert(PyRun_SimpleString("WorldTime(23.1)") == 0);
to 
 assert(PyRun_SimpleString("WorldTime(23.1)") == -1);

but I don't know to what extent cyphesis relies on this behavior.

Alternatively, if floating point with rounding is acceptable in the cyphesis Python API, then WorldTime_init should be changed.

This seems like a question for upstream; maintainer: can you contact upstream and discuss it with them please?
Comment 4 Dave Malcolm 2010-08-02 09:36:40 EDT
Relevant code is in:
http://svn.python.org/view/python/trunk/Python/getargs.c; previously it would issue a deprecation warning on floats, then call:
  PyInt_AsLong(arg);
which for a PyFloat calls float_as_number's nb_int routine, which is float_trunc, which truncates the fractional part to give the whole part as a C int.

In Python 2.7, this now raises a TypeError before attempting the conversion.
Comment 5 Wart 2010-08-03 12:56:54 EDT
I'm forwarding this ticket to the upstream developers for guidance and/or a fix.
Comment 6 Orcan Ogetbil 2010-08-03 14:53:02 EDT
Sure, please also forward the 3 patches we committed.
Comment 7 Orcan Ogetbil 2010-08-11 13:15:09 EDT
Any updates on this? Is there a link to the upstream bug tracker where you filed the bug?
Comment 8 Orcan Ogetbil 2010-08-30 13:39:49 EDT
Wart, could you let us know what is the status of this package?
Comment 9 Dave Malcolm 2010-08-30 13:59:01 EDT
IIRC, it should be fairly easy to patch this so it builds, but it would be best to have the upstream cyphesis developers decide whether or not WorldTime() should be able to accept a float and silently truncate it to int.

If that's acceptable, then WorldTime_init needs a patch (which should be relatively simple to do).

One of the motivations for the change to Python 2.7 was this issue:
  http://bugs.python.org/issue5080#msg92400
where float->int truncation of a timing value led to infinite loops.

But it looks like WorldTime() has always truncated to int, so this probably wouldn't introduce new bugs.
Comment 10 Dave Malcolm 2010-09-16 11:24:17 EDT
Looks like Spot disabled the selftests:

The %changelog in cyphesis.spec in master and f14 has:

* Tue Sep 14 2010 Tom "spot" Callaway <tcallawa@redhat.com> - 0.5.24-1
- update to 0.5.24
- fix a few more compiler issues
- disabled tests, maintainer should fix

http://pkgs.fedoraproject.org/gitweb/?p=cyphesis.git;a=commitdiff;h=9225774be7a885a4ac2f2546eed4a3a64db5c1d5
Comment 11 Orcan Ogetbil 2010-10-13 18:00:39 EDT
What is the status of this? As far as I can tell, this is the only package that is not been properly ported to python-2.7. 

Wart?
Comment 12 Bruno Wolff III 2011-05-07 13:53:10 EDT
I worry about this when I do the update to 0.5.26 (bug 544254). But there are some dependencies that need to get updated first.
Comment 13 Bruno Wolff III 2011-07-10 13:01:58 EDT
It builds for F15. Also it for F16 and F15 testing all of the world forge libraries have been rebuilt so there shouldn't be interface mismatches.

I am not sure how to tell if detecting python2.7 is still a problem though.
Comment 14 Bruno Wolff III 2011-12-30 14:14:55 EST
Since it is building in F15+ and F14 is EOL I am going to close this.

Note You need to log in before you can comment on or make changes to this bug.