diff options
author | jkim <jkim@FreeBSD.org> | 2014-05-22 04:03:14 +0800 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2014-05-22 04:03:14 +0800 |
commit | bbee51a76a4bd66652e9867d1bde0194fb8d22a2 (patch) | |
tree | 6918b0f84f2b152b5437dbb945daef1ebdb514b1 /java/openjdk7/files | |
parent | 5d9f9fd1d1a368f92bd6c905ebc0aebe2b2ab598 (diff) | |
download | freebsd-ports-gnome-bbee51a76a4bd66652e9867d1bde0194fb8d22a2.tar.gz freebsd-ports-gnome-bbee51a76a4bd66652e9867d1bde0194fb8d22a2.tar.zst freebsd-ports-gnome-bbee51a76a4bd66652e9867d1bde0194fb8d22a2.zip |
- Fix printing services. When CUPS is used, ${LOCALBASE}/bin/lpr must be
used to print a generated PostScript file. When lpd(8) is used, lpr(1) from
base must be used. Also, status command for lpc(8) requires a printer name.
If no argument is specified, i.e., "/usr/sbin/lpc status", then it displays
the command usage, i.e., "usage: status {all | printer ...}".
Unfortunately, "usage" is interpreted as a printer name because ":" is
included. Add "all" and adjust an expression for grep(1). [1]
- Use /proc/curproc/file to find its executable path if available. It fixes
java/icedtea-web, for example. [2]
PR: ports/178856 [1]
PR: java/189905 [2]
Diffstat (limited to 'java/openjdk7/files')
3 files changed, 91 insertions, 0 deletions
diff --git a/java/openjdk7/files/patch-src-share-classes-sun-print-PSPrinterJob.java b/java/openjdk7/files/patch-src-share-classes-sun-print-PSPrinterJob.java new file mode 100644 index 000000000000..c4993514bdd4 --- /dev/null +++ b/java/openjdk7/files/patch-src-share-classes-sun-print-PSPrinterJob.java @@ -0,0 +1,36 @@ +--- jdk/src/share/classes/sun/print/PSPrinterJob.java ++++ jdk/src/share/classes/sun/print/PSPrinterJob.java +@@ -1568,9 +1568,31 @@ + } + + String osname = System.getProperty("os.name"); +- if (osname.equals("Linux") || osname.equals("FreeBSD") || osname.equals("NetBSD") || osname.equals("OpenBSD") || osname.equals("OS X")) { ++ if (osname.equals("Linux") || osname.endsWith("BSD") || osname.contains("OS X")) { ++ String lprPath = "/usr/bin/lpr"; ++ if (osname.endsWith("BSD")) { ++ final PrintService pservice = getPrintService(); ++ Boolean isIPPPrinter = ++ (Boolean)java.security.AccessController.doPrivileged( ++ new java.security.PrivilegedAction() { ++ public Object run() { ++ try { ++ Class psClass = ++ Class.forName("sun.print.IPPPrintService"); ++ if (psClass.isInstance(pservice)) { ++ return Boolean.TRUE; ++ } ++ } catch (Throwable t) { ++ } ++ return Boolean.FALSE; ++ } ++ }); ++ if (isIPPPrinter) { ++ lprPath = "%%LOCALBASE%%/bin/lpr"; ++ } ++ } + execCmd = new String[ncomps]; +- execCmd[n++] = "/usr/bin/lpr"; ++ execCmd[n++] = lprPath; + if ((pFlags & PRINTER) != 0) { + execCmd[n++] = "-P" + printer; + } diff --git a/java/openjdk7/files/patch-src-solaris-bin-java_md_solinux.c b/java/openjdk7/files/patch-src-solaris-bin-java_md_solinux.c new file mode 100644 index 000000000000..1d6b67c99987 --- /dev/null +++ b/java/openjdk7/files/patch-src-solaris-bin-java_md_solinux.c @@ -0,0 +1,38 @@ +--- jdk/src/solaris/bin/java_md_solinux.c ++++ jdk/src/solaris/bin/java_md_solinux.c +@@ -899,8 +899,9 @@ + * onwards the filename returned in DL_info structure from dladdr is + * an absolute pathname so technically realpath isn't required. + * On Linux we read the executable name from /proc/self/exe. +- * As a fallback, and for platforms other than Solaris and Linux, +- * we use FindExecName to compute the executable name. ++ * On FreeBSD we read the executable name from /proc/curproc/file. ++ * As a fallback, and for platforms other than Solaris, Linux, and ++ * FreeBSD, we use FindExecName to compute the executable name. + */ + const char* + SetExecname(char **argv) +@@ -927,9 +928,13 @@ + } + } + } +-#elif defined(__linux__) ++#elif defined(__linux__) || defined(__FreeBSD__) + { ++#if defined(__FreeBSD__) ++ const char* self = "/proc/curproc/file"; ++#else + const char* self = "/proc/self/exe"; ++#endif + char buf[PATH_MAX+1]; + int len = readlink(self, buf, PATH_MAX); + if (len >= 0) { +@@ -937,7 +942,7 @@ + exec_path = JLI_StringDup(buf); + } + } +-#else /* !__solaris__ && !__linux__ */ ++#else /* !__solaris__ && !__linux__ && !__FreeBSD__ */ + { + /* Not implemented */ + } diff --git a/java/openjdk7/files/patch-src-solaris-classes-sun-print-UnixPrintServiceLookup.java b/java/openjdk7/files/patch-src-solaris-classes-sun-print-UnixPrintServiceLookup.java new file mode 100644 index 000000000000..b2731645906d --- /dev/null +++ b/java/openjdk7/files/patch-src-solaris-classes-sun-print-UnixPrintServiceLookup.java @@ -0,0 +1,17 @@ +--- jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java ++++ jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java +@@ -140,12 +140,12 @@ + static int cmdIndex = UNINITIALIZED; + + String[] lpcFirstCom = { +- "/usr/sbin/lpc status | grep : | sed -ne '1,1 s/://p'", ++ "/usr/sbin/lpc status all | grep ':$' | sed -ne '1,1 s/://p'", + "/usr/sbin/lpc status | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}'" + }; + + String[] lpcAllCom = { +- "/usr/sbin/lpc status all | grep : | sed -e 's/://'", ++ "/usr/sbin/lpc status all | grep ':$' | sed -e 's/://'", + "/usr/sbin/lpc status all | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}' | sort" + }; + |