Skip to content

Commit b421cdb

Browse files
committed
fix(packaging): fix glob expansion and missing HOME fallback
Fix glob in px4-gazebo.sh that could match multiple arch directories by using find instead of shell glob. Add /tmp fallback when HOME is unset in main.cpp to avoid writing to filesystem root. Signed-off-by: Ramon Roche <mrpollo@gmail.com>
1 parent ce8e143 commit b421cdb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Tools/packaging/px4-gazebo.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export GZ_SIM_SERVER_CONFIG_PATH="${PX4_GZ_SERVER_CONFIG}"
1818
# to the unversioned libgz-physics-dartsim-plugin.so. The runtime package only
1919
# ships versioned .so files; the unversioned symlink lives in the -dev package.
2020
# Create it if missing so Gazebo finds the DART engine without installing -dev.
21-
GZ_PHYSICS_ENGINE_DIR=$(echo /usr/lib/*/gz-physics-7/engine-plugins)
22-
if [ -d "$GZ_PHYSICS_ENGINE_DIR" ]; then
21+
GZ_PHYSICS_ENGINE_DIR=$(find /usr/lib -maxdepth 3 -type d -name "engine-plugins" -path "*/gz-physics-7/*" 2>/dev/null | head -1)
22+
if [ -n "$GZ_PHYSICS_ENGINE_DIR" ] && [ -d "$GZ_PHYSICS_ENGINE_DIR" ]; then
2323
UNVERSIONED="$GZ_PHYSICS_ENGINE_DIR/libgz-physics-dartsim-plugin.so"
2424
if [ ! -e "$UNVERSIONED" ]; then
2525
VERSIONED=$(ls "$GZ_PHYSICS_ENGINE_DIR"/libgz-physics*-dartsim-plugin.so.* 2>/dev/null | head -1)

platforms/posix/src/px4/common/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ int main(int argc, char **argv)
276276

277277
} else {
278278
const char *home = getenv("HOME");
279-
state_base = std::string(home ? home : "") + "/.local/share";
279+
state_base = std::string(home ? home : "/tmp") + "/.local/share";
280280
}
281281

282282
working_directory = state_base + "/px4/rootfs";

0 commit comments

Comments
 (0)