avoid strange behavior with execvp() when PATH is not set in environment
(in which case confstr(_CS_PATH) should return something reasonable)
reproducable running openwrt 15.05 and 15.05.1 and attempting to install
a software package (e.g. libuuid) via LuCI (prior to openwrt/luci#1048).
(https://github.com/openwrt/luci/pull/1048) libuuid.postinst fails with
status 255 on 15.05 and opkg segfaults in 15.05.1. This probably merits
further exploration.
Originally reported in https://github.com/openwrt/packages/issues/1922
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
SET(HOST_CPU "" CACHE STRING "Override Host CPU")
SET(BUILD_CPU "" CACHE STRING "Override Host CPU")
SET(LOCK_FILE "/var/lock/opkg.lock" CACHE STRING "Override lock file path")
+SET(PATH_SPEC "/usr/sbin:/usr/bin:/sbin:/bin" CACHE STRING "Override default PATH value")
SET(VERSION "" CACHE STRING "Override version")
OPTION(STATIC_UBOX "Statically link libubox" OFF)
-DOPKGLIBDIR="/usr/lib"
-DHOST_CPU_STR="${HOST_CPU}"
-DBUILD_CPU=${BUILD_CPU}
+ -DPATH_SPEC="${PATH_SPEC}"
-DVERSION="${VERSION}"
)
sprintf_alloc(&path, "%s/%s", ctx->statedir,
de->d_name);
if (access(path, X_OK) == 0) {
- const char *argv[] = { "sh", "-c", path, NULL };
+ const char *argv[] = { "/bin/sh", "-c", path, NULL };
xsystem(argv);
}
free(path);
sprintf_alloc(&cmd, "%s %s", path, args);
free(path);
{
- const char *argv[] = { "sh", "-c", cmd, NULL };
+ const char *argv[] = { "/bin/sh", "-c", cmd, NULL };
err = xsystem(argv);
}
free(cmd);