Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] faxaddmodem and Bash version 3.00



On Wednesday 01 Dec 2004 15:52, Lee Howard wrote:
> On 2004.12.01 03:09 Andrew Walrond wrote:
> > Hello list
> >
> > The faxaddmodem script does not work with the new bash version 3.00.
> > Is this a
> > known issue, and is it being delt with?
>
> Not a known issue, and therefore it is not yet being "dealt" with.
>
> Feel free to file a bug report.
>
> Lee.

Ok, the issue is with a change in 'trap' behaviour in bash 3.00.
Chet Ramey (bash developer) explains it well:

 "This was a change made for POSIX compliance.  It works the same as previously
 when not in posix mode:

 caleb.INS.CWRU.Edu(2)$ ./bash
 caleb.INS.CWRU.Edu(3)$ echo $BASH_VERSION
 3.00.0(2)-release
 caleb.INS.CWRU.Edu(3)$ trap 0
 caleb.INS.CWRU.Edu(3)$ echo $?
 0

 POSIX says that the `action' and `condition' are both required.  The official
 way to accomplish what you want is to run `trap - 0'.

 (http://www.opengroup.org/onlinepubs/009695399/utilities/trap.html)"

A quick grep of my hylafax installation finds these uses of trap:

 root@orac hylafax.1 # grep -r trap *
 sbin/xferfaxstats:trap "rm -f $tmpAwk; exit 1" 0 1 2 15
 sbin/recvstats:trap "rm -f $tmpAwk; exit 1" 0 1 2 15
 sbin/faxcron:trap "$RM \$AWKTMP \$JUNK; $RM -rf $TMPDIR; exit 1" 0 1 2 15
 sbin/faxaddmodem:trap "$RMCMD \$JUNK; $RMCMD -r $TMPDIR; exit 1" 0 1 2 15
 sbin/faxaddmodem:    (trap 0 1 2 15;
 sbin/faxaddmodem:    trap "$RMCMD \$JUNK; $RMCMD -r $TMPDIR; kill $nagpid \$catpid; exit 1" 0 1 2 15
 sbin/faxaddmodem:    trap "$RMCMD \$JUNK; $RMCMD -r $TMPDIR; test \"\$catpid\" && kill \$catpid; exit 1" 0 1 2 15
 sbin/faxsetup:    trap "$RM \$JUNK; exit 1" 1 2 15
 sbin/probemodem:trap "rm -f $JUNK; exit 1" 0 1 2 15
 sbin/probemodem:    (trap 0 1 2 15;
 sbin/probemodem:    trap "rm -f \$JUNK; kill $nagpid \$catpid; exit 1" 0 1 2 15
 sbin/probemodem:    trap "rm -f \$JUNK; test \"\$catpid\" && kill \$catpid; exit 1" 0 1 2 15

Of which these are broken:

 sbin/faxaddmodem:    (trap 0 1 2 15;
 sbin/probemodem:    (trap 0 1 2 15;

This (untested) patch should fix things in a backwardly compatible way:

diff -Naur hylafax-4.2.0/etc/faxaddmodem.sh.in hylafax-4.2.0.fixed/etc/faxaddmodem.sh.in
--- hylafax-4.2.0/etc/faxaddmodem.sh.in 2004-07-16 18:29:32.000000000 +0100
+++ hylafax-4.2.0.fixed/etc/faxaddmodem.sh.in   2004-12-04 08:54:33.873232045 +0000
@@ -867,7 +867,7 @@
     # reset the modem.  If something goes wrong, it'll
     # nag the user to check on the problem.
     #
-    (trap 0 1 2 15;
+    (trap - 0 1 2 15;
      while true; do
        sleep 10;
        echo ""
diff -Naur hylafax-4.2.0/etc/probemodem.sh.in hylafax-4.2.0.fixed/etc/probemodem.sh.in
--- hylafax-4.2.0/etc/probemodem.sh.in  2004-03-29 19:57:43.000000000 +0100
+++ hylafax-4.2.0.fixed/etc/probemodem.sh.in    2004-12-04 08:54:02.541396948 +0000
@@ -263,7 +263,7 @@
     # reset the modem.  If something goes wrong, it'll
     # nag the user to check on the problem.
     #
-    (trap 0 1 2 15;
+    (trap - 0 1 2 15;
      while true; do
        sleep 10;
        echo ""


Hope thats useful

Andrew Walrond

____________________ HylaFAX(tm) Users Mailing List _______________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services