Hello Will,
the topic of default/user configuration and startup was something I always found
quite confusing and annoying. I just didn't seem to "get" it. Today I took the
time to investigate it more thoroughly. What I found out, surprised me: yoshimi
seems "randomly to forget" my setup and configuration. In part, this was covered
up, since I basically always start from a Jack session, which injects the most
relevant parts.
The resolution of that seeming mystery was quite obvious, once I stepped through
the startup with the Debugger: My home directory is a symlink, and thus Yoshimi
does not recognise it as directory. With the bad consequence, that it installs
all its configuration under /tmp/.config/yoshimi
And since I tend just to hibernate my computer quite often, this config is
kind-of "semi persistent". But after a real reboot, it is gone.
Well, I guess, using a symlink for the home directory itself is maybe not so
common, but there is no reason why it should not work. It is more common to
have /home on a separate partition alltogether.
Or is there any other reason, why the MiscFuncs::isDirectory(string) function
uses lstat() instead of stat() ?
On that occasion, I also noted a minor clean-up in Config.cpp
See the attached patches
Cheers,
Hermann
From 4f603f04c003d41d9dd8daaea19e5caa1715b5c6 Mon Sep 17 00:00:00 2001
From: Ichthyostega <prg@xxxxxxxxxxxxxxx>
Date: Sun, 27 May 2018 16:57:22 +0200
Subject: [PATCH 1/2] Bugfix: treat symlinks properly
isDirectory() fails when target is a symlik which points to a directory.
This has especially dire consequences when the user's home directory
is a symlink, because Yoshimi then plants its configuration into
/tmp/.config/yoshimi where it is not actually persistent.
---
src/Misc/MiscFuncs.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Misc/MiscFuncs.cpp b/src/Misc/MiscFuncs.cpp
index 64864166..d9e02687 100644
--- a/src/Misc/MiscFuncs.cpp
+++ b/src/Misc/MiscFuncs.cpp
@@ -198,7 +198,7 @@ bool MiscFuncs::isRegFile(string chkpath)
bool MiscFuncs::isDirectory(string chkpath)
{
struct stat st;
- if (!lstat(chkpath.c_str(), &st))
+ if (!stat(chkpath.c_str(), &st))
if (S_ISDIR(st.st_mode))
return true;
return false;
--
2.11.0
From 6cd2908a512bedc75e1c2fbd8b7aadc632a73b4d Mon Sep 17 00:00:00 2001
From: Ichthyostega <prg@xxxxxxxxxxxxxxx>
Date: Sun, 27 May 2018 17:00:02 +0200
Subject: [PATCH 2/2] minor cleanup
"for some reason" -- well you can't concatenate two plain C-Strings.
Only C++ string objects offer a operator+
---
src/Misc/Config.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/Misc/Config.cpp b/src/Misc/Config.cpp
index 15ffa586..82da097f 100644
--- a/src/Misc/Config.cpp
+++ b/src/Misc/Config.cpp
@@ -428,8 +428,7 @@ bool Config::loadConfig(void)
return false;
}
}
- string yoshimi = "/"; // for some reason it doesn't
- yoshimi += YOSHIMI; // like these as one line here
+ string yoshimi = "/" + string(YOSHIMI);
if (synth->getUniqueId() > 0)
yoshimi += ("-" + asString(synth->getUniqueId()));
--
2.11.0