RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1039822 - powertop: --csv cannot specify filename
Summary: powertop: --csv cannot specify filename
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: powertop
Version: 7.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jaroslav Škarvada
QA Contact: Jiří Vohánka
Robert Krátký
URL:
Whiteboard:
Depends On:
Blocks: 1191019 1205796
TreeView+ depends on / blocked
 
Reported: 2013-12-10 05:27 UTC by Jimmy Pan
Modified: 2016-02-01 02:20 UTC (History)
6 users (show)

Fixed In Version: powertop-2.3-9.el7
Doc Type: Bug Fix
Doc Text:
PowerTOP now respects user-defined report file names Previously, PowerTOP report file names were generated in an unclear, undocumented way. With this update, the implementation has been improved, and the generated file names now respect the names requested by the user. This applies to both CSV and HTML reports.
Clone Of:
Environment:
Last Closed: 2015-11-19 08:00:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed fix (2.54 KB, patch)
2015-05-12 17:53 UTC, Jaroslav Škarvada
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2225 0 normal SHIPPED_LIVE powertop bug fix and enhancement update 2015-11-19 08:38:17 UTC

Description Jimmy Pan 2013-12-10 05:27:23 UTC
Description of problem:
powertop --csv=filename fails to output to filename

Version-Release number of selected component (if applicable):
2.3-5.el7

How reproducible:
always

Steps to Reproduce:
1.powertop --csv=filename
2.
3.

Actual results:
output directed to powertop.csv not filename

Expected results:
output directed to filename

Additional info:

Comment 2 Jaroslav Škarvada 2013-12-10 10:43:51 UTC
I am unable to reproduce the problem:

# rpm -q powertop
powertop-2.3-5.el7.x86_64

# powertop --csv=filename
Loaded 0 prior measurements
Preparing to take measurements
Taking 1 measurement(s) for a duration of 20 second(s) each.
PowerTOP outputing using base filename filename.csv

# ls
filename.csv

Comment 3 Jimmy Pan 2013-12-10 10:57:58 UTC
What I got was:
# powertop --time=1 --csv=powertop.output
Loaded 0 prior measurements
Preparing to take measurements
Taking 1 measurement(s) for a duration of 1 second(s) each.
PowerTOP outputing using base filename powertop.csv

it seems powertop would parse file.* into file.csv, so this contradicted with my understanding from the manual, I thought the output file should be file.* instead of file.csv.

Comment 4 Jimmy Pan 2013-12-10 10:59:40 UTC
(In reply to Jimmy Pan from comment #3)
> What I got was:
> # powertop --time=1 --csv=powertop.output
> Loaded 0 prior measurements
> Preparing to take measurements
> Taking 1 measurement(s) for a duration of 1 second(s) each.
> PowerTOP outputing using base filename powertop.csv
> 
> it seems powertop would parse file.* into file.csv, so this contradicted
> with my understanding from the manual, I thought the output file should be
> file.* instead of file.csv.

BTW, if you use --html=file.*, the output file would be file.* from what I have tried.

Comment 5 Jaroslav Škarvada 2013-12-11 09:40:46 UTC
I am probably going to update the docs. The current state is not perfect, but it works good for general use cases. The current algorithm tries to get the basename and then adds the default suffix. If running in iteration mode it outputs multiple reports, each in format: basename-timestamp.suffix. In such case it wouldn't be good for e.g. HTML to have basename-timestamp without the suffix. Adding another switch or template string to support the suffix specification seems to me as over-engineering this feature. Well, this could all be designed better way, but I think such discussion should go upstream.

Comment 6 Ludek Smid 2014-06-26 10:50:12 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Comment 7 Ludek Smid 2014-06-26 11:16:05 UTC
The comment above is incorrect. The correct version is bellow.
I'm sorry for any inconvenience.
---------------------------------------------------------------

This request was NOT resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you need
to escalate this bug.

Comment 10 Jaroslav Škarvada 2015-05-12 17:53:01 UTC
Created attachment 1024712 [details]
Proposed fix

I rewrote the functionality and propose the patch upstream. With the patch applied I think it behaves more logically:

powertop --html
generates 'powertop.html' file

powertop --html=myfile.suffix
generates 'myfile.suffix' file

powertop -i 2 --html
generates 'powertop-TIMESTAMPS.html' files

powertop -i 2 --html=myfile.suffix
generates 'myfile-TIMESTAMPS.suffix' files

powertop -i 2 --html=myfile
generates 'myfile-TIMESTAMPS' files

Similarly for CSV.

Comment 18 Jiří Vohánka 2015-09-16 16:33:31 UTC
Testing procedure:

echo "# version"
rpm -q powertop
echo

for output in --html --html=test --html=test.ext --csv --csv=test --csv=test.ext; do
    for iteration in '' '--iteration=2'; do
        mkdir -p /tmp/powertop${output}${iteration}; cd /tmp/powertop${output}${iteration}
        echo "# powertop $output $iteration --time=1"
        powertop powertop $output $iteration --time=1 >/dev/null 2>/dev/null
        ls
        echo
    done
done

Broken:

# version
powertop-2.3-5.el7.x86_64

# powertop --html  --time=1
powertop.html

# powertop --html --iteration=2 --time=1
powertop-20150916-120554.html
powertop-20150916-120556.html

# powertop --html=test  --time=1
test.html

# powertop --html=test --iteration=2 --time=1
test-20150916-120601.html
test-20150916-120602.html

# powertop --html=test.ext  --time=1
test.html

# powertop --html=test.ext --iteration=2 --time=1
test-20150916-120607.html
test-20150916-120609.html

# powertop --csv  --time=1
powertop.csv

# powertop --csv --iteration=2 --time=1
powertop-20150916-120614.csv
powertop-20150916-120615.csv

# powertop --csv=test  --time=1
test.csv

# powertop --csv=test --iteration=2 --time=1
test-20150916-120620.csv
test-20150916-120622.csv

# powertop --csv=test.ext  --time=1
test.csv

# powertop --csv=test.ext --iteration=2 --time=1
test-20150916-120627.csv
test-20150916-120628.csv

Fixed:

# version
powertop-2.3-9.el7.x86_64

# powertop --html  --time=1
powertop.html

# powertop --html --iteration=2 --time=1
powertop-20150916-120332.html
powertop-20150916-120333.html

# powertop --html=test  --time=1
test

# powertop --html=test --iteration=2 --time=1
test-20150916-120338
test-20150916-120340

# powertop --html=test.ext  --time=1
test.ext

# powertop --html=test.ext --iteration=2 --time=1
test-20150916-120345.ext
test-20150916-120346.ext

# powertop --csv  --time=1
powertop.csv

# powertop --csv --iteration=2 --time=1
powertop-20150916-120351.csv
powertop-20150916-120353.csv

# powertop --csv=test  --time=1
test

# powertop --csv=test --iteration=2 --time=1
test-20150916-120358
test-20150916-120359

# powertop --csv=test.ext  --time=1
test.ext

# powertop --csv=test.ext --iteration=2 --time=1
test-20150916-120404.ext
test-20150916-120406.ext

The --csv and --html options now behave as described in Comment 10.

Comment 20 errata-xmlrpc 2015-11-19 08:00:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2225.html


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