Bug 723280

Summary: $TMPDIR not honored for .yumtx
Product: [Fedora] Fedora Reporter: John Reiser <jreiser>
Component: yumAssignee: Seth Vidal <skvidal>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: ffesti, james.antill, jzeleny, maxamillion, pmatilai, tla, vmukhame
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-28 12:24:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description John Reiser 2011-07-19 15:16:29 UTC
Description of problem: yum (from lorax, from pungi) does not honor the TMPDIR environment variable when creating temporary files such as /tmp/yum_save_tx-2011-07-19-06-50Z1WZBn.yumtx


Version-Release number of selected component (if applicable):
yum-3.4.3-4.fc16.noarch


How reproducible: every time


Steps to Reproduce:
1. export TMPDIR=/dev/shm
2. /usr/bin/pungi -c rawhide-fedora.ks \
        --destdir=$DESTDIR --name Fedora --ver $VERSION --nosource
3.
  
Actual results: Temporary file such as yum_save_tx-2011-07-19-06-50Z1WZBn.yumtx is created always in /tmp.


Expected results: Temorary files are created in $TMPDIR if TMPDIR is in the environment.


Additional info:

Comment 1 James Antill 2011-07-19 18:37:38 UTC
 We just use the python "tempfile" module, I can create some wrappers though.

 Do you also want the ability to not save the file at all?

Comment 2 John Reiser 2011-07-19 19:24:21 UTC
It would be nice if the .yumtx file were preserved by debug mode, but removed if not debug mode.

Comment 3 James Antill 2011-07-19 22:32:59 UTC
 So looking at the tempfile module code, this should follow TMPDIR now (along with TMP and TEMP). And testing yum it does work. Are you sure pungi isn't doing something interesting?

> It would be nice if the .yumtx file were preserved by debug mode, but removed
> if not debug mode.

Well, for the yum command line, we now show it to the user user whenever yum doesn't run the transaction (in F15 we only show it on rpm transaction check failures). When the transaction runs, we should already be deleting it too.

Comment 4 John Reiser 2011-07-19 23:46:57 UTC
The current source for lorax (0.8-1 or git HEAD) contains neither TMPDIR nor TMP; 'TEMP' appears only in one comment.
The current pungi-2.8-1.fc16.noarch/src/... contains none of TMPDIR, TMP, TEMP.
The current pungi-2.8-1.fc16.noarch/Changelog says:
-----
   [no mention of TMPDIR above next line]
Date:   Mon Dec 3 14:52:47 2007 -0500

    Disable TMPDIR use in buildinstall.  Still broken :/

Date:   Tue Nov 27 14:40:36 2007 -0500

    Enable TMPDIR again so that anconda-runtime working files go to the working dir.
   [snip older comments]
-----

So it seems to me that neither pungi nor lorax messes with TMPDIR, even though the pungi Changelog from 3.5 years ago claims to disable TMPDIR.

Comment 5 John Reiser 2011-07-20 01:46:40 UTC
Further searching yields:
     ./src/pypungi/util.py:def _doRunCommand(command, logger, rundir='/tmp', output=subprocess.PIPE, error=subprocess.PIPE, env=None):
so pungi clears the entire environment by default when calling _doRunCommand.  However the invocations of _doRunCommand are limited:
-----
./src/pypungi/__init__.py:        #pypungi.util._doRunCommand(compsfilter, self.logger)
./src/pypungi/__init__.py:            pypungi.util._doRunCommand(repoview, self.logger)
./src/pypungi/__init__.py:        pypungi.util._doRunCommand(mkisofs + extraargs, self.logger)
./src/pypungi/__init__.py:            pypungi.util._doRunCommand(['/usr/bin/implantisomd5', isofile], self.logger)
./src/pypungi/util.py:def _doRunCommand(command, logger, rundir='/tmp', output=subprocess.PIPE, error=subprocess.PIPE, env=None):
-----
which excludes lorax and yum; and anyway, neither lorax nor yum are run as a separate process from pungi.

Comment 6 James Antill 2011-07-21 19:53:01 UTC
 So looking at this some more it just gets more confusing.
 Lorax itself calls:

    tempdir = tempfile.mkdtemp(prefix="lorax.", dir=tempfile.gettempdir())

...which should get setting the default tempdir. for all future tempfile.* calls ... and I assume that call is obeying TMPDIR?

 Can you print tempfile.gettemptdir() at various points in pungi/lorax to stop when it's correct/wrong?

Comment 7 Fedora End Of Life 2013-04-03 17:36:34 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 8 Valentina Mukhamedzhanova 2014-05-28 12:24:48 UTC
Closing as there is no reply.

Comment 9 John Reiser 2014-06-24 02:35:39 UTC
I am sorry but $DAYJOB prevents my work on this problem.
[The NeedInfo Nag requested a response.]