Hide Forgot
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:
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
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.
(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.
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.
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.
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.
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.
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.
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