commit kinit for openSUSE:Factory
Hello community, here is the log from the commit of package kinit for openSUSE:Factory checked in at 2014-04-02 17:22:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kinit (Old) and /work/SRC/openSUSE:Factory/.kinit.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "kinit" Changes: -------- --- /work/SRC/openSUSE:Factory/kinit/kinit.changes 2014-03-25 13:22:40.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.kinit.new/kinit.changes 2014-04-02 17:22:19.000000000 +0200 @@ -1,0 +2,9 @@ +Sat Mar 29 19:47:41 UTC 2014 - hrvoje.senjan@gmail.com + +- Update to 4.98.0 + * API improvements and cleanups + * Buildsystem fixes + * For more details please see: + http://www.kde.org/announcements/announce-frameworks5-beta1.php + +------------------------------------------------------------------- Old: ---- kinit-4.97.0.tar.xz New: ---- kinit-4.98.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kinit.spec ++++++ --- /var/tmp/diff_new_pack.oUlTjj/_old 2014-04-02 17:22:20.000000000 +0200 +++ /var/tmp/diff_new_pack.oUlTjj/_new 2014-04-02 17:22:20.000000000 +0200 @@ -17,10 +17,10 @@ Name: kinit -Version: 4.97.0 +Version: 4.98.0 Release: 0 BuildRequires: cmake >= 2.8.12 -BuildRequires: extra-cmake-modules >= 0.0.11 +BuildRequires: extra-cmake-modules >= 0.0.12 BuildRequires: fdupes BuildRequires: kcrash-devel >= %{_kf5_version} BuildRequires: kf5-filesystem @@ -28,12 +28,12 @@ BuildRequires: kio-devel >= %{_kf5_version} BuildRequires: kservice-devel >= %{_kf5_version} BuildRequires: kwindowsystem-devel >= %{_kf5_version} +BuildRequires: libcap-devel BuildRequires: pkgconfig(Qt5Core) >= 5.2.0 BuildRequires: pkgconfig(Qt5DBus) >= 5.2.0 BuildRequires: pkgconfig(Qt5Gui) >= 5.2.0 BuildRequires: pkgconfig(Qt5Widgets) >= 5.2.0 BuildRequires: pkgconfig(x11) -BuildRequires: libcap-devel #PreReq: permissions Summary: Helper library to speed up start of applications on KDE workspaces License: LGPL-2.1+ ++++++ kinit-4.97.0.tar.xz -> kinit-4.98.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/CMakeLists.txt new/kinit-4.98.0/CMakeLists.txt --- old/kinit-4.97.0/CMakeLists.txt 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/CMakeLists.txt 2014-03-28 19:17:02.000000000 +0100 @@ -2,11 +2,11 @@ project(KInit) -find_package(ECM 0.0.11 REQUIRED NO_MODULE) +find_package(ECM 0.0.12 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) set(REQUIRED_QT_VERSION "5.2") -find_package(Qt5 "${REQUIRED_QT_VERSION}" CONFIG REQUIRED Core Gui Widgets DBus) +find_package(Qt5 "${REQUIRED_QT_VERSION}" CONFIG REQUIRED Core Gui DBus) include(KDEInstallDirs) include(KDEFrameworkCompilerSettings) include(KDECMakeSettings) @@ -15,7 +15,7 @@ include(ECMPackageConfigHelpers) include(ECMSetupVersion) -set(KF5_VERSION "4.97.0") +set(KF5_VERSION "4.98.0") ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KINIT VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kinit_version.h" @@ -44,6 +44,7 @@ find_package(KF5I18n ${KF5_VERSION} REQUIRED) find_package(KF5WindowSystem ${KF5_VERSION} REQUIRED) find_package(KF5Crash ${KF5_VERSION} REQUIRED) + find_package(KF5Config ${KF5_VERSION} REQUIRED) # Due to a CMake bug, we need to explicitly find private dependencies of our dependencies # Remove when we depend on CMake 3.0.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/ConfigureChecks.cmake new/kinit-4.98.0/ConfigureChecks.cmake --- old/kinit-4.97.0/ConfigureChecks.cmake 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/ConfigureChecks.cmake 2014-03-28 19:17:02.000000000 +0100 @@ -1,15 +1,17 @@ -include (CheckFunctionExists) -include (CheckIncludeFiles) -include (CheckVariableExists) +include(CheckFunctionExists) +include(CheckIncludeFiles) +include(CheckVariableExists) include(CheckLibraryExists) check_variable_exists(__progname HAVE___PROGNAME) -check_variable_exists(__progname_full HAVE___PROGNAME_FULL) check_include_files(sys/pstat.h HAVE_SYS_PSTAT_H) -check_include_files(sys/types.h HAVE_SYS_TYPES_H) -check_include_files(unistd.h HAVE_UNISTD_H) check_include_files(sys/select.h HAVE_SYS_SELECT_H) -check_include_files(sys/exec.h HAVE_SYS_EXEC_H) check_function_exists(pstat HAVE_PSTAT) check_function_exists(setproctitle HAVE_SETPROCTITLE) check_library_exists(socket connect "" HAVE_SOCKET_LIBRARY) + +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CAN_CLOBBER_ARGV TRUE) +else() + set(CAN_CLOBBER_ARGV FALSE) +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/KF5InitMacros.cmake new/kinit-4.98.0/KF5InitMacros.cmake --- old/kinit-4.97.0/KF5InitMacros.cmake 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/KF5InitMacros.cmake 2014-03-28 19:17:02.000000000 +0100 @@ -34,6 +34,7 @@ endif(NOT _res_position EQUAL -1) _FIND_KDEINIT_FILE(_KDE5INIT_WIN32_DUMMY_FILEPATH "_win32lib") + set(_KDEINIT5_TARGET_NAME_ ${_target_NAME}) configure_file(${_KDE5INIT_WIN32_DUMMY_FILEPATH} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_win32lib_dummy.cpp) add_library(kdeinit_${_target_NAME} STATIC ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_win32lib_dummy.cpp) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/README.autostart new/kinit-4.98.0/README.autostart --- old/kinit-4.97.0/README.autostart 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/README.autostart 1970-01-01 01:00:00.000000000 +0100 @@ -1,62 +0,0 @@ -KDE SESSION AUTOSTART -===================== - -KDE session startup occurs in the following sequence: - - Window manager startup - Autostart phase 1 - Session restoration - Autostart phase 2 - -Applications may be scheduled to be automatically run at KDE session startup -in either autostart phase 1 or phase 2. Autostart phase 1 is the original -autostart phase; phase 2 was introduced in KDE 3. To run in either phase, an -application's .desktop file must be located in a KDE autostart directory such -as $KDEDIR/share/autostart or $KDEHOME/share/autostart. The .desktop file can -contain the following optional entries to control its autostart: - - X-KDE-autostart-condition = rcfile:group:entry:default - - rcfile = name of a config file (including path if necessary) - group = name of a group within the config file - entry = name of a boolean entry within the group - default = true or false - - Starts the application only if the specified boolean entry in the - specified config file has the value 'true'. If the specified entry is - missing from the config file, the application will only be started if - 'default' is 'true'. - If the entry is not within a group, the group entry can be left empty. - - X-KDE-autostart-after = desktop_name - - desktop_name = the name of another .desktop file excluding path and - the .desktop suffix. E.g. panel.desktop would appear - as 'X-KDE-autostart-after=panel' - - Waits until the .desktop file specified by 'desktop_name' has been - autostarted. The entry is ignored if the specified application is not - scheduled in the same autostart phase as this .desktop file. - - X-KDE-autostart-phase = phase - - phase = 1 or 2 - - Starts the application in the autostart phase specified by 'phase'. - If this entry is missing or 'phase' < 1, 'phase' defaults to 1. If - 'phase' > 2 the application will not be autostarted since the specified - autostart phase will never be reached. - - - Hidden = true - - Disables autostarting the application. - - -KUniqueApplication and session restoration ------------------------------------------- - -If KUniqueApplication applications are autostarted before they are restored -from the previous session, they will never see the session restoration command. -So if you need to autostart a KUniqueApplication which may also be restored -in session restoration, you should schedule it for autostart in phase 2. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/README.wrapper new/kinit-4.98.0/README.wrapper --- old/kinit-4.97.0/README.wrapper 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/README.wrapper 1970-01-01 01:00:00.000000000 +0100 @@ -1,38 +0,0 @@ -README - -kdeinit4_wrapper, kshell4 and kwrapper4 are programs that -start programs via kdeinit4. - -E.g. You can make a symbolic link from $KDEDIR/bin/konsole to -$KDEDIR/bin/kdeinit4_wrapper. Typing 'konsole' on the command line -will then start 'konsole.so' through kdeinit instead. - -kdeinit4_wrapper is the simplest form, it only passes the program -and arguments to kdeinit, nothing else - -kshell is usually the best choice, it passes the program, -arguments, complete environment ( $PATH, etc. ) and current -working directory to kdeinit - -kwrapper tries to make the program look like it was actually -really started directly and not via kdeinit. In addition to -what kshell does, it also tries to redirect the program -output to the console from which kwrapper was started, it waits -for the program started via kdeinit to finish and only after then -it exits ( it doesn't return its return value though ), and -it also passes most signals it gets to the process of the started -program ( thus allowing you to break it using Ctrl+C or stopping -it using Ctrl+Z ). The drawbacks of this are that you'll have one -more process running, and also the signal passing and output -redirection may not work 100% reliably - - -TODO -==== - -* There is no portable way to read out the complete environment and - pass it to kdeinit. - kdeinit should probably unset every - variable that's not set in the environment it gets from kshell or - kwrapper -* stdout/stderr of the started application goes to the console where - kdeinit was started. - done, I hope it's ok diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/docs/session-autostart.txt new/kinit-4.98.0/docs/session-autostart.txt --- old/kinit-4.97.0/docs/session-autostart.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/kinit-4.98.0/docs/session-autostart.txt 2014-03-28 19:17:02.000000000 +0100 @@ -0,0 +1,62 @@ +KDE SESSION AUTOSTART +===================== + +KDE session startup occurs in the following sequence: + + Window manager startup + Autostart phase 1 + Session restoration + Autostart phase 2 + +Applications may be scheduled to be automatically run at KDE session startup +in either autostart phase 1 or phase 2. Autostart phase 1 is the original +autostart phase; phase 2 was introduced in KDE 3. To run in either phase, an +application's .desktop file must be located in a KDE autostart directory such +as $KDEDIR/share/autostart or $KDEHOME/share/autostart. The .desktop file can +contain the following optional entries to control its autostart: + + X-KDE-autostart-condition = rcfile:group:entry:default + + rcfile = name of a config file (including path if necessary) + group = name of a group within the config file + entry = name of a boolean entry within the group + default = true or false + + Starts the application only if the specified boolean entry in the + specified config file has the value 'true'. If the specified entry is + missing from the config file, the application will only be started if + 'default' is 'true'. + If the entry is not within a group, the group entry can be left empty. + + X-KDE-autostart-after = desktop_name + + desktop_name = the name of another .desktop file excluding path and + the .desktop suffix. E.g. panel.desktop would appear + as 'X-KDE-autostart-after=panel' + + Waits until the .desktop file specified by 'desktop_name' has been + autostarted. The entry is ignored if the specified application is not + scheduled in the same autostart phase as this .desktop file. + + X-KDE-autostart-phase = phase + + phase = 1 or 2 + + Starts the application in the autostart phase specified by 'phase'. + If this entry is missing or 'phase' < 1, 'phase' defaults to 1. If + 'phase' > 2 the application will not be autostarted since the specified + autostart phase will never be reached. + + + Hidden = true + + Disables autostarting the application. + + +KUniqueApplication and session restoration +------------------------------------------ + +If KUniqueApplication applications are autostarted before they are restored +from the previous session, they will never see the session restoration command. +So if you need to autostart a KUniqueApplication which may also be restored +in session restoration, you should schedule it for autostart in phase 2. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/docs/wrapper.txt new/kinit-4.98.0/docs/wrapper.txt --- old/kinit-4.97.0/docs/wrapper.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/kinit-4.98.0/docs/wrapper.txt 2014-03-28 19:17:02.000000000 +0100 @@ -0,0 +1,36 @@ +README + +kdeinit5_wrapper, kshell5 and kwrapper5 are programs that +start programs via kdeinit. + +E.g. You can make a symbolic link from $KDEDIR/bin/konsole to +$KDEDIR/bin/kdeinit5_wrapper. Typing 'konsole' on the command line +will then start 'konsole.so' through kdeinit instead. + +kdeinit5_wrapper is the simplest form, it only passes the program +and arguments to kdeinit, nothing else + +kshell5 is usually the best choice, it passes the program, +arguments, complete environment ( $PATH, etc. ) and current +working directory to kdeinit + +kwrapper5 tries to make the program look like it was actually +really started directly and not via kdeinit. In addition to +what kshell5 does, it also tries to redirect the program +output to the console from which kwrapper5 was started, it waits +for the program started via kdeinit to finish and only after then +it exits ( it doesn't return its return value though ), and +it also passes most signals it gets to the process of the started +program ( thus allowing you to break it using Ctrl+C or stopping +it using Ctrl+Z ). The drawbacks of this are that you'll have one +more process running, and also the signal passing and output +redirection may not work 100% reliably. + + +TODO +==== + +* There is no portable way to read out the complete environment and + pass it to kdeinit. - kdeinit should probably unset every + variable that's not set in the environment it gets from kshell or + kwrapper diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/kde5init_win32lib_dummy.cpp.in new/kinit-4.98.0/kde5init_win32lib_dummy.cpp.in --- old/kinit-4.97.0/kde5init_win32lib_dummy.cpp.in 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/kde5init_win32lib_dummy.cpp.in 2014-03-28 19:17:02.000000000 +0100 @@ -1,5 +1,5 @@ /* dummy file, used by KF5_ADD_KDEINIT_EXECUTABLE() under Windows, * so that the created static library is not completely empty */ -extern "C" int kdeinit_${_KDEINIT4_TARGET_NAME_}_dummy(void) { return 42; } +extern "C" int kdeinit_${_KDEINIT5_TARGET_NAME_}_dummy(void) { return 42; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/src/Messages.sh new/kinit-4.98.0/src/Messages.sh --- old/kinit-4.97.0/src/Messages.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/kinit-4.98.0/src/Messages.sh 2014-03-28 19:17:02.000000000 +0100 @@ -0,0 +1,18 @@ +#!/bin/sh + +# Invoke the extractrc script on all .ui, .rc, and .kcfg files in the sources. +# The results are stored in a pseudo .cpp file to be picked up by xgettext. +lst=`find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` +if [ -n "$lst" ] ; then + $EXTRACTRC $lst >> rc.cpp +fi + +# If your framework contains tips-of-the-day, call preparetips as well. +if [ -f "data/tips" ] ; then + ( cd data && $PREPARETIPS > ../tips.cpp ) +fi + +# Extract strings from all source files. +# If your framework depends on KI18n, use $XGETTEXT. If it uses Qt translation +# system, use $EXTRACT_TR_STRINGS. +$XGETTEXT `find . -name \*.cpp -o -name \*.h -name \*.qml` -o $podir/kinit5.pot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/src/config-kdeinit.h.cmake new/kinit-4.98.0/src/config-kdeinit.h.cmake --- old/kinit-4.97.0/src/config-kdeinit.h.cmake 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/src/config-kdeinit.h.cmake 2014-03-28 19:17:02.000000000 +0100 @@ -7,13 +7,13 @@ /* These are for proctitle.cpp: */ #cmakedefine01 HAVE___PROGNAME -#cmakedefine01 HAVE___PROGNAME_FULL #cmakedefine01 HAVE_SYS_PSTAT_H #cmakedefine01 HAVE_PSTAT #cmakedefine01 HAVE_SETPROCTITLE +#cmakedefine01 CAN_CLOBBER_ARGV + #cmakedefine01 HAVE_X11 #cmakedefine01 HAVE_SYS_SELECT_H -#cmakedefine01 HAVE_SYS_EXEC_H /* for start_kdeinit */ #cmakedefine01 KDEINIT_OOM_PROTECT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/src/kdeinit/CMakeLists.txt new/kinit-4.98.0/src/kdeinit/CMakeLists.txt --- old/kinit-4.97.0/src/kdeinit/CMakeLists.txt 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/src/kdeinit/CMakeLists.txt 2014-03-28 19:17:02.000000000 +0100 @@ -22,16 +22,18 @@ target_link_libraries(kdeinit5 ${kdeinit_LIBS} ${KINIT_SOCKET_LIBRARY} Qt5::Gui #QFont::initialize - KF5::Service #KLibrary KF5::WindowSystem # KStartupInfo KF5::Crash # KCrash::loadedByKdeinit KF5::I18n #i18n() used on some error messages + KF5::ConfigCore Qt5::DBus ) -if(WIN32) - target_compile_definitions(kdeinit5 PRIVATE CMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") -endif() +target_compile_definitions(kdeinit5 PRIVATE + CMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" + LIB_INSTALL_DIR="${LIB_INSTALL_DIR}" + LIBEXEC_INSTALL_DIR="${LIBEXEC_INSTALL_DIR}" +) if (X11_FOUND) target_link_libraries(kdeinit5 ${X11_X11_LIB}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/src/kdeinit/kinit.cpp new/kinit-4.98.0/src/kdeinit/kinit.cpp --- old/kinit-4.97.0/src/kdeinit/kinit.cpp 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/src/kdeinit/kinit.cpp 2014-03-28 19:17:02.000000000 +0100 @@ -52,7 +52,6 @@ #include <QtCore/QRegExp> #include <QFont> #include <kcrash.h> -#include <klibrary.h> #include <kconfig.h> #include <klocalizedstring.h> #include <QDebug> @@ -88,10 +87,10 @@ #ifdef Q_OS_UNIX //TODO: make sure what libraries we want here... static const char *extra_libs[] = { - "libKIOCore.so.5", - "libKParts.so.5", + "libKF5KIOCore.so.5", + "libKF5Parts.so.5", //#ifdef __KDE_HAVE_GCC_VISIBILITY // Removed for KF5, we'll see. - "libPlasma.so.5" + "libKF5Plasma.so.5" //#endif }; #endif @@ -472,34 +471,34 @@ { QString lib; QByteArray name; - QByteArray exec; QString libpath; QByteArray execpath; + bool libpath_relative = false; if (_name[0] != '/') { name = _name; lib = QFile::decodeName(name); - exec = name; - KLibrary klib(QLatin1String("libkdeinit5_") + lib); - libpath = klib.fileName(); - if (libpath.isEmpty()) { - KLibrary klib(lib); - libpath = klib.fileName(); // this is really just a way to call findLibraryInternal - } - execpath = execpath_avoid_loops(exec, envc, envs, avoid_loops); - if (libpath.isEmpty() && execpath.isEmpty()) { - fprintf(stderr, "Didn't find \"%s\", neither as an executable nor as a plugin. Please check $PATH and $QT_PLUGIN_PATH.\n", name.constData()); - } + libpath = QLatin1String("libkdeinit5_") + lib; + libpath_relative = true; + execpath = execpath_avoid_loops(name, envc, envs, avoid_loops); } else { name = _name; lib = QFile::decodeName(name); name = name.mid(name.lastIndexOf('/') + 1); - exec = _name; + + // FIXME: this .so extension stuff is very Linux-specific if (lib.endsWith(QLatin1String(".so"))) { libpath = lib; } else { - // try to match an absolute path to an executable binary (either in bin/ or in libexec/) - // to a kdeinit module in the same prefix + execpath = _name; + + // Try to match an absolute path to an executable binary (either in + // bin/ or in libexec/) to a kdeinit module in the same prefix. + // + // Note that these *_INSTALL_DIR values should normally relative to + // the install prefix, although this may not be the case if the user + // has overridden them, and so this search is inherently fragile in + // the face of unusual installation layouts. if (lib.contains(QLatin1String(LIBEXEC_INSTALL_DIR))) { libpath = QString(lib).replace(QLatin1String(LIBEXEC_INSTALL_DIR), QLatin1String(LIB_INSTALL_DIR "/libkdeinit5_")) + QLatin1String(".so"); @@ -511,7 +510,6 @@ if (!QFile::exists(libpath)) { libpath.clear(); } - execpath = exec; } } #ifndef NDEBUG @@ -630,12 +628,12 @@ /* set the process name, so that killall works like intended */ r = prctl(PR_SET_NAME, (unsigned long) name.data(), 0, 0, 0); if (r == 0) { - proctitle_set("%s [kdeinit]%s", name.data(), procTitle.data() ? procTitle.data() : ""); + proctitle_set("-%s [kdeinit5]%s", name.data(), procTitle.data() ? procTitle.data() : ""); } else { - proctitle_set("kdeinit5: %s%s", name.data(), procTitle.data() ? procTitle.data() : ""); + proctitle_set("%s%s", name.data(), procTitle.data() ? procTitle.data() : ""); } #else - proctitle_set("kdeinit5: %s%s", name.data(), procTitle.data() ? procTitle.data() : ""); + proctitle_set("%s%s", name.data(), procTitle.data() ? procTitle.data() : ""); #endif #endif } @@ -652,7 +650,20 @@ QLibrary l(libpath); if (!libpath.isEmpty()) { - if (!l.load() || !l.isLoaded()) { + if (!l.load()) { + if (libpath_relative) { + // NB: Because Qt makes the actual dlopen() call, the + // RUNPATH of kdeinit is *not* respected - see + // https://sourceware.org/bugzilla/show_bug.cgi?id=13945 + // - so we try hacking it in ourselves + QString install_lib_dir = QFile::decodeName( + CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/"); + libpath = install_lib_dir + libpath; + l.setFileName(libpath); + l.load(); + } + } + if (!l.isLoaded()) { QString ltdlError(l.errorString()); if (execpath.isEmpty()) { // Error @@ -660,7 +671,7 @@ exitWithErrorMsg(errorMsg); } else { // Print warning - fprintf(stderr, "Could not open library %s: %s\n", qPrintable(lib), + fprintf(stderr, "Could not open %s using a library: %s\n", qPrintable(lib), qPrintable(ltdlError)); } } @@ -883,17 +894,6 @@ exit(255); } } -#if 0 // obsolete in kde4. Should we check writing to another file instead? - path = qgetenv("ICEAUTHORITY"); - if (path.isEmpty()) { - path = home_dir; - path += "/.ICEauthority"; - } - if (access(path.data(), R_OK | W_OK) && (errno != ENOENT)) { - fprintf(stderr, "kdeinit5: Aborting. No write access to '%s'.\n", path.data()); - exit(255); - } -#endif } /** Test if socket file is already present @@ -1380,62 +1380,9 @@ } } -static void kdeinit_library_path() +static void generate_socket_name() { - const QStringList ltdl_library_path = - QFile::decodeName(qgetenv("LTDL_LIBRARY_PATH")).split(QLatin1Char(':'), QString::SkipEmptyParts); -#ifdef Q_OS_DARWIN - const QByteArray ldlibpath = qgetenv("DYLD_LIBRARY_PATH"); -#else - const QByteArray ldlibpath = qgetenv("LD_LIBRARY_PATH"); -#endif - const QStringList ld_library_path = - QFile::decodeName(ldlibpath).split(QLatin1Char(':'), QString::SkipEmptyParts); - -#if 0 // unused - - QByteArray extra_path; - const QStringList candidates = s_instance->dirs()->resourceDirs("lib"); - for (QStringList::ConstIterator it = candidates.begin(); - it != candidates.end(); - ++it) { - QString d = *it; - if (ltdl_library_path.contains(d)) { - continue; - } - if (ld_library_path.contains(d)) { - continue; - } - if (d[d.length() - 1] == QLatin1Char('/')) { - d.truncate(d.length() - 1); - if (ltdl_library_path.contains(d)) { - continue; - } - if (ld_library_path.contains(d)) { - continue; - } - } - if ((d == QLatin1String("/lib")) || (d == QLatin1String("/usr/lib"))) { - continue; - } - - QByteArray dir = QFile::encodeName(d); - - if (access(dir, R_OK)) { - continue; - } - - if (!extra_path.isEmpty()) { - extra_path += ':'; - } - extra_path += dir; - } -#endif - -// if (!extra_path.isEmpty()) -// lt_dlsetsearchpath(extra_path.data()); - QByteArray display = qgetenv(displayEnvVarName().constData()); if (display.isEmpty()) { #if HAVE_X11 // qt5: see displayEnvVarName() @@ -1677,7 +1624,7 @@ } -int main(int argc, char **argv, char **envp) +int main(int argc, char **argv) { #ifndef _WIN32_WCE setlocale(LC_ALL, ""); @@ -1687,10 +1634,7 @@ pid_t pid; bool do_fork = true; int launch_klauncher = 1; - // KDE5 TODO: make this 0 by default, so that a random kde app doesn't start kded5 upfront, - // but on demand when a service needs it. In startkde, however, use +kded5 or --kded. - // (+kded5 might not work because it doesn't fork on startup anymore) - int launch_kded = 1; + int launch_kded = 0; int keep_running = 1; d.suicide = false; @@ -1701,16 +1645,17 @@ if (strcmp(safe_argv[i], "--no-klauncher") == 0) { launch_klauncher = 0; } - if (strcmp(safe_argv[i], "--no-kded") == 0) { - launch_kded = 0; + if (strcmp(safe_argv[i], "--kded") == 0) { + launch_kded = 1; } -#ifdef Q_OS_MAC - // make it nofork to match KUniqueApplication, technically command-line incompatible - if (strcmp(safe_argv[i], "--nofork") == 0) -#else - if (strcmp(safe_argv[i], "--no-fork") == 0) -#endif + // allow both nofork and no-fork for compatibility with + // old versions (both of this and of KUniqueApplication) + if (strcmp(safe_argv[i], "--nofork") == 0) { + do_fork = false; + } + if (strcmp(safe_argv[i], "--no-fork") == 0) { do_fork = false; + } if (strcmp(safe_argv[i], "--suicide") == 0) { d.suicide = true; } @@ -1729,13 +1674,9 @@ #endif if (strcmp(safe_argv[i], "--help") == 0) { printf("Usage: kdeinit5 [options]\n"); -#ifdef Q_OS_MAC - printf(" --nofork Do not fork\n"); -#else printf(" --no-fork Do not fork\n"); -#endif // printf(" --no-klauncher Do not start klauncher\n"); - printf(" --no-kded Do not start kded\n"); + printf(" --kded Start kded\n"); printf(" --suicide Terminate when no KDE applications are left running\n"); printf(" --version Show version information\n"); // printf(" --exit Terminate when kded has run\n"); @@ -1786,10 +1727,9 @@ /** Prepare to change process name **/ #ifndef SKIP_PROCTITLE - proctitle_init(argc, argv, envp); + proctitle_init(argc, argv); #endif - kdeinit_library_path(); // don't change envvars before proctitle_init() unsetenv("LD_BIND_NOW"); unsetenv("DYLD_BIND_AT_LAUNCH"); @@ -1808,6 +1748,7 @@ setupX(); #endif + generate_socket_name(); if (keep_running) { /* * Create ~/.kde/tmp-<hostname>/kdeinit5-<display> socket for incoming wrapper @@ -1894,7 +1835,7 @@ free(safe_argv); #ifndef SKIP_PROCTITLE - proctitle_set("kdeinit5 Running..."); + proctitle_set("Running..."); #endif if (!keep_running) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/src/kdeinit/proctitle.cpp new/kinit-4.98.0/src/kdeinit/proctitle.cpp --- old/kinit-4.97.0/src/kdeinit/proctitle.cpp 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/src/kdeinit/proctitle.cpp 2014-03-28 19:17:02.000000000 +0100 @@ -1,234 +1,211 @@ +/* Based on setproctitle.c from OpenSSH 6.6p1 */ + /* - * ProFTPD - FTP server daemon - * Copyright (c) 2007 The ProFTPD Project team //krazy:exclude=copyright - * Copyright (c) 2007 Alex Merry <alex.merry@kdemail.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright 2014 Alex Merry <alex.merry@kde.org> + * Copyright 2003 Damien Miller + * Copyright (c) 1983, 1995-1997 Eric P. Allman + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include "proctitle.h" #include <config-kdeinit.h> -#include <QByteArray> +#define PT_NONE 0 /* don't use it at all */ +#define PT_PSTAT 1 /* use pstat(PSTAT_SETCMD, ...) */ +#define PT_REUSEARGV 2 /* cover argv with title information */ +#define PT_SETPROCTITLE 3 /* forward onto the native setproctitle */ -#include <string.h> -#include <stdio.h> #include <stdarg.h> +#include <stdio.h> #include <stdlib.h> - -#define PF_ARGV_NONE 0 -#define PF_ARGV_NEW 1 -#define PF_ARGV_WRITEABLE 2 -#define PF_ARGV_PSTAT 3 -#define PF_ARGV_PSSTRINGS 4 +#include <sys/types.h> +#include <unistd.h> +#include <string.h> #if HAVE_SETPROCTITLE -# define PF_ARGV_TYPE PF_ARGV_NONE -# if HAVE_SYS_TYPES_H -# include <sys/types.h> -# endif /* HAVE_SYS_TYPES_H */ -# if HAVE_UNISTD_H -# include <unistd.h> -# endif /* HAVE_UNISTD_H */ - -#else /* HAVE_SETPROCTITLE */ -# ifdef __GNU_HURD__ -# define PF_ARGV_TYPE PF_ARGV_NEW -# else /* __GNU_HURD__ */ -# define PF_ARGV_TYPE PF_ARGV_WRITEABLE - -# if HAVE_SYS_PSTAT_H && HAVE_PSTAT -# include <sys/pstat.h> -# undef PF_ARGV_TYPE -# define PF_ARGV_TYPE PF_ARGV_PSTAT -# endif /* HAVE_SYS_PSTAT_H && HAVE_PSTAT */ - -# if HAVE_SYS_EXEC_H -# include <sys/exec.h> -# if PS_STRINGS -# include <machine/vmparam.h> -# undef PF_ARGV_TYPE -# define PF_ARGV_TYPE PF_ARGV_PSSTRINGS -# endif /* PS_STRINGS */ -# endif /* HAVE_SYS_EXEC_H */ +# define PT_TYPE PT_SETPROCTITLE + // process title should get prepended automagically +# define ADD_PROCTITLE 0 +#elif HAVE_SYS_PSTAT_H && HAVE_PSTAT +# include <sys/pstat.h> +# define PT_TYPE PT_PSTAT +#elif CAN_CLOBBER_ARGV +# define PT_TYPE PT_REUSEARGV +#endif -# endif /* !__GNU_HURD__ */ +#ifndef PT_TYPE +# define PT_TYPE PT_NONE +#endif +#ifndef ADD_PROCTITLE +# define ADD_PROCTITLE 1 +#endif -#endif /* !HAVE_SETPROCTITLE */ +#if PT_TYPE == PT_REUSEARGV +static char *argv_start = NULL; +static size_t argv_env_len = 0; +#endif #if HAVE___PROGNAME extern char *__progname; -#endif /* HAVE___PROGNAME */ -#if HAVE___PROGNAME_FULL -extern char *__progname_full; -#endif /* HAVE___PROGNAME_FULL */ -extern char **environ; - -static char **Argv = NULL; - -#if PF_ARGV_TYPE == PF_ARGV_WRITEABLE /* Only this mode uses LastArgv */ -static char *LastArgv = NULL; -static char *cleanUpTo = NULL; +#else +char *__progname; #endif -/** - * Set up the memory space for setting the proctitle - */ -void proctitle_init(int argc, char *argv[], char *envp[]) +void +proctitle_init(int argc, char *argv[]) { - register int i, envpsize; - char **p; +#if HAVE___PROGNAME + // progname may be a reference to argv[0] + __progname = strdup(__progname); +#else + if (argc == 0 || argv[0] == NULL) { + __progname = "unknown"; /* XXX */ + } else { + char *p = strrchr(argv[0], '/'); + if (p == NULL) + p = argv[0]; + else + p++; - /* Move the environment so proctitle_set can use the space. */ - for (i = envpsize = 0; envp[i] != NULL; i++) { - envpsize += strlen(envp[i]) + 1; + __progname = strdup(p); } +#endif - if ((p = (char **) malloc((i + 1) * sizeof(char *))) != NULL) { - environ = p; +#if PT_TYPE == PT_REUSEARGV + if (argc == 0 || argv[0] == NULL) + return; - for (i = 0; envp[i] != NULL; i++) { - if ((environ[i] = static_cast<char *>(malloc(strlen(envp[i]) + 1))) != NULL) { - strcpy(environ[i], envp[i]); - } - } + extern char **environ; + char *lastargv = NULL; + char **envp = environ; + int i; - environ[i] = NULL; - } + /* + * NB: This assumes that argv has already been copied out of the + * way. This is true for kdeinit, but may not be true for other + * programs. Beware. + */ - Argv = argv; + /* Fail if we can't allocate room for the new environment */ + for (i = 0; envp[i] != NULL; i++) + ; + if ((environ = (char**)calloc(i + 1, sizeof(*environ))) == NULL) { + environ = envp; /* put it back */ + return; + } -# if PF_ARGV_TYPE == PF_ARGV_WRITEABLE /* Only this mode uses LastArgv */ + /* + * Find the last argv string or environment variable within + * our process memory area. + */ for (i = 0; i < argc; i++) { - if (!i || (LastArgv + 1 == argv[i])) { - LastArgv = argv[i] + strlen(argv[i]); - } + if (lastargv == NULL || lastargv + 1 == argv[i]) + lastargv = argv[i] + strlen(argv[i]); } - cleanUpTo = LastArgv; - for (i = 0; envp[i] != NULL; i++) { - /* must not overwrite XDG_SESSION_COOKIE */ - if (!strncmp(envp[i], "XDG_", 4)) { - break; - } - if ((LastArgv + 1) == envp[i]) { - LastArgv = envp[i] + strlen(envp[i]); - } + if (lastargv + 1 == envp[i]) + lastargv = envp[i] + strlen(envp[i]); } -#endif -# if HAVE___PROGNAME - /* Set the __progname variable so glibc and company - * don't go nuts. + argv[1] = NULL; + argv_start = argv[0]; + argv_env_len = lastargv - argv[0] - 1; + + /* + * Copy environment + * XXX - will truncate env on strdup fail */ - __progname = strdup("kdeinit5"); -# endif /* HAVE___PROGNAME */ -# if HAVE___PROGNAME_FULL - /* __progname_full too */ - __progname_full = strdup(argv[0]); -# endif /* HAVE___PROGNAME_FULL */ + for (i = 0; envp[i] != NULL; i++) + environ[i] = strdup(envp[i]); + environ[i] = NULL; +#endif /* PT_REUSEARGV */ } -void proctitle_set(const char *fmt, ...) +void +proctitle_set(const char *fmt, ...) { - va_list msg; - static char statbuf[BUFSIZ]; - -#if ! HAVE_SETPROCTITLE -# if PF_ARGV_TYPE == PF_ARGV_PSTAT - union pstun pst; -# endif /* PF_ARGV_PSTAT */ - char *p; - int i; -#endif /* HAVE_SETPROCTITLE */ - - if (!fmt) { +#if PT_TYPE != PT_NONE +#if PT_TYPE == PT_REUSEARGV + if (argv_env_len <= 0) return; - } - - va_start(msg, fmt); - - memset(statbuf, 0, sizeof(statbuf)); - -#if HAVE_SETPROCTITLE -# if __FreeBSD__ >= 4 && !defined(FREEBSD4_0) && !defined(FREEBSD4_1) - /* FreeBSD's setproctitle() automatically prepends the process name. */ - qvsnprintf(statbuf, sizeof(statbuf), fmt, msg); - -# else /* FREEBSD4 */ - /* Manually append the process name for non-FreeBSD platforms. */ - qsnprintf(statbuf, sizeof(statbuf), "%s", "kdeinit5: "); - qvsnprintf(statbuf + strlen(statbuf), - sizeof(statbuf) - strlen(statbuf), - fmt, - msg); - -# endif /* FREEBSD4 */ - setproctitle("%s", statbuf); - -#else /* HAVE_SETPROCTITLE */ - /* Manually append the process name for non-setproctitle() platforms. */ - qsnprintf(statbuf, sizeof(statbuf), "%s", "kdeinit5: "); - qvsnprintf(statbuf + strlen(statbuf), - sizeof(statbuf) - strlen(statbuf), - fmt, - msg); - -#endif /* HAVE_SETPROCTITLE */ +#endif - va_end(msg); + bool skip_proctitle = false; + if (fmt != NULL && fmt[0] == '-') { + skip_proctitle = true; + ++fmt; + } + char ptitle[1024]; + memset(ptitle, '\0', sizeof(ptitle)); + size_t len = 0; + +#if ADD_PROCTITLE + if (!skip_proctitle) { + strncpy(ptitle, __progname, sizeof(ptitle)-1); + len = strlen(ptitle); + if (fmt != NULL && sizeof(ptitle) - len > 2) { + strcpy(ptitle + len, ": "); + len += 2; + } + } +#endif -#if HAVE_SETPROCTITLE - return; -#else - i = strlen(statbuf); + if (fmt != NULL) { + int r = -1; + if (len < sizeof(ptitle) - 1) { + va_list ap; + va_start(ap, fmt); + r = vsnprintf(ptitle + len, sizeof(ptitle) - len , fmt, ap); + va_end(ap); + } + if (r == -1 || (size_t)r >= sizeof(ptitle) - len) + return; + } -# if PF_ARGV_TYPE == PF_ARGV_NEW - /* We can just replace argv[] arguments. Nice and easy. */ - Argv[0] = statbuf; - Argv[1] = NULL; -# endif /* PF_ARGV_NEW */ - -# if PF_ARGV_TYPE == PF_ARGV_WRITEABLE - const int maxlen = (LastArgv - Argv[0]) - 1; - /* We can overwrite individual argv[] arguments. Semi-nice. */ - qsnprintf(Argv[0], maxlen, "%s", statbuf); - p = &Argv[0][i]; - /* Clear the rest used by arguments, but don't clear the memory - that is usually used for environment variables. Some - tools, like ConsoleKit must have access to the process'es initial - environment (more exact, the XDG_SESSION_COOKIE variable stored there). - If this code causes another side effect, we have to specifically - always append those variables to our environment. */ - while (p < cleanUpTo) { - *p++ = '\0'; - } - - Argv[1] = NULL; -# endif /* PF_ARGV_WRITEABLE */ - -# if PF_ARGV_TYPE == PF_ARGV_PSTAT - pst.pst_command = statbuf; - pstat(PSTAT_SETCMD, pst, i, 0, 0); -# endif /* PF_ARGV_PSTAT */ - -# if PF_ARGV_TYPE == PF_ARGV_PSSTRINGS - PS_STRINGS->ps_nargvstr = 1; - PS_STRINGS->ps_argvstr = statbuf; -# endif /* PF_ARGV_PSSTRINGS */ +#if PT_TYPE == PT_PSTAT + union pstun pst; + pst.pst_command = ptitle; + pstat(PSTAT_SETCMD, pst, strlen(ptitle), 0, 0); +#elif PT_TYPE == PT_REUSEARGV + strncpy(argv_start, ptitle, argv_env_len); + argv_start[argv_env_len-1] = '\0'; +#elif PT_TYPE == PT_SETPROCTITLE + if (fmt == NULL) { + setproctitle(NULL); +#if defined(__FreeBSD__) + } else if (skip_proctitle) { + // setproctitle on FreeBSD allows skipping the process title + setproctitle("-%s", ptitle); +#endif + } else { + setproctitle("%s", ptitle); + } +#endif -#endif /* HAVE_SETPROCTITLE */ +#endif /* !PT_NONE */ } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/src/kdeinit/proctitle.h new/kinit-4.98.0/src/kdeinit/proctitle.h --- old/kinit-4.97.0/src/kdeinit/proctitle.h 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/src/kdeinit/proctitle.h 2014-03-28 19:17:02.000000000 +0100 @@ -1,48 +1,63 @@ /* - * ProFTPD - FTP server daemon - * Copyright (c) 2007 The ProFTPD Project team //krazy:exclude=copyright - * Copyright (c) 2007 Alex Merry <alex.merry@kdemail.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA + * Copyright 2014 Alex Merry <alex.merry@kde.org> + * Copyright 2003 Damien Miller + * Copyright (c) 1983, 1995-1997 Eric P. Allman + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ -#ifndef PROCTITLE_H -#define PROCTITLE_H +#ifndef SETPROCTITLE_H +#define SETPROCTITLE_H /** - * Initialises the program data variables to allow the - * changing of the process title. This _must_ be called - * before proctitle_set, and must only be called once. - * - * @param argc argc, as passed to main() - * @param argv argv, as passed to main() - * @param envp envp, as passed to main() + * Set up the data structures for changing the process title. + * + * This must be called before proctitle_set, and must not be called + * multiple times. Be warned that this function and proctitle_set may + * alter the contents of argv, and so any argument parsing should be + * done before calling this function. + * + * @param argc argc, as passed to main() + * @param argv argv, as passed to main() (NB: this MUST NOT be a copy + * of argv!) */ -void proctitle_init(int argc, char *argv[], char *envp[]); +void proctitle_init(int argc, char *argv[]); /** - * Change the process title. It accepts a variable number - * of arguments (a va_list) in the manner of the printf - * family of functions. See the documentation for - * printf for a description of the format string. + * Set the process title that appears on the ps command. + * + * The title is set to the executable's name, followed by the result + * of a printf-style expansion of the arguments as specified by the fmt + * argument. If fmt begins with a '-' character, the executable's name + * is skipped (providing the platform implementation supports it; + * OpenBSD and NetBSD do not). + * + * Note that proctitle_init must be called before using this function. */ -void proctitle_set(const char *fmt, ...) -#ifdef __GNUC__ -__attribute__((format(printf, 1, 2))) -#endif -; +void proctitle_set(const char *fmt, ...); -#endif /* PROCTITLE_H */ +#endif // SETPROCTITLE_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kinit-4.97.0/src/klauncher/klauncher.cpp new/kinit-4.98.0/src/klauncher/klauncher.cpp --- old/kinit-4.97.0/src/klauncher/klauncher.cpp 2014-03-01 12:51:02.000000000 +0100 +++ new/kinit-4.98.0/src/klauncher/klauncher.cpp 2014-03-28 19:17:02.000000000 +0100 @@ -45,9 +45,9 @@ #include <kconfig.h> #include <QDebug> -#include <klibrary.h> #include <klocalizedstring.h> #include <kdesktopfile.h> +#include <kpluginloader.h> // to find kioslave modules #include <kprotocolmanager.h> #include <kprotocolinfo.h> #include <krun.h> // TODO port away from kiofilewidgets @@ -137,7 +137,15 @@ mSlaveDebug = QString::fromLocal8Bit(qgetenv("KDE_SLAVE_DEBUG_WAIT")); if (!mSlaveDebug.isEmpty()) { +#ifndef USE_KPROCESS_FOR_KIOSLAVES qWarning("Klauncher running in slave-debug mode for slaves of protocol '%s'", qPrintable(mSlaveDebug)); +#else + // Slave debug mode causes kdeinit to suspend the process waiting + // for the developer to attach gdb to the process; we do not have + // a good way of doing a similar thing if we are using QProcess. + mSlaveDebug.clear(); + qWarning("slave-debug mode is not available as Klauncher is not using kdeinit"); +#endif } mSlaveValgrind = QString::fromLocal8Bit(qgetenv("KDE_SLAVE_VALGRIND")); if (!mSlaveValgrind.isEmpty()) { @@ -1015,19 +1023,25 @@ return slave->pid(); } - QString name = KProtocolInfo::exec(protocol); - if (name.isEmpty()) { + QString slaveModule = KProtocolInfo::exec(protocol); + if (slaveModule.isEmpty()) { error = i18n("Unknown protocol '%1'.\n", protocol); return 0; } + KPluginLoader loader(slaveModule); + QString slaveModulePath = loader.fileName(); + if (slaveModulePath.isEmpty()) { + error = i18n("Could not find the '%1' plugin.\n", slaveModule); + return 0; + } QStringList arg_list; #ifdef USE_KPROCESS_FOR_KIOSLAVES - arg_list << name; + arg_list << slaveModulePath; arg_list << protocol; arg_list << mConnectionServer.address().toString(); arg_list << app_socket; - name = QFile::decodeName(CMAKE_INSTALL_PREFIX "/" LIBEXEC_INSTALL_DIR "/kioslave"); + QString name = QFile::decodeName(CMAKE_INSTALL_PREFIX "/" LIBEXEC_INSTALL_DIR "/kioslave"); #else QString arg1 = protocol; QString arg2 = mConnectionServer.address().toString(); @@ -1035,26 +1049,25 @@ arg_list.append(arg1); arg_list.append(arg2); arg_list.append(arg3); + QString name = slaveModulePath; #endif // qDebug() << "KLauncher: launching new slave " << name << " with protocol=" << protocol // << " args=" << arg_list << endl; #ifdef Q_OS_UNIX - if (mSlaveDebug == protocol) { #ifndef USE_KPROCESS_FOR_KIOSLAVES + // see comments where mSlaveDebug is set in KLauncher::KLauncher + if (mSlaveDebug == protocol) { klauncher_header request_header; request_header.cmd = LAUNCHER_DEBUG_WAIT; request_header.arg_length = 0; kde_safe_write(kdeinitSocket, &request_header, sizeof(request_header)); -#else - name = QString::fromLatin1("gdb"); -#endif } +#endif if (mSlaveValgrind == protocol) { + arg_list.prepend(name); #ifndef USE_KPROCESS_FOR_KIOSLAVES // otherwise we've already done this - KLibrary lib(name); - arg_list.prepend(lib.fileName()); arg_list.prepend(QFile::decodeName(CMAKE_INSTALL_PREFIX "/" LIBEXEC_INSTALL_DIR "/kioslave")); #endif name = QString::fromLatin1("valgrind"); -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de