Bug 200179 - comms/rxtx: fix multiple issues
Summary: comms/rxtx: fix multiple issues
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Philip M. Gollucci
URL:
Keywords:
Depends on:
Blocks: 196892
  Show dependency treegraph
 
Reported: 2015-05-13 20:07 UTC by James Elstone
Modified: 2016-01-16 15:39 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (mirror176)


Attachments
Update to RXTX resolving all noticed issues with devel/arduino port. (369.53 KB, patch)
2015-05-13 20:55 UTC, James Elstone
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Elstone 2015-05-13 20:07:41 UTC
There are a number of issues in RXTX that is effecting the arduino port which is dependant on RXTX.

These are:
- Missing dependancy (library)
- SIGABRT being issued to the process when serial port is closed
- Null pointer exception on port enumeration, leading to JRE core dump
- Serial ports being twice on RXTX being involked by a single command from a parent java base
- attempting to use uucp on /dev/lpt/
- debug stream from RXTX becoming corrupt (garbaged) on the second enumeration in the same JRE instance.
- Not scanning the correct ports for FreeBSD
Comment 1 James Elstone 2015-05-13 20:55:59 UTC
Created attachment 156759 [details]
Update to RXTX resolving all noticed issues with devel/arduino port.

A number of fixes and changes...

Makefile
1) Missing dependancy on plibthread.so.1


Java code base
2) Added commandline debug output in multiple Java files

3) Tided comment statements, tabulation and white space to aid reading of sections of the original source code

4) Added additional debug statements to aid diagnosis in multiple Java files

5) Moved error logging from Zystem to be local in the RXTXPort.java file (was never firing from Zystem); now common with rest of codebase

6) Ensured that RXTX only outputs debug level information when requested.

7) Only enumerate the local ports on initialisation once (use of init_clean), rather than three times.

8) Updated ports lists to reflect current usage pre FreeBSD v10 and post v10.

9) Debug identifier inserted before all calls

10) correctly read the properties file when there are multiple java library paths

11) Enabled the skipping of parrellel ports during scans where they are not used by the invoking java parent base to RXTX (Still allows them to be manually specified in gn.io.parellel env arg)

SerialImp.c
12) Tidied code indentation (where needed, it is a medium length file and doesn't provide benifit on areas that work)

13) Added standard out debug support to allow for assessment of interaction with Java code that can be compiled in (DEBUG_STDOUT)

14) Added entry and exist debug statement for key functions

15) where sprintf is being used, ensure that the existing ptr refers to an empty string (uses memset to sizeof)

16) cleared up display tabulation of function headers in entire file (on second enumeration strings contained garbage)

17) Remove LEAVE and ENTRY functions as not working as expected in header.

18) Made sure all debug statements are null pointer terminated (note sprintf is not solely used for debug message formatting)

19) Added condition so that a port that is in use during testread() is still reported as selectable. (If you attempt to open it after the port scan and it is still EBUSY the behaviour is unaltered and will throw a suitable error back)

20) Disabled uucp for lpt ports, as uucp only applies to tty on FreeBSD (so says the Handbook...)

21) RXTXPort:interruptEventLoop - resolved SIGABRT call to process (intended to kill off thread not entire JRE)...

22) RXTXPort:interruptEventLoop now waits for timer in child thread to expire before attempting to closing the thread (delay between 0 and 1000000 sleeps)

23) All debug streams for FreeBSD now forward to same function for uniform formatting.

This fixes two downstream issues in the arduino port, which results in missing dependancies, a core dump when uploading, or very slow port enumeration (up to 30s in some cases) when the arduino IDE is first started.
Comment 2 James Elstone 2015-05-13 21:03:16 UTC
Have compiled both devel/arduino and comms/rxtx with these changes, and those specified in:

  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200178
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200177

Both ports compile without issue, and run as expected.

I believe the [devel/arduino] port is now working, with this and the above patches,  on FreeBSD v10.1-p9, with OpenJDK7.
Comment 3 James Elstone 2015-05-13 21:14:01 UTC
These patch files also fix:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=128809
Comment 4 Philip M. Gollucci freebsd_committer freebsd_triage 2015-06-26 20:28:26 UTC
Take.
Comment 5 Philip M. Gollucci freebsd_committer freebsd_triage 2015-06-27 03:37:09 UTC
Maintainer Timeout - 45 days (mirror176@cox.net)
Comment 6 James Elstone 2015-06-27 08:09:49 UTC
Happy to take on maintainer role for this port, if required.
Comment 7 Philip M. Gollucci freebsd_committer freebsd_triage 2015-06-27 19:11:16 UTC
550 5.1.1 <mirror176@cox.net> invalid recipient -

You will now be maintainer James!
Comment 8 commit-hook freebsd_committer freebsd_triage 2015-06-27 19:34:50 UTC
A commit references this bug:

Author: pgollucci
Date: Sat Jun 27 19:34:44 UTC 2015
New revision: 390725
URL: https://svnweb.freebsd.org/changeset/ports/390725

Log:
  comms/rxtx: mutiple fixes
  Makefile
  1) Missing dependancy on plibthread.so.1

  Java code base
  2) Added commandline debug output in multiple Java files

  3) Tided comment statements, tabulation and white space to aid reading
  of sections of the original source code

  4) Added additional debug statements to aid diagnosis in multiple Java
  files

  5) Moved error logging from Zystem to be local in the RXTXPort.java
  file (was never firing from Zystem); now common with rest of codebase

  6) Ensured that RXTX only outputs debug level information when
  requested.

  7) Only enumerate the local ports on initialisation once (use of
  init_clean), rather than three times.

  8) Updated ports lists to reflect current usage pre FreeBSD v10 and post
  v10.

  9) Debug identifier inserted before all calls

  10) correctly read the properties file when there are multiple java
  library paths

  11) Enabled the skipping of parrellel ports during scans where they are
  not used by the invoking java parent base to RXTX (Still allows them to
  be manually specified in gn.io.parellel env arg)

  SerialImp.c
  12) Tidied code indentation (where needed, it is a medium length file
  and doesn't provide benifit on areas that work)

  13) Added standard out debug support to allow for assessment of
  interaction with Java code that can be compiled in (DEBUG_STDOUT)

  14) Added entry and exist debug statement for key functions

  15) where sprintf is being used, ensure that the existing ptr refers to
  an empty string (uses memset to sizeof)

  16) cleared up display tabulation of function headers in entire file (on
  second enumeration strings contained garbage)

  17) Remove LEAVE and ENTRY functions as not working as expected in
  header.

  18) Made sure all debug statements are null pointer terminated (note
  sprintf is not solely used for debug message formatting)

  19) Added condition so that a port that is in use during testread() is
  still reported as selectable. (If you attempt to open it after the port
  scan and it is still EBUSY the behaviour is unaltered and will throw a
  suitable error back)

  20) Disabled uucp for lpt ports, as uucp only applies to tty on
  FreeBSD (so says the Handbook...)

  21) RXTXPort:interruptEventLoop - resolved SIGABRT call to
  process (intended to kill off thread not entire JRE)...

  22) RXTXPort:interruptEventLoop now waits for timer in child thread to
  expire before attempting to closing the thread (delay between 0 and
  1000000 sleeps)

  23) All debug streams for FreeBSD now forward to same function for
  uniform formatting.

  This fixes two downstream issues in the arduino port, which results in
  missing dependancies, a core dump when uploading, or very slow port
  enumeration (up to 30s in some cases) when the arduino IDE is first
  started.

  PR:                  200179
  Submitted by:        james@elstone.net
  Approved by:         maintainer timeout (mirror176@cox.net ; 45 days)

Changes:
  head/comms/rxtx/Makefile
  head/comms/rxtx/files/patch-src-ParallelImp.c
  head/comms/rxtx/files/patch-src-SerialImp.c
  head/comms/rxtx/files/patch-src-gnu-io-CommPort.java
  head/comms/rxtx/files/patch-src-gnu-io-CommPortEnumerator.java
  head/comms/rxtx/files/patch-src-gnu-io-CommPortIdentifier.java
  head/comms/rxtx/files/patch-src-gnu-io-Configure.java
  head/comms/rxtx/files/patch-src-gnu-io-LPRPort.java
  head/comms/rxtx/files/patch-src-gnu-io-NoSuchPortException.java
  head/comms/rxtx/files/patch-src-gnu-io-RXTXCommDriver.java
  head/comms/rxtx/files/patch-src-gnu-io-RXTXPort.java
  head/comms/rxtx/files/patch-src-gnu-io-SerialPortEvent.java