Bug 76602

Summary: non-portable use of mktemp in ltmain.sh.in
Product: [Retired] Red Hat Linux Reporter: Oron Peled <oron>
Component: libtoolAssignee: Jens Petersen <petersen>
Status: CLOSED CURRENTRELEASE QA Contact: Jay Turner <jturner>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: oron, srevivo
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-05-01 14:34:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Oron Peled 2002-10-23 23:47:30 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020408

Description of problem:
The SRPM contains a patch file 'libtool-1.3.5-mktemp.patch' (Patch1)
This patch introduce the use of mktemp into the ltmain.sh.in file
However, mktemp is not portable and the ltmain.sh file is distributed with
ANY software package that is built with libtool.

As an example, when I built a small dynamic lib using libtool/automake/autoconf.
The build was perfect on linux (including make install and make distcheck),
but when the tarball was moved to HPUX the 'make install' step failed because
libtool --mode=installed tried to create a temporary directory using 'mktemp'.

Also the failure of mktemp(1) in the patched ltmain.sh isn't handled correctly. What
happens is after the status is checked (by then 'tmpdir' is already empty), the code
assigns:
        tmpdir="$tmpdir/libtool-$$"
which simply causes 'tmpdir' to get the value: '/libtool-...'
Obviously, non-root user will fail to create tmpdir under '/'



Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Choose any package that build libraries via libtool
2. Run on linux: ./configure --prefix=/some_path; make; make distcheck
3. Extract the tarball on HPUX
4. Rerun: ./configure --prefix=/some_other_path; make; make install



Actual Results:  The 'make install' would fail when running 'libtool
--mode=install ....'
This happens because:
    1. mktemp fails
    2. The test of mktemp status leads to flawed assignment to 'tmpdir'
    3.  mkdir fails bacause it (non-root user) tries to create a temp directory
on '/libtool-....'

Expected Results:  Perfect build on any platform supported by libtool.



Additional info:

HPUX does have mktemp but with different syntax. I checked both with HPUX
versions 10.20 and 11.00. I also verified that mktemp(1) does not appear in
the Single Unix Specification (version 2), so it's probably missing or mutilated
in some other Unices as well (and even more on other platforms libtool supports).

1. mktemp should not be used in portable code like 'ltmain.sh'
2. Even if it is used, the code should handle correctly its failure.

Comment 1 Oron Peled 2003-01-10 22:30:22 UTC
This bug remained in RedHat-8.0, it would be pitty to see
it persisting in 8.1

Comment 2 Jens Petersen 2003-01-14 04:08:02 UTC
Should be fixed in libtool-1.4.3-3.  Please confirm.