openhab / openhab-core

Core framework of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
932 stars 429 forks source link

Failed to save history warning is unnecessarily large #4456

Open spacemanspiff2007 opened 1 week ago

spacemanspiff2007 commented 1 week ago

When running openHAB with a user that has no home directory entering a command in the openHAB console produces a large warning:

2024-11-18 06:06:07.307 [WARN ] [org.jline                           ] - Failed to save history
java.nio.file.AccessDeniedException: /home/openhab
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?]
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) ~[?:?]
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
        at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:397) ~[?:?]
        at java.nio.file.Files.createDirectory(Files.java:700) ~[?:?]
        at java.nio.file.Files.createAndCheckIsDirectory(Files.java:807) ~[?:?]
        at java.nio.file.Files.createDirectories(Files.java:793) ~[?:?]
        at org.jline.reader.impl.history.DefaultHistory.internalWrite(DefaultHistory.java:227) ~[bundleFile:?]
        at org.jline.reader.impl.history.DefaultHistory.save(DefaultHistory.java:219) ~[bundleFile:?]
        at org.jline.reader.impl.history.DefaultHistory.add(DefaultHistory.java:384) [bundleFile:?]
        at org.jline.reader.impl.LineReaderImpl.finish(LineReaderImpl.java:1140) [bundleFile:?]
        at org.jline.reader.impl.LineReaderImpl.finishBuffer(LineReaderImpl.java:1109) [bundleFile:?]
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:689) [bundleFile:?]
        at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.readCommand(ConsoleSessionImpl.java:447) [bundleFile:4.4.6]
        at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:405) [bundleFile:4.4.6]
        at java.lang.Thread.run(Thread.java:833) [?:?]

Entering a couple commands fills up the log file very quick.

Expected Behavior

Should only print one line

Failed to save history in /home/openhab: java.nio.file.AccessDeniedException

or an even better error message

Steps to Reproduce (for Bugs)

  1. create user without home directory
  2. run openhab with said user
  3. enter a command in the karaf console

Your Environment

rkoshak commented 1 week ago

https://www.mail-archive.com/issues@karaf.apache.org/msg58309.html

This log statement appears to be the least of the issues. But it also appears top be something that needs to be fixed upstream and not here.