The following commit has been merged in the master branch:
commit 2181dba7727eee8df206f43c65ee40eb7a00bfc4
Author: Scott Howard <[email protected]>
Date:   Sat Jun 2 10:17:55 2012 -0400

    mark threads and daemon and fix buffer overflow from locked serial device

diff --git a/debian/changelog b/debian/changelog
index 20dd558..86ec405 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+rxtx (2.2pre2-11) unstable; urgency=low
+
+  * debian/patches/MonitorThread-daemon.patch
+    - Mark threads created by RXTX as daemon so JVM can shut down
+      gracefully. Thanks to Christopher Wellons (Closes: #674975)
+  * debian/patches/fhs_lock_buffer_overflow_fix.patch 
+    - Prevents java from failing with buffer overflow when a locked serial
+      debice is opened. Thanks to Sergio Talens-Oliag (Closes: #673778)
+
+ -- Scott Howard <[email protected]>  Sat, 02 Jun 2012 10:13:50 -0400
+
 rxtx (2.2pre2-10) unstable; urgency=low
 
   * debian/patches/multiple_property_dirs.patch
diff --git a/debian/patches/MonitorThread-daemon.patch 
b/debian/patches/MonitorThread-daemon.patch
new file mode 100644
index 0000000..79f8f2d
--- /dev/null
+++ b/debian/patches/MonitorThread-daemon.patch
@@ -0,0 +1,65 @@
+Desciption: Threads created in Java by RXTX are not marked as daemon.
+Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=674975
+Author: Christopher Wellons <[email protected]>
+--- a/src/gnu/io/I2C.java
++++ b/src/gnu/io/I2C.java
+@@ -468,7 +468,9 @@
+               private boolean BI=false;
+               private boolean Data=false;
+               private boolean Output=false;
+-              MonitorThread() { }
++              MonitorThread() {
++                      setDaemon(true);
++              }
+               public void run() {
+                       eventLoop();
+               }
+--- a/src/gnu/io/LPRPort.java
++++ b/src/gnu/io/LPRPort.java
+@@ -366,7 +366,9 @@
+ {
+       private boolean monError = false;
+       private boolean monBuffer = false;
+-              MonitorThread() { }
++              MonitorThread() {
++                      setDaemon(true);
++              }
+               public void run()
+               {
+                       eventLoop();
+--- a/src/gnu/io/RS485.java
++++ b/src/gnu/io/RS485.java
+@@ -465,7 +465,9 @@
+               private boolean BI=false;
+               private boolean Data=false;
+               private boolean Output=false;
+-              MonitorThread() { }
++              MonitorThread() {
++                      setDaemon(true);
++              }
+               public void run() {
+                       eventLoop();
+               }
+--- a/src/gnu/io/RXTXPort.java
++++ b/src/gnu/io/RXTXPort.java
+@@ -1629,6 +1629,7 @@
+ 
+               MonitorThread() 
+               {
++                      setDaemon(true);
+                       if (debug)
+                               z.reportln( 
"RXTXPort:MontitorThread:MonitorThread()"); 
+               }
+--- a/src/gnu/io/Raw.java
++++ b/src/gnu/io/Raw.java
+@@ -466,7 +466,9 @@
+               private boolean BI=false;
+               private boolean Data=false;
+               private boolean Output=false;
+-              MonitorThread() { }
++              MonitorThread() {
++                      setDaemon(true);
++              }
+               public void run() {
+                       eventLoop();
+               }
diff --git a/debian/patches/fhs_lock_buffer_overflow_fix.patch 
b/debian/patches/fhs_lock_buffer_overflow_fix.patch
new file mode 100644
index 0000000..ce54054
--- /dev/null
+++ b/debian/patches/fhs_lock_buffer_overflow_fix.patch
@@ -0,0 +1,65 @@
+Description: Java fails with a buffer overflow when there's a locked serial
+device, see http://mailman.qbang.org/pipermail/rxtx/2009-May/10897125.html.
+Author: Sergio Talens-Oliag <[email protected]>
+
+Index: rxtx-2.2pre2/CNI/SerialImp.c
+===================================================================
+--- rxtx-2.2pre2.orig/CNI/SerialImp.c  2012-05-21 13:13:43.000000000 +0200
++++ rxtx-2.2pre2/CNI/SerialImp.c       2012-05-21 13:24:05.876652630 +0200
+@@ -4752,7 +4752,7 @@
+       fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 );
+       if( fd < 0 )
+       {
+-              sprintf( message,
++              snprintf( message, 79,
+                       "RXTX fhs_lock() Error: creating lock file: %s: %s\n",
+                       file, strerror(errno) );
+               report_error( message );
+Index: rxtx-2.2pre2/src/SerialImp.c
+===================================================================
+--- rxtx-2.2pre2.orig/src/SerialImp.c  2012-05-21 13:13:43.000000000 +0200
++++ rxtx-2.2pre2/src/SerialImp.c       2012-05-21 13:26:50.184644233 +0200
+@@ -5307,7 +5307,7 @@
+       }
+       if ( dev_lock( filename ) )
+       {
+-              sprintf( message,
++              snprintf( message, 79,
+                       "RXTX fhs_lock() Error: creating lock file for: %s: 
%s\n",
+                       filename, strerror(errno) );
+               report_error( message );
+@@ -5367,7 +5367,7 @@
+       fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 );
+       if( fd < 0 )
+       {
+-              sprintf( message,
++              snprintf( message, 79,
+                       "RXTX fhs_lock() Error: creating lock file: %s: %s\n",
+                       file, strerror(errno) );
+               report_error( message );
+Index: rxtx-2.2pre2/src/lfd/lockdaemon.c
+===================================================================
+--- rxtx-2.2pre2.orig/src/lfd/lockdaemon.c     2007-04-26 07:26:07.000000000 
+0200
++++ rxtx-2.2pre2/src/lfd/lockdaemon.c  2012-05-21 13:25:35.396648055 +0200
+@@ -145,7 +145,7 @@
+       fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 );
+       if( fd < 0 )
+       {
+-              sprintf( message,
++              snprintf( message, 79,
+                       "RXTX fhs_lock() Error: creating lock file: %s: %s\n",
+                       file, strerror(errno) );
+               syslog( LOG_INFO, message );
+Index: rxtx-2.2pre2/src/lfd/lockdaemon.c.noinetd
+===================================================================
+--- rxtx-2.2pre2.orig/src/lfd/lockdaemon.c.noinetd     2007-04-26 
07:26:07.000000000 +0200
++++ rxtx-2.2pre2/src/lfd/lockdaemon.c.noinetd  2012-05-21 13:25:55.748647017 
+0200
+@@ -144,7 +144,7 @@
+       fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 );
+       if( fd < 0 )
+       {
+-              sprintf( message,
++              snprintf( message, 79,
+                       "RXTX fhs_lock() Error: creating lock file: %s: %s\n",
+                       file, strerror(errno) );
+               syslog( LOG_INFO, message );
diff --git a/debian/patches/series b/debian/patches/series
index a3939a6..bca8f83 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,5 @@ sys_io_h_check.patch
 port_to_hurd.patch
 multiple_property_dirs.patch
 uninstall_target.patch
+fhs_lock_buffer_overflow_fix.patch
+MonitorThread-daemon.patch

-- 
Packaging for rxtx

_______________________________________________
pkg-java-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to