[PATCH] pcl2fax: undefined variables 'PCL' and 'PCL6' used in script

Bram <[email protected]> Wed, 11 Sep 2013 09:50:12 +0200
Newsgroups gmane.comp.telephony.fax.hylafax.devel
Message-ID <[email protected]>
This message is in MIME format.

--=_3359fmna46m8
Content-Type: text/plain;
 charset=ISO-8859-1;
 DelSp="Yes";
 format="flowed"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Hi,

[I'm cross-posting this to both '[email protected]' and  
'[email protected]' since I'm unsure how they  
related to each other - apologies if this is not appropriate]

The pcl2fax script as distributed since HylaFAX 6.0.0 appears to be broken..

As far as I can tell all changes were committed with commit  
417d5ba0a8ed56ad7dd1d17455aec0dfa3bb6dd6.
Commit message not included in this mail since it's rather long.

Relevant parts of 'util/pcl2fax.sh.in':

lines 55-61:
	. etc/setup.cache

	if [ ! -x "$PCL6CMD" ]; then
	    echo "PCL documents are not (currently) supported."
	    exit 254                    # causes document to be rejected
	fi

lines 81-88:
	    -2) ($PCL -h | grep tiffg32d >/dev/null 2>&1) \
             	&& { device=tiffg32d; } \
	            || { device=tiffg3; }
	        ;;
	    -3) ($PCL -h | grep tiffg4 >/dev/null 2>&1) \
	            && { device=tiffg4; } \
	            || { device=tiffg3; }
	        ;;

lines 186-194:
	false && echo $PCL6 \
     	-sDEVICE=$device \
	    -dNOPAUSE \
	    -dSAFER=true \
	    -sPAPERSIZE=$paper \
	    $FIXEDWIDTH \
	    -r$hres\x$vres \
	    "-sOutputFile=$out" \
	    "$files"

lines 203-211:
	$CAT $files | $PCL6 \
	    -sDEVICE=$device \
	    -dNOPAUSE \
	    -dSAFER=true \
	    -sPAPERSIZE=$paper \
	    $FIXEDWIDTH \
	    -r$hres\x$vres \
	    "-sOutputFile=$out" \
	    -

In the environment the script is being run in 'PCL6CMD', 'PCL' and  
'PCL6' are not set.
In 'setup.cache' only 'PCL6CMD' is set.

This means that when the 'pcl2fax' script is run the variables 'PCL'  
and 'PCL6' are not set.
This eventually results in the script attempting to run the commands  
'-h' and  '-sDEVICE=....'.
Obviously both commands do not exists...

Eventually this causes the 'FaxQueuer' to log:
	15:46:53 SYSLOG err FaxQueuer[20224] JOB 5770: CONVERT DOCUMENT:  
Could not reopen converted document to verify format
	15:46:53 SYSLOG info FaxQueuer[15697] NOTIFY: bin/notify  
"doneq/q5770" "format_failed" ""

I believe both '$PCL' and '$PCL6' should be changed into '$PCL6CMD'.

Looking at the Git repository shows that this code is unchanged since  
28 April 2008.


Looking at the SVN repository from HylaFAX+ (found in the  
'[hylafax-devel] code repository transition to SVN' message) shows  
that it was partially changed in SVN:
* lines 55-61: unchanged
* lines 81-88: moved to lines 84-92 but otherwise unchanged
* lines 186-194: removed
* lines 203-211: moved to 206-217 and '$PCL6' changed to '$PCL6CMD'.

This means that in the SVN repository it is already partially fixed  
but the problem in the lines 81-88/84-92 still remain and needs to be  
updated.


Attached is a patch - based on the git repository - to change this.

Small note: this patch alone is not sufficient in our case but I will  
send a separate message for the other problem.



Best regards,

Bram


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


--=_3359fmna46m8
Content-Type: application/aegis-patch;
 name="0001-Replace-PCL-and-PCL6-with-PCL6CMD.patch"
Content-Disposition: attachment;
 filename="0001-Replace-PCL-and-PCL6-with-PCL6CMD.patch"
Content-Transfer-Encoding: 7bit

From a02d02c7d0beb84c3332fb7ecb4f75a57424a263 Mon Sep 17 00:00:00 2001
From: Bram <[email protected]>
Date: Wed, 11 Sep 2013 10:08:19 +0200
Subject: [PATCH] Replace '$PCL' and '$PCL6' with '$PCL6CMD'

The variables 'PCL' and 'PCL6' are never set which causes the script to run
non-existing commands (and fail)
---
 util/pcl2fax.sh.in |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/util/pcl2fax.sh.in b/util/pcl2fax.sh.in
index 5310abf..71b58f9 100644
--- a/util/pcl2fax.sh.in
+++ b/util/pcl2fax.sh.in
@@ -78,11 +78,11 @@ do case "$1" in
     -m) shift;;				# NB: not implemented
     -U) unlimitedlength=yes ;;
     -1) device=tiffg3 ;;
-    -2) ($PCL -h | grep tiffg32d >/dev/null 2>&1) \
+    -2) ($PCL6CMD -h | grep tiffg32d >/dev/null 2>&1) \
             && { device=tiffg32d; } \
             || { device=tiffg3; }
         ;;
-    -3) ($PCL -h | grep tiffg4 >/dev/null 2>&1) \
+    -3) ($PCL6CMD -h | grep tiffg4 >/dev/null 2>&1) \
             && { device=tiffg4; } \
             || { device=tiffg3; }
         ;;
@@ -183,7 +183,7 @@ if [ -f etc/FaxModify ]; then
 fi
 
 # For debuging
-false && echo $PCL6 \
+false && echo $PCL6CMD \
     -sDEVICE=$device \
     -dNOPAUSE \
     -dSAFER=true \
@@ -200,7 +200,7 @@ if [ -n "$PCLFONTSOURCE" ] ; then
     export PCLFONTSOURCE
 fi
 
-$CAT $files | $PCL6 \
+$CAT $files | $PCL6CMD \
     -sDEVICE=$device \
     -dNOPAUSE \
     -dSAFER=true \
-- 
1.7.10.1


--=_3359fmna46m8--


____________________ HylaFAX(tm) Developers Mailing List ____________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe [email protected] < /dev/null