Bug 1650539

Summary: chat issues with -E (environment variable substitution)
Product: [Fedora] Fedora Reporter: Tomáš Hozza <thozza>
Component: pppAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 31CC: giulioo, jaskalnik, jskarvad, msekleta, qe-baseos-daemons
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1128345 Environment:
Last Closed: 2020-11-24 16:51:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomáš Hozza 2018-11-16 12:50:50 UTC
+++ This bug was initially created as a clone of Bug #1128345 +++

Description of problem:
 
chat has a lot of issues handling -E option and report/clear report/abort/clear
abort statements.
 
Version-Release number of selected component (if applicable):
ppp-2.4.5-33.el7.x86_64
 
Steps to reproduce:
I'm making an example for REPORT, the same applies to ABORT, CLR_REPORT and
CLR_ABORT.
 
1. Create a file with this inside
        REPORT "$v1"
        "$v1" ""
and call it chat.script
 
2. Run
        $ export v1=abc

3. Run chat w/o "-E", as expected $v1 doesn't get substituted:
 
        $ chat  -vs -f chat.script >/dev/ttyS0 </dev/ttyS0
        report ($v1)
        expect ($v1)
 
4. Run chat with -E, $v1 is expanded for the expect string but not for REPORT
   I think this is a bug.
 
        $ chat  -E -vs -f chat.script >/dev/ttyS0 </dev/ttyS0
        report ($v1)     <====== BUG, $v1 not expanded
        expect (abc)     <====== OK, $v1 expanded
 
5. Apply this quick and dirty patch
    --- ppp/chat/chat.c.orig    2005-11-26 19:30:31.000000000 +0100
        +++ ppp/chat/chat.c 2005-11-26 19:30:46.000000000 +0100
        @@ -1129,7 +1129,7 @@
            report_string[n_reports++] = s1;
 
            if (verbose)
        -       msgf("report (%v)", s);
        +       msgf("report (%v)", s1);
            return;
             }
 
6. Re-run chat w/ -E
 
        $ chat  -E -vs -f chat.script >/dev/ttyS0 </dev/ttyS0
        report (abc)    <==== SUCCESS
        expect (abc)

ADDITIONAL INFORMATION:
- chat.c uses "clean()" to clean the strings and expand variables.
- for the 4 cases above, it cleans the string into a different variable
- the it uses the original variable instead of the new one
 
- also, all the 4 tests
    if (strlen(s1) > strlen(s)
  appear to be wrong, since it's normal for a string to increase in size due to
  variable expansion, ie:
 
        $ v1=abc     (abc is long as $v1)
        $ chat  -E -vs -f chat.script >/dev/ttyS0 </dev/ttyS0
        report ($v1)
        expect (abc)
        ^CSIGINT
 
        $ v1=abcd    (abcd is longer than $v1)
        $ chat  -E -vs -f chat.script >/dev/ttyS0 </dev/ttyS0
        Illegal or too-long REPORT string ('$v1')
        $

Comment 1 Ben Cotton 2019-08-13 17:11:54 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 2 Ben Cotton 2019-08-13 19:41:14 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to 31.

Comment 3 Ben Cotton 2020-11-03 15:05:07 UTC
This message is a reminder that Fedora 31 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 31 on 2020-11-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 '31'.

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 31 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 4 Ben Cotton 2020-11-24 16:51:19 UTC
Fedora 31 changed to end-of-life (EOL) status on 2020-11-24. Fedora 31 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.