From owner-freebsd-ports Fri Jan 19 2: 5:45 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id CAC9437B6A5 for ; Fri, 19 Jan 2001 02:05:23 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f0JA5Nd01247; Fri, 19 Jan 2001 02:05:23 -0800 (PST) (envelope-from gnats) Received: from polaris.we.lc.ehu.es (polaris.we.lc.ehu.es [158.227.6.43]) by hub.freebsd.org (Postfix) with ESMTP id 22BAD37B401 for ; Fri, 19 Jan 2001 02:01:46 -0800 (PST) Received: from v-ger.we.lc.ehu.es (v-ger [158.227.6.179]) by polaris.we.lc.ehu.es (8.11.1/8.11.1) with ESMTP id f0JA1cf11370 for ; Fri, 19 Jan 2001 11:01:38 +0100 (MET) Received: (from jose@localhost) by v-ger.we.lc.ehu.es (8.11.1/8.11.1) id f0J0ErY00422; Fri, 19 Jan 2001 01:14:53 +0100 (CET) (envelope-from jose) Message-Id: <200101190014.f0J0ErY00422@v-ger.we.lc.ehu.es> Date: Fri, 19 Jan 2001 01:14:53 +0100 (CET) From: "Jose M. Alcaide" Reply-To: jose@we.lc.ehu.es To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: ports/24455: [PATCH] print/apsfilter does not work properly with /bin/sh Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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 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