Bug 97763

Summary: mpage-2.5.3-4 produces junk (problem in UTF-8 patch)
Product: [Retired] Red Hat Linux Reporter: Need Real Name <sanjoy>
Component: mpageAssignee: Tim Waugh <twaugh>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 2.5.3-6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-06-23 16:57:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Need Real Name 2003-06-20 16:24:18 UTC
I have a 25-page postscript file (available gzipped at
<http://www.inference.phy.cam.ac.uk/sanjoy/mpage/dimensional-analysis.ps.gz>
that mpage-2.5.3-4 doesn't process right.  It produces a postscript
file with 0 pages.  The vanilla mpage-2.5.3 works fine (I built it
from the .tar.gz file using just 'make' and all the defaults).  I then
applied one patch at a time from the 2.5.3-4 SRPM.  The only patch
that made it break was mpage-2.5.3-utf8.patch

The cmd line that breaks mpage:

% ./mpage -b letter -2o < dimensional-analysis.ps

whereas if I don't use stdin, it works fine:

./mpage -b letter -2o dimensional-analysis.ps

I'm using a Pentium Linux (RH 7.3) system (I built the 2.5.3-4 RPM
from the rawhide SRPM and found the problem originally, then tracked
down the individual patches).

A minor change is that the spec file says the license is BSD but the
COPYING file is GPL v2.

-Sanjoy

Here's a bit more details of what breaks and the command sequence:

% printenv MPAGE     /* to show that MPAGE is unset */
% rm -fr mpage-2.5.3
% tar xzf mpage-2.5.3.tgz /* reinstall clean sources */
% cd mpage-2.5.3
% make
[compiles with no problem]
% ./mpage -b letter -2o < dimensional-analysis.ps | grep Pages
%%Pages: (atend)
%%%Pages: 25
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 13
[Like it should be -- 25 pages originally, now 13 2-up pages]

[Now I apply the utf8 patch:]
% patch -p1 < /usr/src/redhat/SOURCES/mpage-2.5.3-utf8.patch
patching file file.c
patching file glob.c
patching file mpage.c
patching file mpage.h
patching file text.c

% make
[All compiles fine except for the warning below:]
gcc -O2 -s -DPAGE_DEF=\"A4\" -DLIBDIR=\"/usr/local/share/mpage\" -DDEFAULT_ENCO
DING=1 -DDEFAULT_DUPLEX=0 -DDEFAULTSMARGIN=18  -DSPOOLER=BSD_SPOOLER  -Wall -c 
-o file.o file.c
file.c: In function `looks_utf8':
file.c:547: warning: array subscript has type `char'

[Now retry mpage:]
% ./mpage -b letter -2o < dimensional-analysis.ps | grep Pages
%%Pages: (atend)
%%Pages: 0
[Ack!  0 pages in the resulting file!]

[And with cmd line input instead of stdin]
% ./mpage -b letter -2o dimensional-analysis.ps | grep Pages
%%Pages: (atend)
%%%Pages: 25
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 1
%%Pages: 13
[If I use the cmd line instead of stdin, no problem.]