Bug 61922 - media-gfx/jpeg2ps-1.9 uses hardcoded default paper size
Bug#: 61922 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: pclouds@gentoo.org Reported By: ulm@gentoo.org
Component: Applications
URL: 
Summary: media-gfx/jpeg2ps-1.9 uses hardcoded default paper size
Keywords:  
Status Whiteboard: 
Opened: 2004-08-27 07:00 0000
Description:   Opened: 2004-08-27 07:00 0000
The ebuild uses "letter" as hardcoded default paper size. This should be
configurable.

Suggestion: Use /etc/localtime to determine the continent, as in
net-misc/hylafax-4.2.0_rc2. Or introduce a useflag.

(See also bugs #34741, #38465, and #52716. Maybe it is time for a general
solution for this issue.)

------- Comment #1 From Jakub Moc (RETIRED) 2005-07-27 18:18:39 0000 -------
Re-assign a stale bug.

------- Comment #2 From Nguyen Thai Ngoc Duy (RETIRED) 2005-07-28 23:14:01 0000 -------
It's not the ebuild hardcode this but the program jpeg2ps itself. As the ebuild
says, you may you -p to specify other paper size. I mark this as WONTFIX. Please
request to upstream.

------- Comment #3 From Ulrich Müller 2005-07-29 02:18:10 0000 -------
It is more complicated. The Makefile from the source tar defaults to A4
paper format ("-DA4" compile time option). The ebuild meddles with this,
effectively changing the default to Letter.

Now, I completely disagree about this being an upstream issue. What should
upstream do about this? They already provide a compile time and a run time
option.

Upstream knows nothing about the environment where the program will be installed.
IMHO, it is the responsibility of the distribution to get things right.

------- Comment #4 From Ulrich Müller 2005-07-29 02:21:27 0000 -------
Created an attachment (id=64597) [details]
Proposed patch for jpeg2ps-1.9.ebuild

Determines the default pagesize depending on the continent.

------- Comment #5 From Nguyen Thai Ngoc Duy (RETIRED) 2005-07-31 18:32:15 0000 -------
Ok. I misread the ebuild :(
Applied your patch as jpeg2ps-1.9-r1. Please test it.
Thanks 

------- Comment #6 From Lars Weiler (RETIRED) 2005-07-31 19:02:28 0000 -------
I think the timezone is bad to rely on.  Usually you should use LC_PAPER for it
(probably I _want_ to use letter, but I have a European timezone set).

Sorry that I can't send patches yet.  Probably later or you have an idea to ask
for the locale-settings.

------- Comment #7 From Ulrich Müller 2005-08-01 03:54:28 0000 -------
In reply to comment #5:

Works fine for me.
Minor issue: pkg_postinst outputs the wrong message; the "local" in the
declaration of pagesize (in src_compile) should be removed. Sorry for that.

------- Comment #8 From Ulrich Müller 2005-08-31 01:23:34 0000 -------
Created an attachment (id=67327) [details]
Proposed patch for jpeg2ps-1.9-r1.ebuild

Again: If the remaining minor issue with the postinst message is fixed,
this bug can IMHO be marked as resolved. See attached patch.

------- Comment #9 From Nguyen Thai Ngoc Duy (RETIRED) 2005-12-02 22:46:08 0000 -------
Fixed in CVS. I'm really sorry it took too long to solve such a minor issue.

------- Comment #10 From Ulrich Müller 2008-04-11 06:41:01 0000 -------
Reopening. The taken solution does not work anymore, since /etc/localtime is no
longer a symlink. And meanwhile I think that the default should not depend on
the configuration of the installed system.

------- Comment #11 From Ulrich Müller 2008-04-11 06:44:56 0000 -------
Created an attachment (id=149370) [details]
Proposed patch for jpeg2ps-1.9-r1.ebuild

Probably a USE flag is the cleanest thing we can do here, see attached patch. 

There is already:

   media-gfx/potrace:metric - default to a4 paper size and metric measurement

So we could go with the "metric" flag, too:

   media-gfx/jpeg2ps:metric - Default to A4 paper size

------- Comment #12 From Ulrich Müller 2008-04-13 12:54:53 0000 -------
(In reply to comment #11)
> Created an attachment (id=149370) [edit] [details]
> Proposed patch for jpeg2ps-1.9-r1.ebuild

Committed, as discussed with maekke on irc.

------- Comment #13 From Gerben Vos 2008-04-16 20:39:59 0000 -------
No; it would be much better if jpeg2ps, potrace and others use libpaper
(/etc/papersize) instead. I'll prepare a patch.

------- Comment #14 From Ulrich Müller 2008-04-17 08:01:35 0000 -------
Created an attachment (id=150026) [details]
jpeg2ps-1.9-libpaper.patch

(In reply to comment #13)
> No; it would be much better if jpeg2ps, potrace and others use libpaper
> (/etc/papersize) instead.

This looks obvious, and in fact was my first approach, too. I attach my patch
for reference (it may still have some rough edges, but basically should work).

However, it would introduce some subtle incompatibilities:
- The "p11x17" page size is not known to libpaper (or rather, it uses a
  different name for it).
- For page sizes other than A4 or Letter, the size of the bounding box may
  differ by 1 or 2 Postscript points.

Therefore, one probably would want another USE flag to enable usage of
libpaper. I'm not sure if it's worth the effort.

------- Comment #15 From Ulrich Müller 2008-05-03 15:59:49 0000 -------
We might also have a licence problem if we link against libpaper.

From the jpeg2ps licence:
| This software is free. You are granted the right to use and copy it.
| This software may not be sold or bundled with any commercial package
| without express written permission of the author.

And unfortunately, libpaper is not licenced under the LGPL, but under the GPL
(version 2 only). I think that this is incompatible with the above (but IANAL).

I've also contacted upstream (Thomas Merz) about this issue. He doesn't want to
re-release jpeg2ps under a different licence.