Bug 1128345 - chat issues with -E (environment variable substitution)
Summary: chat issues with -E (environment variable substitution)
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ppp
Version: 7.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Jaroslav Škarvada
QA Contact: qe-baseos-daemons
Depends On:
TreeView+ depends on / blocked
Reported: 2014-08-09 10:09 UTC by giulioo
Modified: 2018-11-16 13:05 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1650539 (view as bug list)
Last Closed: 2018-11-16 13:05:20 UTC

Attachments (Terms of Use)

Description giulioo 2014-08-09 10:09:48 UTC
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):
Steps to reproduce:
I'm making an example for REPORT, the same applies to ABORT, CLR_REPORT and
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);
6. Re-run chat w/ -E
        $ chat  -E -vs -f chat.script >/dev/ttyS0 </dev/ttyS0
        report (abc)    <==== SUCCESS
        expect (abc)

- 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)
        $ 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 4 Tomáš Hozza 🤓 2018-11-16 13:05:14 UTC
Thank you for taking the time to report this issue to us. We appreciate the feedback and use reports such as this one to guide our efforts at improving our products. That being said, this bug tracking system is not a mechanism for requesting support, and we are not able to guarantee the timeliness or suitability of a resolution.

If this issue is critical or in any way time sensitive, please raise a ticket through the regular Red Hat support channels to ensure it receives the proper attention and prioritization to assure a timely resolution. 

For information on how to contact the Red Hat production support team, please visit:

Comment 5 Red Hat Bugzilla Rules Engine 2018-11-16 13:05:20 UTC
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.

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