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



commit bae9db222b380b6b7a8feb911b7088c2cbf65b77
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Thu Apr 18 17:06:37 2013 +0100

    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

 src/FileSystem.cc |    2 +-
 src/Utils.cc      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/FileSystem.cc b/src/FileSystem.cc
index eb5b4e7..5e68d41 100644
--- a/src/FileSystem.cc
+++ b/src/FileSystem.cc
@@ -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),
diff --git a/src/Utils.cc b/src/Utils.cc
index da7928d..0b95306 100644
--- a/src/Utils.cc
+++ b/src/Utils.cc
@@ -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 >(),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]