Work around failure to execute commands with old glibmm (#695279)

On RHEL / CentOS 5.9 GParted failed to run any external commands and
instead reported the following warnings to the terminal:

    # src/gpartedbin
    ======================
    libparted : 1.8.1
    ======================
    Failed to change to directory '' (No such file or directory)
    Failed to change to directory '' (No such file or directory)
    Failed to change to directory '' (No such file or directory)
    ...

Utils::execute_command() and FileSystem::execute_command() passed a zero
length string for the working directory to
Glib::spawn_async_with_pipes() to mean don't change directory.  Instead
glibmm just tried to change to the directory with a zero length name.
This was fixed with glibmm >= 2.21.2 released July 2009, however RHEL /
CentOS 5.9 only has glibmm 2.12.10.

Relevant glibmm fix:
    Treat empty Glib::spawn*() working dir as unset
    https://git.gnome.org/browse/glibmm/commit/?id=8a7805cbbe6d268e975669349beb4e82d971537d

Fix by simply specifying ".", the current working directory, as the
directory to change into before executing all commands.

Bug #695279 - GParted doesn't compile on RHEL / CentOS 5.9
This commit is contained in:
Mike Fleetwood 2013-04-18 17:06:37 +01:00 committed by Curtis Gedak
parent 5f06ea3369
commit bae9db222b
2 changed files with 2 additions and 2 deletions

View File

@ -89,7 +89,7 @@ int FileSystem::execute_command( const Glib::ustring & command, OperationDetail
running = true;
try {
Glib::spawn_async_with_pipes(
std::string(),
std::string( "." ),
Glib::shell_parse_argv( command ),
Glib::SPAWN_DO_NOT_REAP_CHILD | Glib::SPAWN_SEARCH_PATH,
sigc::ptr_fun(setup_child),

View File

@ -474,7 +474,7 @@ int Utils::execute_command( const Glib::ustring & command,
status.foreground = (Glib::Thread::self() == GParted_Core::mainthread);
try {
Glib::spawn_async_with_pipes(
std::string(),
std::string( "." ),
Glib::shell_parse_argv( command ),
Glib::SPAWN_DO_NOT_REAP_CHILD | Glib::SPAWN_SEARCH_PATH,
use_C_locale ? sigc::ptr_fun( set_locale ) : sigc::slot< void >(),