Bug 454690 - sysreport.legacy reports "Cannot make temp dir"
sysreport.legacy reports "Cannot make temp dir"
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: sos (Show other bugs)
4.6
All Linux
medium Severity medium
: rc
: ---
Assigned To: Adam Stokes
:
Depends On:
Blocks: 391511 RHEL4u8_relnotes 467444
  Show dependency treegraph
 
Reported: 2008-07-09 15:03 EDT by Bryan Mason
Modified: 2010-10-22 22:43 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
* sysreport.legacy used $HOME as its root directory. In case this environment variable did not exist or the directory it referred to was not writable, sysreport.legacy could not generate its report and would exit with the message "Cannot make temp dir". Sysreport.legacy now uses a randomly created directory as its root directory and therefore can generate a report even on a system without a usable $HOME.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-05-18 16:24:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Proposed patch (1.09 KB, patch)
2008-07-09 15:04 EDT, Bryan Mason
no flags Details | Diff
Updated patch (1.10 KB, patch)
2008-10-16 19:11 EDT, Bryan Mason
no flags Details | Diff
Corrected updated patch (1.10 KB, patch)
2008-10-16 20:43 EDT, Bryan Mason
no flags Details | Diff

  None (edit)
Description Bryan Mason 2008-07-09 15:03:55 EDT
+++ This bug was initially created as a clone of Bug #445947 +++

Description of problem:

    Because sysreport.legacy uses $HOME as it's root directory, problems
    can occur if $HOME doesn't exist or isn't writable.

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

    sos-1.7-9.2.el5.noarch

How reproducible:

    Every time, if the home directory doesn't exist.

Steps to Reproduce:

    1. Log into a system using an account that has no local home directory.
    2. Run sysreport.legacy as root using sudo.
  
Actual results:

    $ sudo /usr/sbin/sysreport.legacy
    Password:
    Cannot make temp dir

Expected results:

    Sysreport generated.

Additional info:

    This is actually the same problem reported in Bug 355071, but that report
    was for sysreport and this is reported against sysreport.legacy.
Comment 1 Bryan Mason 2008-07-09 15:04:48 EDT
Created attachment 311404 [details]
Proposed patch

Create a new variable named TEMP='/tmp' and replace occurrences of $HOME with
$TEMP.
Comment 2 RHEL Product and Program Management 2008-09-05 13:23:21 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 3 Josh Bressers 2008-09-30 12:51:51 EDT
That patch looks dangerous.  I'd suggest you simply something like
TEMP=`mktemp -d`

Then just remove $TEMP at the end of the run.

As it stands, the patch will likely introduce a security flaw.
Comment 8 Bryan Mason 2008-10-16 19:07:54 EDT
(In reply to comment #3)
> That patch looks dangerous.  I'd suggest you simply something like
> TEMP=`mktemp -d`
> 
> Then just remove $TEMP at the end of the run.

But we can't remove $TEMP at the end of the run because the output file is located in $TEMP/${NAME}.${SUFFIX} (used to be $HOME/${NAME}.${SUFFIX} before we started using a temp dir instead of /root to hold the sysreport files).
Comment 9 Bryan Mason 2008-10-16 19:11:06 EDT
Created attachment 320620 [details]
Updated patch

Uses `mktemp -d` to create the $TEMP directory.
Comment 10 Bryan Mason 2008-10-16 20:43:43 EDT
Created attachment 320623 [details]
Corrected updated patch

You'd think after all these years, I'd know the difference between '\' and '/'. :^)
Comment 14 Ruediger Landmann 2009-01-29 01:23:43 EST
Release note added. If any revisions are required, please set the 
"requires_release_notes" flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

New Contents:
* sysreport.legacy used $HOME as its root directory. On systems that did not have a local home directory, sysreport.legacy could not generate its report and would exit with the message "Cannot make temp dir". Sysreport.legacy now uses /bin as its root directory and therefore can generate a report even on a system without a local home directory.
Comment 15 Radek Bíba 2009-01-29 04:01:39 EST
Release note updated. If any revisions are required, please set the 
"requires_release_notes"  flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

Diffed Contents:
@@ -1 +1 @@
-* sysreport.legacy used $HOME as its root directory. On systems that did not have a local home directory, sysreport.legacy could not generate its report and would exit with the message "Cannot make temp dir". Sysreport.legacy now uses /bin as its root directory and therefore can generate a report even on a system without a local home directory.+* sysreport.legacy used $HOME as its root directory. In case this environment variable did not exist or the directory it referred to was not writable, sysreport.legacy could not generate its report and would exit with the message "Cannot make temp dir". Sysreport.legacy now uses a randomly created directory as its root directory and therefore can generate a report even on a system without a usable $HOME.
Comment 21 errata-xmlrpc 2009-05-18 16:24:13 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0994.html

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