diff mbox

libjava: fix locale handling when sorting JNI methods

Message ID 1445572588-7949-1-git-send-email-vapier@gentoo.org
State New
Headers show

Commit Message

Mike Frysinger Oct. 23, 2015, 3:56 a.m. UTC
When building under LANG=cs_CZ.UTF-8, the JNI method check fails:

/bin/bash ../../scripts/check_jni_methods.sh
Found a problem with the JNI methods declared and implemented.
(<) missing in implementation, (>) missing in header files
> Java_gnu_java_awt_peer_gtk_GtkClipboard_advertiseContent
> Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState
... lots more ...

While the sed commands are run under LC_ALL=C, the two sort commands are
not, and they end up producing unexpected output (for the test).  Once we
run both under LC_ALL=C, the check passes.  While we're here, we can also
combine latter the `sort|uniq` into `sort -u` to match the earlier code.

URL: https://bugs.gentoo.org/563710
Reported-by: Miroslav Šulc <fordfrog@gentoo.org>

2015-10-22  Mike Frysinger  <vapier@gentoo.org>

	* scripts/check_jni_methods.sh.in: Run sort with LC_ALL=C, and
	combine `sort|uniq` into `sort -u`.
---
 libjava/classpath/scripts/check_jni_methods.sh.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andrew Haley Oct. 26, 2015, 10:10 a.m. UTC | #1
On 23/10/15 04:56, Mike Frysinger wrote:
> 2015-10-22  Mike Frysinger  <vapier@gentoo.org>
> 
> 	* scripts/check_jni_methods.sh.in: Run sort with LC_ALL=C, and
> 	combine `sort|uniq` into `sort -u`.

Looks OK to me.

Andrew.
Tom Tromey Oct. 26, 2015, 6:10 p.m. UTC | #2
Mike> URL: https://bugs.gentoo.org/563710
Mike> Reported-by: Miroslav Šulc <fordfrog@gentoo.org>

Mike> 2015-10-22  Mike Frysinger  <vapier@gentoo.org>

Mike> 	* scripts/check_jni_methods.sh.in: Run sort with LC_ALL=C, and
Mike> 	combine `sort|uniq` into `sort -u`.
Mike> ---
Mike>  libjava/classpath/scripts/check_jni_methods.sh.in | 4 ++--

Just FYI - Classpath changes should also go upstream.

Tom
Mike Frysinger Oct. 26, 2015, 6:32 p.m. UTC | #3
On 26 Oct 2015 12:10, Tom Tromey wrote:
> Mike> URL: https://bugs.gentoo.org/563710
> Mike> Reported-by: Miroslav Šulc <fordfrog@gentoo.org>
> 
> Mike> 2015-10-22  Mike Frysinger  <vapier@gentoo.org>
> 
> Mike> 	* scripts/check_jni_methods.sh.in: Run sort with LC_ALL=C, and
> Mike> 	combine `sort|uniq` into `sort -u`.
> Mike> ---
> Mike>  libjava/classpath/scripts/check_jni_methods.sh.in | 4 ++--
> 
> Just FYI - Classpath changes should also go upstream.

i sent it to Andrew & cc-ed their patches list independently now
-mike
diff mbox

Patch

diff --git a/libjava/classpath/scripts/check_jni_methods.sh.in b/libjava/classpath/scripts/check_jni_methods.sh.in
index facf34b..18834f2 100644
--- a/libjava/classpath/scripts/check_jni_methods.sh.in
+++ b/libjava/classpath/scripts/check_jni_methods.sh.in
@@ -14,7 +14,7 @@  grep -h '^JNIEXPORT .* Java_' @abs_top_srcdir@/include/*.h | \
         LC_ALL=C sed -e 's,.*JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' > $TMPFILE
 grep -h '^JNIEXPORT .* Java_' @abs_top_builddir@/include/*.h | \
         LC_ALL=C sed -e 's,.*JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' >> $TMPFILE
-sort -u $TMPFILE > $TMPFILE4
+LC_ALL=C sort -u $TMPFILE > $TMPFILE4
 mv $TMPFILE4 $TMPFILE
 
 # Find all methods in the JNI C source files.
@@ -31,7 +31,7 @@  find @abs_top_srcdir@/native/jni -name \*.cpp | \
 	cut -f4 -d\  | \
         LC_ALL=C sed -e 's,^\JNIEXPORT .* JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' >> $TMPFILE2
 mv $TMPFILE2 $TMPFILE3
-sort $TMPFILE3 | uniq > $TMPFILE2
+LC_ALL=C sort $TMPFILE3 > $TMPFILE2
 rm $TMPFILE3
 
 # Write temporary ignore file.