ppp icon indicating copy to clipboard operation
ppp copied to clipboard

Bashism within redialer

Open susnux opened this issue 2 years ago • 10 comments

redialer has /bin/sh set as its interpreter, but uses bash function style and should probably changed like this:

diff -Ndur ppp-2.4.7/scripts/redialer ppp-2.4.7-fix-bashisms/scripts/redialer
--- ppp-2.4.7/scripts/redialer	2014-08-09 15:31:39.000000000 +0300
+++ ppp-2.4.7-fix-bashisms/scripts/redialer	2014-11-19 05:09:46.168864978 +0200
@@ -31,7 +31,7 @@
 # Function to initialize the modem and ensure that it is in command
 # state. This may not be needed, but it doesn't hurt.
 #
-function initialize
+initialize()
 {
     chat -v TIMEOUT 3 '' AT 'OK-+++\c-OK'
     return
@@ -41,7 +41,7 @@
 #
 # Script to dial a telephone
 #
-function callnumber
+callnumber()
 {
 chat -v							\
 	ABORT		'\nBUSY\r'			\
@@ -66,7 +66,7 @@
 #
 # Script to dial any telephone number
 #
-function callall
+callall()
 {
 #   echo "dialing attempt number: $1" >/dev/console
     callnumber $PHONE1

susnux avatar May 23 '22 15:05 susnux

@thesamesam You able to validate and craft a patch for this?

enaess avatar Oct 25 '22 19:10 enaess

Actually I'm tempted to just delete the whole scripts directory. I'd be very surprised if any of it is still useful these days.

paulusmack avatar Oct 27 '22 06:10 paulusmack

@paulusmack some scripts are used more frequently than others. Ubuntu still packages and supports the pon/poff style of invocations of pppd. I've been using it frequently to test pppd outside of network-manager and with setting up sstp-client.

enaess avatar Oct 27 '22 16:10 enaess

Do debian & ubuntu package the scripts from here, or do they have their own versions?

The poff script in particular seems to be making policy decisions about how to identify and manage multiple pppd instances which don't seem to me to be within the scope of this project.

paulusmack avatar Oct 28 '22 06:10 paulusmack

@paulusmack you are correct in that debian at least provides their own copy of these scripts with changes. Now, I don't know what other distributions do with the scripts directory, but at least for Debian:

See: https://salsa.debian.org/moschlar/ppp/-/tree/master/debian/extra

We could probably keep the scripts directory under source control, but remove it from the distribution, i.e. make dist-gzip would roll a tar-ball that does not include these files. That would be to remove the scripts directory from ppp/Makefile.am's SUBDIRS variable and then remove scripts/Makefile.am.

enaess avatar Oct 28 '22 15:10 enaess

@bootc: What do you think?

Neustradamus avatar Jan 04 '23 00:01 Neustradamus

This would be a trivial thing to do on our end. Let's see what @bootc thinks

enaess avatar Jan 04 '23 01:01 enaess

Also, @yarda does the script directories get used under RedHat? @thesamesam what about Gentoo?

enaess avatar Jan 26 '23 06:01 enaess

We currently install scripts/{pon,poff,plog,chatchat} into PATH in /usr/sbin and install the rest in /usr/share/doc as documentation (so users have to actively seek them out, although we mention them in a post-install message).

We also roll our own net-dialup/ppp-scripts package which has additional scripts of our own, which we could possibly fold ^ into if you stop including them in the ppp distribution.

thesamesam avatar Jan 26 '23 06:01 thesamesam

We install all scripts as doc/examples. Unfortunately, I don't know whether anybody is actively using them.

yarda avatar Jan 28 '23 10:01 yarda