| Summary: | [PATCH] print/apsfilter does not work properly with /bin/sh | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Ports & Packages | Reporter: | Jose M. Alcaide <jose> | ||||
| Component: | Individual Port(s) | Assignee: | andreas <andreas> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | Latest | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Responsible Changed From-To: freebsd-ports->andreas Over to maintainer. State Changed From-To: open->closed has been fixed for a while for apsfilter -current and -stable |
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. 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: 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.