Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 197775 - sys-apps/baselayout-2.0.0_rc6 - ppp does not work
Summary: sys-apps/baselayout-2.0.0_rc6 - ppp does not work
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-01 14:44 UTC by Alon Bar-Lev (RETIRED)
Modified: 2007-11-02 11:02 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
ppp.patch (ppp.patch,2.09 KB, patch)
2007-11-01 15:49 UTC, Roy Marples (RETIRED)
Details | Diff
pppd.sh (pppd.sh,6.11 KB, text/plain)
2007-11-01 17:30 UTC, Roy Marples (RETIRED)
Details
ppp net config (net,251 bytes, text/plain)
2007-11-01 17:31 UTC, Roy Marples (RETIRED)
Details
net (x1,280 bytes, text/plain)
2007-11-01 19:55 UTC, Alon Bar-Lev (RETIRED)
Details
pppd.patch (pppd.patch,2.61 KB, patch)
2007-11-01 22:34 UTC, Roy Marples (RETIRED)
Details | Diff
pppd.patch (pppd.patch,2.51 KB, patch)
2007-11-02 08:01 UTC, Roy Marples (RETIRED)
Details | Diff
pppd.patch (pppd.patch,2.60 KB, patch)
2007-11-02 09:24 UTC, Roy Marples (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-01 14:44:40 UTC
Well... I had to solve this in order to file this bug :)

/lib/rc/net/pppd.sh:
I guess:
         if [ "${chat}" ] ; then
                 local IFS="$__IFS"
+                set -- ${chat}
                 opts="${opts} connect $(printf "\\'%s\\'" "${chatopts} $(printf "\\'\\\\'\\'%s\\'\\\'' " "$@")")"
                 unset IFS
         fi

Next, the net.exmaple is out of date, took me some time to figure out how to handle the chat script.
At the end I came up with the following:

e() {
        local s
        while [ -n "$1" ]; do
                [ -z "${s}" ] && s="$1" || s="${s}
$1"
                shift
        done
        echo "${s}"
}
chat_ppp0="\
$(e 'ABORT' 'BUSY')
$(e 'ABORT' 'ERROR')
$(e 'ABORT' 'NO ANSWER')
$(e 'ABORT' 'NO CARRIER')
$(e 'ABORT' 'NO CARRIER')
$(e 'ABORT' 'NO DIALTONE')
$(e 'ABORT' 'Invalid Login')
$(e 'ABORT' 'Invalid incorrect')
$(e 'TIMEOUT' '5')
$(e "''" 'AT&F')
$(e 'OK' 'ATV1E0&D2&S0&C1S0=0')
$(e 'OK' 'AT+CGDCONT=1,"IP","internet"')
$(e 'OK' 'ATDT\T')
$(e 'TIMEOUT' '60')
$(e 'CONNECT' "''")
$(e 'TIMEOUT' '5')
$(e '~--' '')"

I think this "e" will be handy if provided by baselayout to users... Without it this chat script looks a mess.

Anyway, please not that baselayout does not take empty lines as empty array elements, I had to put "''" in order to do so, but I don't think this will work with any configuration. Please consider handling empty lines as elements.

Thanks!
Comment 1 Roy Marples (RETIRED) gentoo-dev 2007-11-01 15:49:35 UTC
Created attachment 134905 [details, diff]
ppp.patch

See how this works for you.
Comment 2 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-01 16:33:06 UTC
You say that each line is an array element, but then you add single quote in order to separate between subelements... I liked better the old single-quote-per-element-no-new-line notation.

There is same issue with many other arguments such as brctl.

This patch does not work. I had to revert. Did not find out how to solve this, but all the chat script is passed to chat as a single argument, while it expect every atom to be on its own.
Comment 3 Roy Marples (RETIRED) gentoo-dev 2007-11-01 17:30:02 UTC
Created attachment 134924 [details]
pppd.sh

This full script has some debugging enabled.
Please attach the resulting output.

From my understanding the chat program works like so

chat -a -b -c OP1A OP1B OP2A OP2B OP3A OP3B

And that is what it should eval down to.
Comment 4 Roy Marples (RETIRED) gentoo-dev 2007-11-01 17:31:03 UTC
Created attachment 134925 [details]
ppp net config

What I used to test
Comment 5 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-01 19:53:55 UTC
 * Caching service dependencies ...                                                                        [ ok ]
 * Bringing up interface ppp0
unit 0 linkname ppp0 noauth defaultroute usepeerdns lock defaultmetric 4006 maxfail 0 persist connect '/usr/sbin/chat -e -E -v -T '"'"'*99#'"'"' '"'"'ABORT BUSY ABORT ERROR ABORT '"'"'"'"'"'"'"'"'NO ANSWER'"'"'"'"'"'"'"'"' ABORT '"'"'"'"'"'"'"'"'NO CARRIER'"'"'"'"'"'"'"'"' ABORT '"'"'"'"'"'"'"'"'NO DIALTONE'"'"'"'"'"'"'"'"' ABORT '"'"'"'"'"'"'"'"'Invalid Login'"'"'"'"'"'"'"'"' ABORT '"'"'"'"'"'"'"'"'Login incorrect'"'"'"'"'"'"'"'"' TIMEOUT 5 '"'"'"'"'"'"'"'"''"'"'"'"'"'"'"'"' '"'"'"'"'"'"'"'"'AT&F'"'"'"'"'"'"'"'"' OK '"'"'"'"'"'"'"'"'ATV1E0&D2&S0&C1S0=0'"'"'"'"'"'"'"'"' OK '"'"'"'"'"'"'"'"'AT+CGDCONT=1,"IP","internet"'"'"'"'"'"'"'"'"' OK AT OK ATDT\T TIMEOUT 60 CONNECT '"'"'"'"'"'"'"'"''"'"'"'"'"'"'"'"' TIMEOUT 5 '"'"'"'"'"'"'"'"'~--'"'"'"'"'"'"'"'"' '"'"'"'"'"'"'"'"''"'"'"'"'"'"'"'"''"'"''

/usr/sbin/chat -e -E -v -T '*99#' 'ABORT BUSY ABORT ERROR ABORT '"'"'NO ANSWER'"'"' ABORT '"'"'NO CARRIER'"'"' ABORT '"'"'NO DIALTONE'"'"' ABORT '"'"'Invalid Login'"'"' ABORT '"'"'Login incorrect'"'"' TIMEOUT 5 '"'"''"'"' '"'"'AT&F'"'"' OK '"'"'ATV1E0&D2&S0&C1S0=0'"'"' OK '"'"'AT+CGDCONT=1,"IP","internet"'"'"' OK AT OK ATDT\T TIMEOUT 60 CONNECT '"'"''"'"' TIMEOUT 5 '"'"'~--'"'"' '"'"''"'"''
/usr/sbin/chat -e -E -v -T *99# ABORT BUSY ABORT ERROR ABORT 'NO ANSWER' ABORT 'NO CARRIER' ABORT 'NO DIALTONE' ABORT 'Invalid Login' ABORT 'Login incorrect' TIMEOUT 5 '' 'AT&F' OK 'ATV1E0&D2&S0&C1S0=0' OK 'AT+CGDCONT=1,"IP","internet"' OK AT OK ATDT\T TIMEOUT 60 CONNECT '' TIMEOUT 5 '~--' ''
-T
 * ERROR: net.ppp0 failed to start
Comment 6 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-01 19:55:24 UTC
Created attachment 134946 [details]
net

This is what I use.
Comment 7 Roy Marples (RETIRED) gentoo-dev 2007-11-01 22:34:22 UTC
Created attachment 134974 [details, diff]
pppd.patch

See if this fixes it for you.
Comment 8 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-01 22:48:03 UTC
Nope...
Looks like it still put all the chat script as one argument.

---
Nov  2 00:45:47 alon1 pppd[32764]: pppd 2.4.4 started by root, uid 0
Nov  2 00:45:47 alon1 /etc/init.d/net.ppp0[32371]: WARNING: net.ppp0 has started, but is inactive
Nov  2 00:45:47 alon1 hcid[29786]: link_key_request (sba=00:20:E0:7E:26:90, dba=00:12:37:E9:20:2D)
Nov  2 00:45:49 alon1 chat[304]: expect (ABORT BUSY ABORT ERROR ABORT 'NO ANSWER' ABORT 'NO CARRIER' ABORT 'NO DIALTONE' ABORT 'Invalid Login' ABORT 'Login incorrect' TIMEOUT 5 '' 'AT&F' OK 'ATV1E0&D2&S0&C1S0=0' OK 'AT+CGDCONT=1,"IP","internet"' OK AT OK ATDT\T TIMEOUT 60 CONNECT '' TIMEOUT 5 '~)
Comment 9 Roy Marples (RETIRED) gentoo-dev 2007-11-02 08:01:03 UTC
Created attachment 134989 [details, diff]
pppd.patch

Hmmm, I thought it was supposed to work like that?
OK, this new patch sends them as individual arguments. See if it fixes it for you.
Comment 10 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-02 08:42:58 UTC
Better.
Two modifications:

-opts="${opts} connect '$(echo ${chatprog} $@ | sed -e "s:':'\\\\'':g")'"
+opts="${opts} connect '$(echo ${chatprog} "${chatopts}" $@ | sed -e "s:':'\\\\'':g")'"

-#OK ATDT\T
+#OK 'ATDT\T'

Thanks!
Comment 11 Roy Marples (RETIRED) gentoo-dev 2007-11-02 09:24:47 UTC
Created attachment 134993 [details, diff]
pppd.patch

OK, this patch sould be golden now.
Comment 12 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-02 10:44:35 UTC
Confirmed.
Thanks!
Comment 13 Roy Marples (RETIRED) gentoo-dev 2007-11-02 11:02:58 UTC
Applied to our svn repo. I'll probably release rc7 this weekend when I can look into your ifplugd stuff.