By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.
Bug 2215 - libr0 bug causes FTBFS when build is in different filesystem than /tmp
Summary: libr0 bug causes FTBFS when build is in different filesystem than /tmp
Status: RESOLVED FIXED
Alias: None
Product: TDE
Classification: Unclassified
Component: non-core programs (show other bugs)
Version: R14.0.0 [Trinity]
Hardware: i386 Debian Wheezy
: P5 normal
Assignee: Timothy Pearson
URL:
Depends on:
Blocks:
 
Reported: 2014-11-27 01:26 CST by mgb-trinity
Modified: 2015-01-08 19:52 CST (History)
2 users (show)

See Also:
Compiler Version:
TDE Version String:
Application Version:
Application Name:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mgb-trinity 2014-11-27 01:26:23 CST
A bug in libr0 causes FTBFS when the build occurs in a different filesystem than the filesystem containing /tmp.  libr0 is supposed to be able to handle this case but the function to handle this case - safe_rename - has a bug which causes it to always fail.

safe_rename is defined in libr-bfd.c.  The buggy code in safe_rename is:

        fclose(in);
        fclose(out);
        if(ferror(in))
 
After fclose(in) any further access to 'in' results in undefined behavior.  What I am seeing in tests is that the ferror(in) here is always true.  ferror needs to be checked before fclose.

There are several other obvious bugs in this function but they don't cause FTBFS - they just make it fragile.  For example not checking the result of fread, not checking ferror(out) in the loop and not checking ferror(out) before fclose.

Also the middle two arguments of the fwrite call are weird.  TTBOMK they work as written but they look odd and should be swapped to match the fread.

In a TDE build this causes FTBFS errors when running tdelfeditor such as:

opening executable file /cache/wip/T/tdevelop-trinity-14.0.0-r372/obj-i486-linux-gnu/lib/widgets/propeditor/libkdevpropertyeditor.so...
failed to rename output file: Invalid cross-device link
Comment 1 Timothy Pearson 2014-11-27 01:53:27 CST
Yep, I've seen this before but never had time/motivation to track it down to its origin.  Thanks for doing that!
Comment 2 Timothy Pearson 2015-01-08 19:52:02 CST
This should be fixed in GIT hash 7690d56.

Thanks for tracking down the problem!