Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1199147

Summary: [engine-log-collector] make --local-tmp work as mktemp's 'tmpdir'
Product: [oVirt] ovirt-log-collector Reporter: Jiri Belka <jbelka>
Component: GeneralAssignee: Lev Veyde <lveyde>
Status: CLOSED WONTFIX QA Contact: Gonza <grafuls>
Severity: low Docs Contact:
Priority: low    
Version: 3.5.0CC: amureini, bugs, didi, ecohen, gklein, jbelka, lsurette, lveyde, rbalakri, Rhev-m-bugs, rmartins, sbonazzo, stirabos, yeylon, ylavi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: integration
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-19 15:36:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
ovirt-log-collector-20150305151518.log none

Description Jiri Belka 2015-03-05 14:23:26 UTC
Created attachment 998388 [details]
ovirt-log-collector-20150305151518.log

Description of problem:

current --local-tmp functionality is dump, it will always remove the directory! wow! i suppose most people would think --local-tmp works as mktemp's tmpdir option, specifying parent dir where temporary dir is created.
if they do this assumption then they can end with deleted /root or whatever :D

so make it behave clever, --local-tmp should be parent of temporary garbage files/dirs.

-bash-4.1# engine-log-collector --local-tmp=/root --no-postgresql --no-hypervisors
This command will collect system configuration and diagnostic
information from this system.
The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before
being passed to any third party.
No changes will be made to system configuration.
INFO: Gathering oVirt Engine information...
INFO: Skipping postgresql collection...
INFO: Skipping hypervisor collection...
Creating compressed archive...
INFO: Log files have been collected and placed in /tmp/sosreport-LogCollector-20150305151612.tar.xz.
The MD5 for this file is b6557e1174962d225f9df1d00d9915c8 and its size is 273.7M
-bash-4.1# ls -ld /root
ls: cannot access /root: No such file or directory

-bash-4.1# cd /
-bash-4.1# ls -ld /root*
drwxr-xr-x. 8 root root 4096 Mar  5 14:12 /root.bkp

Version-Release number of selected component (if applicable):
rhevm-log-collector-3.5.1-1.el6ev.noarch

How reproducible:
100%

Steps to Reproduce:
1. engine-log-collector --local-tmp=/root --no-postgresql --no-hypervisors (AND HAVE FUN LATER!)
2.
3.

Actual results:
--local-tmp option is dump and insecure and confusing (somehow)

Expected results:
--local-tmp should be a "parent" destination for temporary files/dirs

Additional info:
well well, nitpicking... i would expect final sos* file would be (if this BZ is accepted) found under --local-tmp and not always in /tmp (even if sos* file has 600)

Comment 1 Lev Veyde 2015-10-13 14:56:23 UTC
I think that it's already fixed in the latest version (Note commit 18f9aac522e1f6e43015c6869d3360f9c38b16b7 by Sandro Bonazzola).

Comment 3 Jiri Belka 2015-10-14 14:11:59 UTC
please provide at lest rpm filename, we don't build anything from git.

also engine-log-collector is liar...

# engine-log-collector --help | sed -n '/local-tmp=/,/logcollector-/p'
  --local-tmp=PATH      directory to copy reports to locally. Please note that
                        the local-tmp directory is used only for storing
                        temporary reports gathered from hypervisors.(default
                        is randomly generated like: /tmp/logcollector-UCy6Kh)

see 'user only', that's not true :) check with '--no-hypervisors' and you will see files appearing in tmp dir.

Comment 5 Gonza 2015-10-29 08:17:02 UTC
Tried with:
rhevm-log-collector-3.6.0-1.el6ev.noarch

local-tmp parent is still been removed.

Comment 6 Red Hat Bugzilla Rules Engine 2015-11-30 22:45:23 UTC
Bug tickets must have version flags set prior to targeting them to a release. Please ask maintainer to set the correct version flags and only then set the target milestone.

Comment 7 Yedidyah Bar David 2016-01-19 13:09:59 UTC
Please note that this bug was already discussed in the past and rejected:

https://bugzilla.redhat.com/show_bug.cgi?id=977863#c4

Perhaps instead of existing bug/change, we can just make sure that if the supplied local tmp exists, that it's empty.

Comment 8 Yaniv Lavi 2016-01-19 15:38:03 UTC
We are going to fix the deletion of tmp dir at the end of collection. This should close the gap and I see no reason to do this. Closing.

Comment 9 Yedidyah Bar David 2016-01-19 16:03:08 UTC
(In reply to Yaniv Dary from comment #8)
> We are going to fix the deletion of tmp dir at the end of collection.

Is there a different bug for that?

> This
> should close the gap and I see no reason to do this. Closing.

Comment 10 Yaniv Lavi 2016-01-19 16:46:59 UTC
(In reply to Yedidyah Bar David from comment #9)
> (In reply to Yaniv Dary from comment #8)
> > We are going to fix the deletion of tmp dir at the end of collection.
> 
> Is there a different bug for that?

BZ #1288197

> 
> > This
> > should close the gap and I see no reason to do this. Closing.