Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surge in Debian crashes when ~/.Surge does not exist #1713

Closed
wzab opened this issue Apr 13, 2020 · 4 comments · Fixed by #1716
Closed

Surge in Debian crashes when ~/.Surge does not exist #1713

wzab opened this issue Apr 13, 2020 · 4 comments · Fixed by #1716
Labels
Linux Issues which only occur on Linux Skinning Engine Issues related to Surge's skin engine

Comments

@wzab
Copy link

wzab commented Apr 13, 2020

Describe the bug
When I try to download Surge int Qtractor, or when I try to open it's GUI in Carla, it craches the LV2 host.
In Qtractor I was able to conenct the gdb and track down the error:
It appears that the bug is triggered by not existing ~/.Surge directory. Whe I created it myself, the GUI started to load correctly.
Below is the output from gdb:

Thread 1 "qtractor" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007f206e9fa55b in __GI_abort () at abort.c:79
#2 0x00007f206ed9180c in () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007f206ed9c8f6 in () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007f206ed9c961 in () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007f206ed9cbf5 in () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007f20170d4611 in std::experimental::filesystem::v1::__cxx11::directory_iterator::directory_iterator(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::directory_options, std::error_code*) [clone .cold] () at /home/wzab/.lv2/Surge.lv2/Surge-Debug.so
#7 0x00007f20171685fc in std::experimental::filesystem::v1::__cxx11::directory_iterator::directory_iterator(std::experimental::filesystem::v1::__cxx11::path const&) (this=0x7ffefed337c0, __p=filesystem::path "/home/wzab/.Surge" = {...})
at /usr/include/c++/9/experimental/bits/fs_dir.h:188
#8 0x00007f2017161833 in Surge::UI::SkinDB::rescanForSkins(SurgeStorage*)
(this=0x7f20176bf720 Surge::UI::SkinDB::get(SurgeStorage*)::instance, storage=0x55aa9e739bf0) at src/common/gui/SkinSupport.cpp:102
#9 0x00007f20171610d7 in Surge::UI::SkinDB::SkinDB(SurgeStorage*)
(this=0x7f20176bf720 Surge::UI::SkinDB::get(SurgeStorage*)::instance, s=0x55aa9e739bf0) at src/common/gui/SkinSupport.cpp:42
#10 0x00007f2017160fab in Surge::UI::SkinDB::get(SurgeStorage*)
(s=0x55aa9e739bf0) at src/common/gui/SkinSupport.cpp:32
#11 0x00007f2017180d0e in SurgeGUIEditor::SurgeGUIEditor(void*, SurgeSynthesizer--Type for more, q to quit, c to continue without paging--
, void) (this=0x55aa9b9df7f0, effect=0x55aa9e631770, synth=
0x55aa9e7399c0, userdata=0x55aa9f14a3b0)
at src/common/gui/SurgeGUIEditor.cpp:306
#12 0x00007f20171b2cee in SurgeLv2Ui::SurgeLv2Ui(SurgeLv2Wrapper*, void*, _LV2_URID_Map const*, _LV2UI_Resize const*, void ()(void, unsigned int, unsigned int, unsigned int, void const*), void*)
(this=0x55aa9f14a3b0, instance=0x55aa9e631770, parentWindow=0x4200144, uridMapper=0x55aa9854f1c0, uiResizer=0x55aa9e554080, writeFn=0x55aa98242e50, controller=0x55aa9e62a050) at src/lv2/SurgeLv2Ui.cpp:16
#13 0x00007f20171b3090 in SurgeLv2Ui::instantiate(_LV2UI_Descriptor const*, char const*, char const*, void ()(void, unsigned int, unsigned int, unsigned int, void const*), void*, void**, _LV2_Feature const* const*)
(descriptor=0x7f20176bfa00 <lv2ui_descriptor::desc>, plugin_uri=0x55aa9ace5d10 "https://surge-synthesizer.github.io/lv2/surge", bundle_path=0x55aa9f18bfe0 "/home/wzab/.lv2/Surge.lv2/", write_function=0x55aa98242e50, controller=0x55aa9e62a050, widget=0x55aa9f14bf80, features=0x55aa9f1456f0)
at src/lv2/SurgeLv2Ui.cpp:81
#14 0x00007f207062fc19 in suil_instance_new ()

Please let us know your surge version

  • Surge Version:
    Surge was compiled from commit a7108f2
  • Plugin type (VST2, 3 or AU)
    LV2
  • Bits (32/64)
    64

To Reproduce
Steps to reproduce the behavior:

  1. Make sure that ~/.Surge does not exist
  2. Compile Surge with "./build-linux.sh install -d --project=lv2 --local"
  3. Start Qtractor
  4. If you want to get debugger output, start "gdb qtractor pidof qtractor", and resume the execution with "c"
  5. In Qtractor add the track, select MIDI, select tab Plugins, press the button Add, select LV2 plugins, select Surge, press OK
  6. Ready, the Qtractor is crashed, you may see the quoted stack frames in the gdb console.

Expected behavior
The directory should be silently created?
Desktop (please complete the following information):

  • OS: Debian/testing
  • Host Qtractor (but the same happens to Carla, which is however harder to debug)
  • Version 0.9.13
@baconpaul
Copy link
Collaborator

Thanks
The right behavior is to fail gracefully when it's not there. In the preset scanning we do that, but in the skin engine we don't - the skin engine is still super early on.
If you want to use surge to make music, I suggest using 1.6.6 but if you want it for dev right now there will be some bugs at the top of master.
Appreciate the report.

(I'm surprised, by the way, that your version of std::experimental::filesystem::directory_iterator throws! That's pretty anti-social of it! But the fix I bet is to wrap a try/catch around the fs::directory_iterator loop at line 102 of SkinSupport.cpp. If you want to test that great! If not I can do it when I'm in the code next).

@baconpaul baconpaul added Linux Issues which only occur on Linux Skinning Engine Issues related to Surge's skin engine labels Apr 13, 2020
@baconpaul
Copy link
Collaborator

btw this isn't a debian / qtractor problem. I was able to reproduce it in ubuntu/reaper just now with the vst2.

@baconpaul
Copy link
Collaborator

I'll apply this patch along with the other linux changes I have going in the next day or two. But if you want to get going before then, here's the diff

diff --git a/src/common/gui/SkinSupport.cpp b/src/common/gui/SkinSupport.cpp
index 3304516..ba67578 100644
--- a/src/common/gui/SkinSupport.cpp
+++ b/src/common/gui/SkinSupport.cpp
@@ -99,12 +99,15 @@ void SkinDB::rescanForSkins(SurgeStorage* storage)
       {
          auto top = workStack.front();
          workStack.pop_front();
-         for (auto& d : fs::directory_iterator(top))
+         if( fs::is_directory(top) )
          {
-            if (fs::is_directory(d))
+            for (auto& d : fs::directory_iterator(top))
             {
-               alldirs.push_back(d);
-               workStack.push_back(d);
+               if (fs::is_directory(d))
+               {
+                  alldirs.push_back(d);
+                  workStack.push_back(d);
+               }
             }
          }
       }

@baconpaul
Copy link
Collaborator

OK I just merged that fix. If you try head again you should be good to go
Also if you try head on linux, you should no longer require the installation of premake5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linux Issues which only occur on Linux Skinning Engine Issues related to Surge's skin engine
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants