+++ 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.
Created attachment 311404 [details] Proposed patch Create a new variable named TEMP='/tmp' and replace occurrences of $HOME with $TEMP.
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.
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.
(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).
Created attachment 320620 [details] Updated patch Uses `mktemp -d` to create the $TEMP directory.
Created attachment 320623 [details] Corrected updated patch You'd think after all these years, I'd know the difference between '\' and '/'. :^)
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.
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.
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