XV Jumbo Patches


XV is John Bradley's shared-source, shareware image viewer for the X Window System. It has an outstanding user interface, an excellent suite of tools, and read/write support for a large number of image formats. Even grumpy editors like it.

On the other hand, the last official release of XV was more than a decade ago, and as far as Greg has been able to determine, no part of the XV web site gets updated more frequently than once every two to four years.* There have been quite a number of third-party patches produced, and many of the older ones are even listed on the XV Downloads page. Unfortunately, many of them collide with each other, making their application much more of an experts-only process than it should be. (Never mind that patching source code with Larry Wall's patch program and even mere compilation are now considered by many to be "expert" tasks . . . Le sigh.)

*Even the bassets page, which used to get regular updates, went static in May 2006.

Anyway, back in early 2000, Greg decided that merging all known patches into a pair of "jumbo" patches--one for fixes, one for enhancements--would be a generally groovy and useful thing to do. Greg had just about finished the patches, too, when he got a little bogged down on some of his own enhancements; he never got around to releasing anything publicly. (A number of other folks did, which Greg discovered much later; see the README file, linked below, for details about at least ten other jumbo patch-sets.)

Fast-forward about four years: Jonathan Corbet of LWN.net revealed in his Grumpy Editor's Guide to Image Viewers that he too is a longtime user and fan of XV, as are quite a number of other folks who posted comments to the article. This prompted Greg to get off his overworked posterior, clean up his jumbo patches, and finally post them for the world to see (and mostly ignore ;-) ). Two updates followed a year later (April and May 2005), with a third (and current) update in May 2007 (unless one counts the 20081216 interim diff, which contains five additional small bugfixes; see below).

As of mid-February, Greg began working in earnest on the next update, only to be sidetracked by remodelling, car shopping, job, etc. So May 2010 is definitely not happening, and there's no credible estimate for a new date. (Sorry, this simply isn't a high priority at the moment, no matter how much it pains Greg to say so. :-( Greg would be significantly more motivated if someone managed to convince John Bradley to relicense 3.10a under the GNU GPL or even a permissive license such as MIT/X11/BSD/zlib/libpng; the code is a mess and needs serious work, which is frequently tedious and time-intensive. Any takers? It's hard to imagine he derives any serious income from it at this point.)

What's Here

The jumbo patch below incorporates roughly 131 fix- and enhancement-patches, most of which have been created by other people and are (or were) available as standalone patches. Many of Greg's own fixes and additions exist nowhere else but within this patch, however. (Sorry -- but after a certain point, the interaction between patches becomes so extensive that trying to split out individual ones again is completely futile. Greg's gcc-warnings-patch and trailing-whitespace-patch -- numbers 17 and 25, respectively, in the list below -- are good examples. Also note that, as of the 20070520 release, the two jumbo patches have merged into a single super-jumbo patch; apparently no one was particularly interested in just the fix-patch, and the split was more work for everyone.)

For reference, here's a list of the fixes as of the April 2005 jumbo patch:

((*) = listed on XV Downloads page, (f) = on ftp site only):

 - grabpatch (*)                [obsoleted by new-xvgrab.c below]
 - vispatch (*)
 - mp-tiff-patch (*)            [technically an enhancement, but JHB says...]
 - longname.patch (*)           [*SECURITY*]
 - xpm.patch (*)
 - deepcolor.patch (*)          [slightly modified for language conformance]
 - gifpatch (*)
 - exceed_grab.patch (*)
 - xv-redhat6-readme.txt (*)    [slightly modified for portability]
 - beos.patch (*)               [modified for portability]
 - croppad.patch (f)
 - epsfpatch (f)
 - tiff1200.patch (*)
 - gssafer.patch (*)            [*SECURITY*]
 - new-xvgrab.c (f)             [includes grabpatch but not exceed_grab.patch]
 - xcmap.diff (AD)              [part of xv-3.10a-png-1.2d.tar.gz]
 - fixes for huge number gcc -Wall warnings--including two bugs (GRR)
 - fix for cleandir script when no makefile exists (GRR)
 - *SECURITY* fix for gets() in vdcomp.c (GRR, LCN vdcomp-security.patch)
 - *SECURITY* fix for getwd() on Linux (GRR, LCN Linux-compile.patch)
 - fix for "no fuss" Linux compiles (LCN Linux-compile.patch)
 - partial *SECURITY* fix for mktemp() in xv.c and xvdir.c (GRR)
   (remaining instances in xv.c (2), xvimage.c, xvfits.c, xvpds.c, xvps.c, and
   possibly xvtiff.c--most involve system())
 - freebsd-vdcomp-newline.patch (AAC)
 - xv-3.10a.patch.linux (PBJ)   [/bin/sh versions of cleandir, RANLIB.sh only]
 - removed trailing white space (GRR)  [purely cosmetic]
 - fixed compilation error in registered versions (GRR)
 - fix for YCbCr oversaturated-green bug(s) in TIFF decoder (GRR)
 - provisional fix for contiguous tiled TIFFs with bottom-* orientation (GRR)
 - fixes for gcc 3.3 -Wall warnings (GRR)
 - fix for incorrect 16/24-bit display of xwd dumps (SJT)
 - *SECURITY* fix for multiple input-validation bugs (OpenBSD/SuSE, Gentoo, GRR)
   (this also completes the partial mktemp() security fix listed above)
 - fix for (probable) 24-bit endianness bug in fixpix code (GRR)
newer than 20050410:  see the changelog below

Here's a list of the enhancements as of the May 2005 jumbo patch:

((*) = listed on XV Downloads page, (<who>) = third-party):

 - xv-3.10a.JPEG-patch (*)
   (xv-3.10a.JPEG-patch.old differs only in ftp site listed in comments at top)
 - xv-3.10a.TIFF-patch (*)
 - xv-3.10a-png-1.2d.tar.gz (AL, AD) (*)
   (xvjpeg.diff and xvtiff.diff ignored; xcmap.diff included in fixes)
 - xvpng-1.2d-fix3.patch (GRR, SJT) (*)
 - pdf.patch (*)
 - windowid.patch + windowid.patch.readme (*)
 - bmp32.patch (*)
 - fixpix-20000610.tar.gz (GV)
   (identical to 19961127 version except for README updates and new Win32 file)
   [modified to be runtime-selectable via -/+fixpix option]
 - browse-remember.patch (JZ)
 - faster-smooth.patch (JZ)
 - PAM support (GRR)
 - PNG/GIF -ibg ("image background") transparency option (GRR)
   (does not yet support TIFF, XPM or TGA)
 - VersionInfo* in help screen (GRR)
 - minor grammar/spelling fixes (GRR)
 - floating-point support for -wait when USE_TICKS enabled (GRR)
 - wheelmouse.patch (SB)
 - freebsd-gravity-hints-patch (JR)
 - xv-zx.patch (JCE)
 - xv3.10a.wapbmp.patch (PSV)
 - xv-3.10a-pcd.patch.20010708 (DAC)
 - jp-ext-bzip2-1.1.patch
   (from ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/shige/xv/)
 - boosted maximum number of files from 4096 to 32768 (GRR)
   (note that OS kernel limits may also apply; for example, in Linux see
   MAX_ARG_PAGES in linux-<version>/include/linux/binfmts.h)
 - xv-3.10a-bmp16.patch (KS)
 - final-image delay (e.g., "-wait 0.2,3" : pause 3 secs on final image) (GRR)
 - xv-numpad.patch (EK)
 - xv-delete-is-not-backspace.patch (EK)
 - made browser window (schnauzer) and icons configurable (AT, GRR)
 - xv-3.10a-bmpfix.patch (WF)  [*SECURITY*]
 - xv310a-jp-extension-rev5.3.3.tar.gz (TI, IM, ..., WF)
   (adds support for MAG, MAKI, Pi, PIC, and PIC2 formats[*]; "magic suffix"
   detection/conversion; MacBinary prefixes; archives as virtual filesystems;
   multilingual text viewer [though not Unicode]; etc.)
 - xv-3.10a-yaos.dif (WF, TO)  [*SECURITY*]
   (fixes a number of format-string issues and system() calls)
 - xv-3.10a.dif (WF)           [*SECURITY*]
   (fixes more format-string issues, mktemp() and open() calls, and compilation
   warnings [mostly from jp-extension patch])
 - xv-3.10a-jumbo-jpd_startgrab-patch-20050420.txt (JPD)
 - PATCH.alwaysnever (LJ)
 - PATCH.bsd (LJ)
 - PATCH.linedraw (LJ)
 - PATCH.multipage (LJ)
 - PATCH.multipageGIF (LJ)
 - PATCH.random (LJ)
 - PATCH.stat (LJ)
 - PATCH.thumbs (LJ)
 - xv-startgrab-imake-hips.patch (JPD)
   ("hips" portion only; adds support for HIPS image format[*])
 - xv-3.10a-formatstr.patch (KS)
 - xv-3.10a-shortsleep.patch (KS)
 - xv-3.10a-locale-linux.patch (KS)
 - xv-3.10a-printkey.patch (KS)
 - xv-3.10a-sysconfdir.patch (KS)
 - added PREFIX and DESTDIR support to Makefile (KS, GRR)
 - xv-3.10a-xvexecpath.patch (but disabled pending fixes) (KS)
 - xv-3.10a-zeroquit.patch (KS, GRR)
newer than 20050501:  see the changelog below

[*] Note that all six of these formats may still suffer from exploitable heap
    overflows [*SECURITY*] when decoding images with large (possibly invalid)
    dimensions; as a result, they are DISABLED by default.  (Search for "GRR
    POSSIBLE OVERFLOW / FIXME" comments in xvmag.c, xvmaki.c, xvpi.c, xvpic.c,
    xvpic2.c, and xvhips.c, but keep in mind that these may not be exhaustive.)
    Users who choose to overlook these security issues can enable any or all
    of them by editing config.h.

And here's a quick guide to the "third-party" credits in the lists above:

  AAC = Andrey A. Chernov [ache] (http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-ab)
  AD  = Andreas Dilger (adilger@clusterfs.com)
  AL  = Alexander Lehmann (lehmann@usa.net)
  AS  = Alexey Spiridonov (http://www-math.mit.edu/~lesha/)
  AT  = Anthony Thyssen (http://www.cit.gu.edu.au/~anthony/)
  BR  = Bruno Rohee (http://bruno.rohee.com/)
  DAC = David A. Clunie (http://www.dclunie.com/xv-pcd.html)
  EAJ = Erling A. Jacobsen (linuxcub@email.dk)
  EK  = Egmont Koblinger (egmont@users.sourceforge.net)
  FG  = Fabian Greffrath (fabian@debian-unofficial.org)
  GRR = Greg Roelofs (http://pobox.com/~newt/)
  GV  = Guido Vollbeding (http://sylvana.net/guido/)
  IM  = IKEMOTO Masahiro (ikeyan@airlab.cs.ritsumei.ac.jp)
  JC  = John Cooper (john.cooper at third-harmonic.com)
  JCE = John C. Elliott (http://www.seasip.demon.co.uk/ZX/zxdload.html)
  JDB = John D. Baker (http://mylinuxisp.com/~jdbaker/)
  JG  = Jörgen Grahn (http://snipabacken.se/~grahn/)
  JHB = John H. Bradley, of course (http://www.trilon.com/xv/)
  JPD = Jean-Pierre Demailly (http://www-fourier.ujf-grenoble.fr/~demailly/)
  JR  = John Rochester (http://www.freebsd.org/cgi/query-pr.cgi?pr=2920)
        (also http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-af, -ag)
  JRK = James Roberts Kirkpatrick (uwyo.edu)
  JZ  = Joe Zbiciak (http://spatula-city.org/~im14u2c/)
  KS  = Kyoichiro Suda (http://www.coara.or.jp/~sudakyo/XV_jp.html)
  LCN = Landon Curt "chongo" Noll (http://www.isthe.com/chongo/)
  LJ  = Larry Jones
  PBJ = Peter Jordan (http://www.ibiblio.org/pub/Linux/apps/graphics/viewers/X/, .lsm)
  PSV = Pawel S. Veselov (http://manticore.2y.net/wbmp.html)
  RAC = Ross Combs (rocombs@cs.nmsu.edu)
  RJH = Robin Humble (http://www.cita.utoronto.ca/~rjh/)
  SB  = Sean Borman (http://www.seanborman.com/software/xvwheelmouse.html)
  SBM = Scott B. Marovich (formerly marovich@hpl.hp.com)
  SJT = TenThumbs (tenthumbs@cybernex.net)
  TA  = Tim Adye (http://hepwww.rl.ac.uk/Adye/xv-psnewstyle.html)
  TAR = Tim Ramsey
  TI  = Tetsuya INOUE (tin329@chino.it.okayama-u.ac.jp)
  TO  = Tavis Ormandy (taviso@gentoo.org)
  WF  = Werner Fink (http://www.suse.de/~werner/)

Other credits are as listed on the XV Downloads page or in the respective patches (e.g., the jp-extension patches below).

(The sharp-of-eye will notice a distinct similarity between the colored sections on this page and text found in the jumbo-patches README file. Sigh. It's not like Greg has an infinite amount of time at his disposal . . . Some of this may eventually get spiffed up when time permits. Or not.)

What's Not Here

The following things are not and will not be available here (well, probably):

(Greg would be willing to supply a fully patched Linux binary, statically linked against libtiff, libjpeg, libpng, zlib and libjasper, if John wishes to include it on his site.)

The second-to-last item (omitted patches) includes the following:

 - others from Kyoichiro Suda (some are duplicates):
        -rw-r--r--      4644 Mar 11  2004 xv-3.10a-directory.patch
        -rw-r--r--       462 Mar 11  2004 xv-3.10a-dirwkey.patch
        -rw-r--r--       688 Mar 11  2004 xv-3.10a-docdir.patch
        -rw-r--r--     11952 Mar 11  2004 xv-3.10a-download-test0.patch
        -rw-r--r--     41786 Mar 11  2004 xv-3.10a-download-test1.patch
        -rw-r--r--     42397 Mar 11  2004 xv-3.10a-download-test2.patch
        -rw-r--r--     47679 Mar 11  2004 xv-3.10a-download-test3.patch
        -rw-r--r--     52745 Mar 11  2004 xv-3.10a-download-test4.patch
        -rw-r--r--      3423 Apr 24  2004 xv-3.10a-keyzoom.patch
        -rw-r--r--     12387 Mar 15  2004 xv-3.10a-menubutton.patch
        -rw-r--r--      1178 Apr 24  2004 xv-3.10a-noblink.patch
        -rw-r--r--     57092 Jul  9  2004 xv-3.10a-resolution.patch
        -rw-r--r--      4645 Apr 24  2004 xv-3.10a-selall.patch
        -rw-r--r--       702 Apr 24  2004 xv-3.10a-showlongname.patch
        -rw-r--r--      1205 Apr 24  2004 xv-3.10a-staytoppdir.patch
        -rw-r--r--      4228 Apr 24  2004 xv-3.10a-wheelmouse.patch
        -rw-r--r--       744 Apr 24  2004 xv-3.10a-xvbutt_wait.patch
        -rw-r--r--      3757 Jul  9  2004 xv-3.10a-xvscrl_button2.patch
        -rw-r--r--      1494 Jul  9  2004 xv-3.10a-xvscrl_wait.patch
        -rw-r--r--     19352 Jul  9  2004 xv-3.10a-xvzoom.patch

 - xv-3.10a+jp-extension-rev5.3.3+FLmask.v2.1+png+misc.patch    ["mask" support]

 - xv-psnewstyle.patch (TA)                     [coming "soon"?]
 - xv-3.10a.patch.linux (PBJ)                   [maybe use vdcomp.c changes?]
 - xvxpm-anthony-thyssen.c (AT)                 ["slate grey" bug already gone?]
 - xv-geoff-kuenning-iconsize-slideshow.patch   [var. icons; full-screen slides]
 - xv-scott-marovich-20070214-xvtiff.c.patch6.unified   [TIFF CMYK support]

 - stuff in xv/unsupt:
        -rw-r--r--     30527 Dec 22  1994 FITS.rite
        -rw-r--r--     49152 Dec 22  1994 FITS.tar
        -rw-r--r--      3753 Dec 22  1994 G3.patch1
        -rw-r--r--     24576 Dec 22  1994 G3.tar
        -rw-r--r--      1098 Dec 22  1994 INFO.cgm
        -rw-r--r--      1941 Dec 22  1994 README
        -rwxr-xr-x      1059 Dec 22  1994 getweather
        -rwxr-xr-x      2186 Dec 22  1994 getweather.ksh
        -rw-r--r--       856 Dec 22  1994 twm.fix
        -rw-r--r--       844 Dec 22  1994 vargs.c
        -rw-r--r--     47626 Dec 22  1994 vis
        -rw-r--r--     21097 Dec 22  1994 xscm

Some (psnewstyle, FLmask, various Kyoichiro Suda patches) may show up in a future version; some (twm, xscm, FITS) probably won't due to lack of interest (both Greg's and everyone else's).

The last item (nonexistent patches) includes the following:

 - fix xvpng.c not to use direct struct access
 - (better) fix for never-ending pile of SLOW popups when viewing TIFFs with
   unknown tags (or truncated/corrupted images)
 - fix for minor .Z inefficiency in xv.c ("FIXME")
 - fix for filename entry-field mouse/cursor deficiencies
   (positioning fixed 20070104 by Ross Combs; would like select/cut/paste, too)
 - fix for .ppm.gz "disk leak" [can't reproduce...already fixed?]
   (maybe occurs only if filesystem is already nearly full?  bad .gz?)

 - transparency support for TIFF, XPM and TGA images
 - support for tiled background image (with transparent foreground image)
 - MNG/JNG support
 - SVG support

Whether any or all of those will ever get (created and) included is anybody's guess, but don't hold your breath. Greg has already spent a fair amount of time on this little venture, and he has many other projects competing for attention.


Without further ado--heck, Greg should have just pasted in the whole jumbo-patches README, eh?--here's the archive containing the single super-jumbo patch (only in gzip'd tar format since bzip2 saved less than 25 KB) and its accompanying README file:

Note that the patches themselves are now hosted on SourceForge within the PNG/MNG project. (One of the XV enhancements is PNG support, after all. :-))

Revision History

Here's a brief summary of what has changed in different versions of the jumbo patches. (An italicized date indicates an internal/non-public update.)





How to Build

The following assumes you, the user, already have the libtiff, libjpeg, libpng, zlib, and JasPer libraries downloaded, patched (if necessary), compiled, and installed, not to mention a C compiler and the bzip2, tar, patch, and make utilities. You should also have downloaded the original XV 3.10a source distribution from the XV Downloads page and be able to edit its Makefile and config.h files as indicated in the INSTALL file. Finally, you should know what a Unix(-style) command line is, where to find one, and how to wield it with abandon (or at least with adult supervision)--and preferably not as the root user until the make install step.


These patches work for Greg (and parts of them apparently work for various other people), and so far Greg's CPU still computes and his hard disks haven't been wiped. But there's no guarantee that that will be the case for you! In particular, not every incorporated patch has been explicitly tested, nor has every possible subcase of the explicitly tested subset. (Read that again; it's grammatical.) Nor are these patches officially blessed by John Bradley in any way. In other words, if you use these patches, you do so at your own risk. (Greg doesn't believe there are any serious problems remaining, but then, what programmer ever does? Bugs happen.)

Assuming you have the prerequisites out of the way and aren't scared off by the Big Scary Warning, here's the build procedure:

If everything seems to be working to your satisfaction, go ahead and install:

That wasn't so hard, was it?


There isn't any.

Ha ha! You might think Greg is kidding, but he really isn't. While you're welcome to send him e-mail, and he may even respond, it's sort of a crapshoot. Fixes and improvements are the most welcome, of course, while gripes and pleas for generic help are the least. But even an interesting message with a poor subject line may get dumped into the spam pile without being seen, and occasionally life intrudes to the extent that cool, already saved e-mail gets buried beneath newer, also-cool e-mail for months or years. Seriously.

Also, John Bradley isn't responsible for these patches, so don't expect help from that quarter, either (even if you've paid your shareware registration). If you encounter problems and don't know what to do with relatively standard C code, you're probably better off going elsewhere.

Legal Stuff

Please remember that XV is not freeware! If you use it for anything other than personal enjoyment, send John your $25 (or whatever the appropriate registration fee is). This is covered in the original README file, and nothing Greg has done alters that in any way.

All of the component patches within the jumbo patches are automatically copyrighted by their respective authors (even when those authors are unknown), and obviously the XV 3.10a sources themselves are copyrighted by John Bradley (see copyright.h for the complete notice). There are no known patents affecting the jumbo patches themselves, but there are literally millions of unknown ones out there, so go elsewhere if you need guarantees.

Last modified 2 August 2010, you betcha.

Copyright © 2004-2010 Greg Roelofs.