This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1295963 - Do not mute warnings in getopt(1)
Do not mute warnings in getopt(1)
Status: NEW
Product: Fedora
Classification: Fedora
Component: beakerlib (Show other bugs)
27
Unspecified Unspecified
low Severity unspecified
: ---
: ---
Assigned To: Dalibor Pospíšil
Fedora Extras Quality Assurance
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-05 17:45 EST by Alois Mahdal
Modified: 2017-08-15 02:59 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
suggested patch (1.79 KB, patch)
2016-01-05 17:54 EST, Alois Mahdal
no flags Details | Diff

  None (edit)
Description Alois Mahdal 2016-01-05 17:45:39 EST
Description of problem
======================

Someone thought it would be a good idea to mute warnings from getopt in
some parts of beakerlib: rlMount, rlHash, rlFileSubmit and rlRun.

It makes debugging of strange problems even stranger, so it is not so
good idea.


Version-Release number of selected component
============================================

beakerlib-1.10-2.el6eso


How reproducible
================

Always


Steps to Reproduce
==================

 1. Call one of mentioned functions with an unsupported option, e.g.:

        rlFileSubmit /etc/postfix/main.cf -etc-postfix-main.cf

 2. Run the test

 3. Observe the log

 4. Scratch your head

 5. Understand what's wrong or repeat steps 2-4 until your head skin hurts


Actual results
==============

Your head skin hurts.


Expected results
================

Your head skin should not hurt.  You should be able to understand that
what you called there is an unsupported option.


Additional info
===============

The mentioned example is equivalent to something like:

    rlFileSubmit -e -t -c -- -p - o -s tfix-main.cf /etc/postfix/main.cf

which is not what you wanted.

(In this case, the code further falls flat on its face anyway due to
bug 1295962 but that's another story.)

Note that what gets called in rlFileSubmit is:

    $ getopt -q -o s: -- /etc/postfix/main.cf -etc-postfix-main.cf
     -s 'tfix-main.cf' -- '/foo/bar'
    $

Compare:

    $ getopt -o s: -- /etc/postfix/main.cf -etc-postfix-main.cf
    getopt: invalid option -- 'e'
    getopt: invalid option -- 't'
    getopt: invalid option -- 'c'
    getopt: invalid option -- '-'
    getopt: invalid option -- 'p'
    getopt: invalid option -- 'o'
     -s 'tfix-main.cf' -- '/foo/bar'
    $
Comment 1 Alois Mahdal 2016-01-05 17:54 EST
Created attachment 1111964 [details]
suggested patch
Comment 2 Jakub Prokes 2016-01-12 12:06:15 EST
I don't think it is good idea add some unexpected output of command. May be it may make sense with DEBUG flag enabled or so. In other way it is just change behavior which may break compatibility.
Comment 3 Dalibor Pospíšil 2016-01-12 12:18:19 EST
I agree that unexpected output can break things on the other hand we should report that an error happened. For this reason we have rlLogError function.

I would rather handle this situation internally with error message logged and proper (documented) return code. Would this solution be acceptable for you?
Comment 4 Alois Mahdal 2016-01-12 13:00:56 EST
stderr is made for errors so I don't see why anything sould break by using it for its intended usage.  Printing errors in obviously errorneous state is nothing "unexpected";  it's hiding them that is unexpected.

Adding rlLogError and returning properly is not a bad idea but I guess there's ton of things in beakerlib that need such changes so it seems like a longer task.  IMO this is nasty bug so I'd vote for just disabling the `-q` as hotfix (which I guess you will do anyway.)

Hopefully I answered your question.
Comment 5 Dalibor Pospíšil 2016-01-13 05:05:14 EST
Yes solution would include removing '-q' but I think it would be good to handle it better that just let it go to stderr without any header or tag.
Comment 8 Ales Zelinka 2016-01-19 14:38:05 EST
+1 to providing some feedback that an unsupported option has been used
-1 to usign rlLog* functions - those are IMO for the user to log & report stuff, not for internal beakerlib usage.

I vote for a simple stderr message & a non-zero return code
Comment 9 Martin Kyral 2016-01-20 04:07:07 EST
(In reply to Ales Zelinka from comment #8)
> +1 to providing some feedback that an unsupported option has been used
> -1 to usign rlLog* functions - those are IMO for the user to log & report
> stuff, not for internal beakerlib usage.
> 
> I vote for a simple stderr message & a non-zero return code

I agree.
Comment 11 Fedora End Of Life 2016-11-24 09:43:56 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 12 Alois Mahdal 2016-11-24 18:00:27 EST
still present in f24
Comment 13 Fedora End Of Life 2017-07-25 15:43:38 EDT
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Comment 14 Jan Kurik 2017-08-15 02:59:50 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

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