-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Invoking prusa-slicer from $PATH environment variable crashes #5542
Comments
If the binary name is resolve from the shell $PATH environment variable, this previously failed and crashed with an exception. This change does some more effort to attempt trying to find the correct path in that case. This fixes prusa3d#5542 Signed-off-by: Henner Zeller <h.zeller@acm.org>
Thanks, I managed to reproduce it on Ubuntu 16.04. Related to #4973. My attempt to fix it was --- a/src/PrusaSlicer.cpp
+++ b/src/PrusaSlicer.cpp
@@ -28,6 +28,7 @@
#include <boost/nowide/cenv.hpp>
#include <boost/nowide/iostream.hpp>
#include <boost/nowide/integration/filesystem.hpp>
+#include <boost/dll/runtime_symbol_info.hpp>
#include "unix/fhs.hpp" // Generated by CMake from ../platform/unix/fhs.hpp.in
@@ -598,7 +599,7 @@ bool CLI::setup(int argc, char **argv)
}
}
- boost::filesystem::path path_to_binary = boost::filesystem::system_complete(argv[0]);
+ boost::filesystem::path path_to_binary = boost::dll::program_location();
// Path from the Slic3r binary to its resources.
#ifdef __APPLE__ And it works on my system. I peeked into boost source and it apparently does the same as you propose in #5543. At least on Linux (there is some OS-specific gymnastics for the other systems as well). Anyone has some experience about how reliable this would be? |
I confirm that this also works on my system. Given that this uses a boost-provided method that is dedicated for this task, I think this is the better solution @lukasmatena than my Linux-specific hack in #5543 . |
Fixed with 293f85b |
Version
PrusaSlicer-2.3.0-beta3+linux-x64-202012121815
Operating system type + version
This is on Linux.
Behavior
Prusa slicer starts up when invoked directly with an absolute or relative path
.. However, when invoked from the environment
$PATH
variable, it crashesNote, how it attempts to assemble the path from the current directory + argv[0] and arrives at
/tmp/prusa-slicer
. Which is of course wrong.The text was updated successfully, but these errors were encountered: