Bug 1295962 - Fragile processing of rlFileSubmit separator (-s sep)
Summary: Fragile processing of rlFileSubmit separator (-s sep)
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: 33
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
Assignee: Dalibor Pospíšil
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-05 22:37 UTC by Alois Mahdal
Modified: 2021-11-30 16:20 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-11-30 16:20:37 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
suggested patch (885 bytes, patch)
2016-01-05 22:55 UTC, Alois Mahdal
no flags Details | Diff

Description Alois Mahdal 2016-01-05 22:37:06 UTC
Description of problem
======================

While debugging a problem, I stumbled over this line (logging.sh:392
in rlFileSubmit):

    ALIAS=$(echo $ALIAS | tr '/' "$SEPARATOR" | sed "s/^${SEPARATOR}*//")

This is wrong and dangerous for several reasons:

 *  *tr* expects second argument to be a valid SET specification but
    there's no guarrantee that $SEPARATOR is.

 *  Even if it was, *tr* would use only the first char (it ignores
    excess chars from SET2 if it's longer than SET1).

 *  Further, it's even used in *sed* as part of regexp, even with a
    `*` operator.

Needless to say, many non-alphanumeric SEPARATORs will not be usable in
any of these commands.  It seems as if the code assumed SEPARATOR to
be single character, but there's no indication in beakerlib(1) that it
should be; also such limitation does not make much sense.


Suggestion
==========

Don't use tr nor sed; use bash's (a bit ugly, but) built-in replacement
syntax:

    ALIAS=${ALIAS#/}                # remove the root slash
    ALIAS=${ALIAS////$SEPARATOR}    # replace remaining slashes with $SEPARATOR

While the replacement syntax is a bit cumbersome (vim's default syntax
HL does support it, though), the resulting code is much safer, supports
any separators and is way faster.

More on the syntax:

    http://wiki.bash-hackers.org/syntax/pe#search_and_replace


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

beakerlib-1.10-2.el6eso


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

Just to remind of rlFileSubmit syntax:

>     rlFileSubmit
>
>       Resolves absolute path to the file, replaces / for - and
>       uploads this renamed file using rhts-submit-log.  It also
>       allows you to specify your custom name for the uploaded file.
>
>           rlFileSubmit [-s sep] path_to_file [required_name]
>
>       -s sep
>           Sets separator (i.e. the replacement of the /) to sep.
>
>       path_to_file
>           Either absolute or relative path to file. Relative path is
>           converted to absolute.
>
>       required_name
>           Default behavior renames file to full_path_to_file with /
>           replaced for -, if this does not suit your needs, you can
>           specify the name using this option.

SEPARATOR in above examples is just the 'sep' value without any
modifications and defaulting to `-`.

Comment 1 Alois Mahdal 2016-01-05 22:55:22 UTC
Created attachment 1111965 [details]
suggested patch

Comment 6 Fedora End Of Life 2016-07-19 20:48:52 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 7 Alois Mahdal 2016-07-19 22:28:17 UTC
Re-assigning to Rawhide; there's nothing new AFAIK.

Comment 8 Jan Kurik 2016-07-26 04:11:29 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 9 Fedora End Of Life 2017-11-16 18:40:20 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. 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 '25'.

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 25 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 10 Fedora End Of Life 2018-05-03 08:45:09 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. 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 '26'.

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 26 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 11 Fedora End Of Life 2018-05-29 11:56:10 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 12 Alois Mahdal 2018-05-30 13:21:52 UTC
Re-assigning to F28; there's nothing new AFAIK.

Comment 13 Alois Mahdal 2020-02-17 12:30:40 UTC
Still not fixed...

Comment 14 Ben Cotton 2020-04-30 20:25:26 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
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 '30'.

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 30 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 15 Ben Cotton 2020-08-11 15:34:27 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle.
Changing version to 33.

Comment 16 Ben Cotton 2021-11-04 17:35:07 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
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 '33'.

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 33 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 17 Ben Cotton 2021-11-30 16:20:37 UTC
Fedora 33 changed to end-of-life (EOL) status on 2021-11-30. Fedora 33 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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