Bug 871756 - Support for uclibc builds
Summary: Support for uclibc builds
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: i386
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Eric Blake
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-31 10:31 UTC by Leonardo Arena
Modified: 2012-11-02 15:28 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-10-31 16:11:36 UTC


Attachments (Terms of Use)
Redefine mkostemp() to mkstemp() if uclibc is used (329 bytes, patch)
2012-10-31 10:31 UTC, Leonardo Arena
no flags Details | Diff

Description Leonardo Arena 2012-10-31 10:31:46 UTC
Created attachment 636010 [details]
Redefine mkostemp() to mkstemp() if uclibc is used

Description of problem:
In latest versions of libvirt mkostemp() GNU function is used. This function does not exist in uclibc and therefore the build fails on Alpine Linux, an uclibc-based distribution.

Version-Release number of selected component (if applicable):
1.0.0-rc[2,3]


How reproducible:
Try building the package


Steps to Reproduce:
1. ./configure
2. make
3. make install
  
Actual results:
./.libs/libvirt_util.a(libvirt_util_la-logging.o): In function `virLogOutputToJournald':
logging.c:(.text+0xa2a): undefined reference to `mkostemp'

Expected results:
Be able to build successfully on uclibc

Additional info:
See patch attached

Comment 1 Dave Allan 2012-10-31 11:05:45 UTC
You should mention what you're seeing on libvir list.  There's a thread going on currently about the release of 1.0.0 where your experience would be really helpful (Subject "Availability of Release Candidate 2 for 1.0.0")  I've mentioned this BZ already.

Comment 2 Eric Blake 2012-10-31 14:10:27 UTC
A future revision of POSIX will probably be adding mkostemp() as a required function, since use of mkstemp() in a multi-threaded program that forks children is a recipe for unintentionally leaking the temporary file to a child: http://austingroupbugs.net/view.php?id=411
So I argue that this is a bug in uclibc for missing out on safer interfaces.

That said, gnulib provides mkostemp() for all platforms, so it is also a bug in libvirt for not listing mkostemp in bootstrap.conf.  I'll push the one-liner fix upstream shortly.

Comment 3 Eric Blake 2012-10-31 14:43:13 UTC
Alternative patch proposed:
https://www.redhat.com/archives/libvir-list/2012-October/msg01742.html

Comment 4 Eric Blake 2012-10-31 16:11:36 UTC
Libvirt 1.0.0 will have this:

commit 4dbd6e9654752b3e4971e4cb69f2e09666f6b252
Author: Eric Blake <eblake@redhat.com>
Date:   Wed Oct 31 08:13:47 2012 -0600

    build: prefer mkostemp for multi-thread safety
    
    https://bugzilla.redhat.com/show_bug.cgi?id=871756
    
    Commit cd1e8d1 assumed that systems new enough to have journald
    also have mkostemp; but this is not true for uclibc.
    
    For that matter, use of mkstemp[s] is unsafe in a multi-threaded
    program.  We should prefer mkostemp[s] in the first place.

Comment 5 Leonardo Arena 2012-11-01 15:51:25 UTC
The commit above fixed the issue on uclibc.

Thanks!

Comment 6 Eric Blake 2012-11-02 15:28:07 UTC
And we promptly regressed this for the 1.0.0 release, taking three additional commits to get it back to the correct state: 30b398d, bd0cb27, d055498. Oh well.


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