Bug 620298 - FTBFS - cyphesis doesn't build on F-14/rawhide
Summary: FTBFS - cyphesis doesn't build on F-14/rawhide
Alias: None
Product: Fedora
Classification: Fedora
Component: cyphesis
Version: 14
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bruno Wolff III
QA Contact: Fedora Extras Quality Assurance
Depends On: 544254
Blocks: Python27Rebuild
TreeView+ depends on / blocked
Reported: 2010-08-02 02:55 UTC by Orcan Ogetbil
Modified: 2011-12-30 19:14 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2011-12-30 19:14:55 UTC
Type: ---

Attachments (Terms of Use)

Description Orcan Ogetbil 2010-08-02 02:55:56 UTC
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
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:

Comment 1 Dave Malcolm 2010-08-02 13:14:03 UTC
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 13:14:49 UTC
BTW, there are _lots_ of Python exceptions in the selftest logs, not just this one.

Comment 3 Dave Malcolm 2010-08-02 13:30:25 UTC
The specific exception in comment #1 appears to be this Python 2.7 change:  
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);
 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 13:36:40 UTC
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:
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 16:56:54 UTC
I'm forwarding this ticket to the upstream developers for guidance and/or a fix.

Comment 6 Orcan Ogetbil 2010-08-03 18:53:02 UTC
Sure, please also forward the 3 patches we committed.

Comment 7 Orcan Ogetbil 2010-08-11 17:15:09 UTC
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 17:39:49 UTC
Wart, could you let us know what is the status of this package?

Comment 9 Dave Malcolm 2010-08-30 17:59:01 UTC
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:
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 15:24:17 UTC
Looks like Spot disabled the selftests:

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

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


Comment 11 Orcan Ogetbil 2010-10-13 22:00:39 UTC
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. 


Comment 12 Bruno Wolff III 2011-05-07 17:53:10 UTC
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 17:01:58 UTC
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 19:14:55 UTC
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.