Date: Fri, 19 Jan 2001 01:14:53 +0100 (CET) From: "Jose M. Alcaide" <jose@we.lc.ehu.es> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/24455: [PATCH] print/apsfilter does not work properly with /bin/sh Message-ID: <200101190014.f0J0ErY00422@v-ger.we.lc.ehu.es>
next in thread | raw e-mail | index | archive | help
>Number: 24455 >Category: ports >Synopsis: [PATCH] print/apsfilter does not work properly with /bin/sh >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 19 02:05:22 PST 2001 >Closed-Date: >Last-Modified: >Originator: Jose M. Alcaide >Release: FreeBSD 4.2-STABLE i386 >Organization: Univ. del Pais Vasco - Dept. de Electricidad y Electronica >Environment: FreeBSD 4.2-STABLE, ports tree recently cvsupped. >Description: The apsfilter script (/usr/local/share/apsfilter/bin/apsfilter) uses a shell expression in two places that does not work properly with FreeBSD's sh(1) (BTW, it does not work with Solaris' /bin/sh either). That shell expression takes the form A=XXX B=$A Sh(1) does variable expansion _before_ evaluating all the asignments; as a consequence, the "B" variable is set to an empty value. The same expression works fine with other shells such as bash and zsh. >How-To-Repeat: Install and configure the apsfilter-6.0.0 port. Check that your lpr.c supports the "-C class" option without printing the banner page (recent -STABLE). Then, try to print an ASCII file with two pages per sheet using the "2pps" option: lpr -C 2pps <plain text file> The file will be printed with one page per sheet instead of two. This happens because the apsfilter script uses case "$option" in [...] 1pps|2pps|4pps|8pps) # pages per sheet PS_NUP=${option%pps} ASCII_PPS=$PS_NUP ;; [...] Because of the bug (?) of sh(1), ASCII_PPS is set to an empty value despite the value assigned to PS_NUP. >Fix: [This problem was reported to apsfilter's developers, but they said that maintaining a script compatible with the bugs of all flavors of sh(1) is very hard, so they prefer to assume that /bin/sh is fully POSIX compliant.] The following patch changes the two lines which have the "A=XXX B=$A" form inserting a semicolon between the asignments, turning them into two commands: --- apsfilter.orig Mon Jan 15 18:30:03 2001 +++ apsfilter Thu Jan 18 15:47:17 2001 @@ -1643,7 +1643,7 @@ a2ps|mpage|recode) # choose filter for ASCII files ASCII_FILTER=$option ;; 1pps|2pps|4pps|8pps) # pages per sheet - PS_NUP=${option%pps} ASCII_PPS=$PS_NUP ;; + PS_NUP=${option%pps} ; ASCII_PPS=$PS_NUP ;; header|noheader) # use ASCII headers? ASCII_HEADER=${option#noheader} ;; border|noborder) # use ASCII borders? @@ -1657,7 +1657,7 @@ book) # "book" printing mode PS_BOOK=set PS_NUP=2 ASCII_PPS=2 DUPLEX=set BINDING=short ;; land*|port*) # force paper orientation - LANDSCAPE=${option##port*} ASCII_LANDSCAPE=$LANDSCAPE ;; + LANDSCAPE=${option##port*} ; ASCII_LANDSCAPE=$LANDSCAPE ;; color|colour|mono) # use color or grayscale COLOR=$option ;; esac >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101190014.f0J0ErY00422>