From nobody@FreeBSD.org  Sun May 18 02:58:38 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id BB983820
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 18 May 2014 02:58:38 +0000 (UTC)
Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client did not present a certificate)
	by mx1.freebsd.org (Postfix) with ESMTPS id A7E342035
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 18 May 2014 02:58:38 +0000 (UTC)
Received: from cgiserv.freebsd.org ([127.0.1.6])
	by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s4I2wc3v078423
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 18 May 2014 02:58:38 GMT
	(envelope-from nobody@cgiserv.freebsd.org)
Received: (from nobody@localhost)
	by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s4I2wcik078422;
	Sun, 18 May 2014 02:58:38 GMT
	(envelope-from nobody)
Message-Id: <201405180258.s4I2wcik078422@cgiserv.freebsd.org>
Date: Sun, 18 May 2014 02:58:38 GMT
From: Kevin Zheng <kevinz5000@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: java/icedtea-web cannot launch system settings
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         189905
>Category:       ports
>Synopsis:       java/icedtea-web cannot launch system settings
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-java
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 18 03:00:00 UTC 2014
>Closed-Date:    Wed May 21 20:18:56 UTC 2014
>Last-Modified:  Wed May 21 20:18:56 UTC 2014
>Originator:     Kevin Zheng
>Release:        10.0-RELEASE-p3
>Organization:
>Environment:
FreeBSD epsilon.local 10.0-RELEASE-p3 FreeBSD 10.0-RELEASE-p3 #0: Tue May 13 18:31:10 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
IcedTea installs a setting and policy editor. These can be run through the installed desktop icon or from the command line by invoking 'itweb-settings' and 'itweb-policyeditor'. Unfortunately, neither work:

[kevinz@epsilon ~]$ itweb-settings 
Your custom JRE /usr/local/openjdk7 read from deployment.properties under key deployment.jre.dir as /usr/local/openjdk7 is not valid. Using default (/usr/local/openjdk7/jre/bin/java, /usr/local/openjdk7/jre/lib/rt.jar) in attempt to start. Please fix this.
Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.

[kevinz@epsilon ~]$ itweb-policyeditor 
Your custom JRE /usr/local/openjdk7 read from deployment.properties under key deployment.jre.dir as /usr/local/openjdk7 is not valid. Using default (/usr/local/openjdk7/jre/bin/java, /usr/local/openjdk7/jre/lib/rt.jar) in attempt to start. Please fix this.
Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.

Java runs fine, and so does the policy editor when invoked through a browser. I suspect something is wrong with the script that launches the application.

The settings editor worked in previous versions of the FreeBSD port of IcedTea. I cannot recall which version, though.
>How-To-Repeat:
Run 'itweb-settings' and 'itweb-policyeditor' from the command line, or through the provided desktop icons.
>Fix:


>Release-Note:
>Audit-Trail:

From: Jung-uk Kim <jkim@FreeBSD.org>
To: bug-followup@FreeBSD.org, kevinz5000@gmail.com
Cc:  
Subject: Re: ports/189905: java/icedtea-web cannot launch system settings
Date: Mon, 19 May 2014 16:06:10 -0400

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Actually, it is a well-known problem.  The culprit is in
 java/openjdk7, not in java/icedtea-web.  Please drop the following
 file under java/openjdk7/files directory, rebuild the port, and try again.
 
 https://svn.redports.org/jkim/java/openjdk7/files/patch-src-solaris-bin-java_md_solinux.c
 
 BTW, you have an incorrect configuration, i.e., deployment.jre.dir in
 deployment.properties should have a JRE path, not JDK path.  In other
 words, it had to be set to /usr/local/openjdk7/jre.
 
 Jung-uk Kim
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (FreeBSD)
 
 iQEcBAEBAgAGBQJTemQyAAoJEHyflib82/FGDaEH+QGhR/INp+ALgqUgXcEHgfwL
 orm546rvXo/jNICVhW0VzcoLTeiZfIrOyciYCKgXxYoAddrp42JvybzdX6a47CdX
 rUeDMAYBq/BIsYUTcaOm1OZNhr67K0j+wH/BC+IX38+t1lEsmindRMIyaHZFSAUK
 NgYRgpUj7lg8gYYoomGJUSeUhD6TyCgMWJkbNNw6dM6OgC2+sXuxZXRyefi3UZgc
 7fI0RY8F2aFJCnfmeCiVp/7jx4CIUUutwl7EquhPcybq5mFI+FeW2YtY0wDbwl50
 SkYWykDNDIW4ikbct7BIB+bXTFW2brc9oc8Juuyt2gjlvVYj0sXLGzVsU2Ziy2Q=
 =Bsr/
 -----END PGP SIGNATURE-----

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/189905: commit references a PR
Date: Wed, 21 May 2014 20:03:19 +0000 (UTC)

 Author: jkim
 Date: Wed May 21 20:03:14 2014
 New Revision: 354761
 URL: http://svnweb.freebsd.org/changeset/ports/354761
 QAT: https://qat.redports.org/buildarchive/r354761/
 
 Log:
   - 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]
 
 Added:
   head/java/openjdk7/files/patch-src-share-classes-sun-print-PSPrinterJob.java   (contents, props changed)
   head/java/openjdk7/files/patch-src-solaris-bin-java_md_solinux.c   (contents, props changed)
   head/java/openjdk7/files/patch-src-solaris-classes-sun-print-UnixPrintServiceLookup.java   (contents, props changed)
 Modified:
   head/java/openjdk7/Makefile
 
 Modified: head/java/openjdk7/Makefile
 ==============================================================================
 --- head/java/openjdk7/Makefile	Wed May 21 19:58:46 2014	(r354760)
 +++ head/java/openjdk7/Makefile	Wed May 21 20:03:14 2014	(r354761)
 @@ -3,7 +3,7 @@
  
  PORTNAME=	openjdk
  PORTVERSION=	${JDK_MAJOR_VERSION}.${PORT_MINOR_VERSION}.${PORT_BUILD_NUMBER}
 -PORTREVISION=	4
 +PORTREVISION=	5
  PORTEPOCH=	1
  CATEGORIES=	java devel
  MASTER_SITES=	http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}u${JDK_MINOR_VERSION}/promoted/b${JDK_BUILD_NUMBER}/ \
 @@ -130,7 +130,8 @@ MAKE_ENV+=	EXTRA_CFLAGS=-DLIBICONV_PLUG
  
  post-patch:
  	@${REINPLACE_CMD} "s|%%LOCALBASE%%|${LOCALBASE}|" \
 -		${WRKSRC}/hotspot/src/os/bsd/vm/os_bsd.cpp
 +		${WRKSRC}/hotspot/src/os/bsd/vm/os_bsd.cpp \
 +		${WRKSRC}/jdk/src/share/classes/sun/print/PSPrinterJob.java
  .if empty(ICONV_LIB)
  	@${REINPLACE_CMD} 's| -liconv||' \
  		${WRKSRC}/Makefile \
 
 Added: head/java/openjdk7/files/patch-src-share-classes-sun-print-PSPrinterJob.java
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/java/openjdk7/files/patch-src-share-classes-sun-print-PSPrinterJob.java	Wed May 21 20:03:14 2014	(r354761)
 @@ -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;
 +             }
 
 Added: head/java/openjdk7/files/patch-src-solaris-bin-java_md_solinux.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/java/openjdk7/files/patch-src-solaris-bin-java_md_solinux.c	Wed May 21 20:03:14 2014	(r354761)
 @@ -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 */
 +     }
 
 Added: head/java/openjdk7/files/patch-src-solaris-classes-sun-print-UnixPrintServiceLookup.java
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/java/openjdk7/files/patch-src-solaris-classes-sun-print-UnixPrintServiceLookup.java	Wed May 21 20:03:14 2014	(r354761)
 @@ -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"
 +     };
 + 
 _______________________________________________
 svn-ports-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-ports-all
 To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: jkim 
State-Changed-When: Wed May 21 20:17:38 UTC 2014 
State-Changed-Why:  
The patch was committed with r354761.  Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=189905 
>Unformatted:
