Fazecast / jSerialComm

Platform-independent serial port access for Java
GNU Lesser General Public License v3.0
1.34k stars 287 forks source link

tmp Directory Creation #486

Closed Jedimaster4559 closed 1 year ago

Jedimaster4559 commented 1 year ago

Overview

When running on Linux, jSerialComm creates a temporary directory: /tmp/jSerialComm. This directory is created with permissions for the user and group running the process using the jSerialComm library. If another process running on a different user or group attempts to use the jSerialComm library and /tmp/jSerialComm still exists under the previous user/group, jSerialComm will throw an exception. This usually looks like an java.lang.UnsatisfiedLinkError

Short Term Fix

I was able to fix this issue by manually deleting the /tmp/jSerialComm directory before running the process as a different user.

NorbertSandor commented 1 year ago

Please see beginning of the documentation: https://github.com/Fazecast/jSerialComm#usage

If you intend to use the library in multiple applications simultaneously, please make sure to set the fazecast.jSerialComm.appid property before accessing the SerialPort class so that applications don't accidentally delete each others' temporary files during boot-up:

System.setProperty("fazecast.jSerialComm.appid", "YOUR_APPLICATION_IDENTIFIER")

pischky commented 1 year ago

Hallo,

An "app.id" would not help if you try to run the same application in multiple instances (my be with diffrenet users).

I would suggest to include the process id (pid) in the directory name.

Martin

NorbertSandor commented 1 year ago

You can set any app ID you want, you can include in it the current user's name, the application's PID, the current timestamp, ... - anything that fits your requirements.

hedgecrw commented 1 year ago

Yes, closing this issue, as @NorbertSandor's suggestions are spot on. Thanks!