diff options
-rw-r--r-- | CMakeLists.txt | 38 | ||||
-rw-r--r-- | CONTRIBUTING.md | 81 | ||||
-rw-r--r-- | COPYING | 2 | ||||
-rw-r--r-- | NEWS | 53 | ||||
-rw-r--r-- | README.cmake | 3 | ||||
-rw-r--r-- | bus/CMakeLists.txt | 1 | ||||
-rw-r--r-- | bus/activation-helper.c | 2 | ||||
-rw-r--r-- | bus/dir-watch-inotify.c | 11 | ||||
-rw-r--r-- | bus/dir-watch-kqueue.c | 10 | ||||
-rw-r--r-- | cmake/ConfigureChecks.cmake | 9 | ||||
-rw-r--r-- | cmake/DBus1Config.pkgconfig.in | 4 | ||||
-rw-r--r-- | cmake/config.h.cmake | 10 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | dbus/CMakeLists.txt | 4 | ||||
-rw-r--r-- | dbus/dbus-server-launchd.c | 1 | ||||
-rw-r--r-- | dbus/dbus-sysdeps-util-unix.c | 34 | ||||
-rw-r--r-- | doc/Makefile.am | 3 | ||||
-rw-r--r-- | maint/release-checklist.md | 82 | ||||
-rw-r--r-- | test/test-utils-glib.c | 62 | ||||
-rw-r--r-- | tools/dbus-launch.c | 2 |
20 files changed, 290 insertions, 125 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e1fc413..fc405d2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,10 @@ include(MacrosAutotools) autoinit(configure.ac) autoversion(dbus) +# replacement for AC_C_BIGENDIAN +include (TestBigEndian) +test_big_endian(WORDS_BIGENDIAN) + if(EXISTS ${CMAKE_SOURCE_DIR}/config.h.in) autoheaderchecks(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_SOURCE_DIR}/cmake/ConfigureChecks.cmake ${CMAKE_SOURCE_DIR}/cmake/config.h.cmake) else() @@ -140,9 +144,13 @@ option(DBUS_DISABLE_ASSERT "Disable assertion checking" OFF) option(DBUS_ENABLE_STATS "enable bus daemon usage statistics" OFF) option(ENABLE_TRADITIONAL_ACTIVATION "Enable traditional activation (without using systemd)" ON) +find_package(PkgConfig) + if(DBUS_LINUX) add_auto_option(ENABLE_SYSTEMD "build with systemd at_console support" AUTO) - include(FindPkgConfig) + if (NOT PKG_CONFIG_FOUND) + message(SEND_ERROR "pkg-config not found, this is required on Linux systems") + endif() pkg_check_modules(SYSTEMD libsystemd>=209) if(NOT SYSTEMD_FOUND) pkg_check_modules(SYSTEMD libsystemd-login>=32 libsystemd-daemon>=32 libsystemd-journal>=32) @@ -373,8 +381,13 @@ endif() if(UNIX AND NOT DBUS_DISABLE_ASSERT) # required for backtrace - string(APPEND CMAKE_C_FLAGS_DEBUG " -Wl,--export-dynamic") - string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Wl,--export-dynamic") + if (APPLE) + string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,-export_dynamic") + string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-export_dynamic") + else() + string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--export-dynamic") + string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--export-dynamic") + endif() set(DBUS_BUILT_R_DYNAMIC 1) endif() @@ -566,8 +579,14 @@ if(MSVC_IDE) endif() #### Find socket directories +set(DBUS_SESSION_SOCKET_DIR "" CACHE STRING "Default directory for session socket") if(UNIX) - if(NOT $ENV{TMPDIR} STREQUAL "") + if (CMAKE_CROSSCOMPILING) + if (NOT DBUS_SESSION_SOCKET_DIR) + message(FATAL_ERROR "cannot autodetect session socket directory " + "when crosscompiling, pass -DDBUS_SESSION_SOCKET_DIR=...") + endif() + elseif(NOT $ENV{TMPDIR} STREQUAL "") set(DBUS_SESSION_SOCKET_DIR $ENV{TMPDIR}) elseif(NOT $ENV{TEMP} STREQUAL "") set(DBUS_SESSION_SOCKET_DIR $ENV{TEMP}) @@ -606,10 +625,8 @@ if(WIN32) else(WIN32) set(DBUS_SESSION_BUS_LISTEN_ADDRESS "unix:tmpdir=${DBUS_SESSION_SOCKET_DIR}" CACHE STRING "session bus default listening address") set(DBUS_SESSION_BUS_CONNECT_ADDRESS "autolaunch:" CACHE STRING "session bus fallback address for clients") - set(sysconfdir "") - set(configdir ${sysconfdir}/dbus-1 ) - set(DBUS_SYSTEM_CONFIG_FILE ${configdir}/system.conf) - set(DBUS_SESSION_CONFIG_FILE ${configdir}/session.conf) + set(DBUS_SYSTEM_CONFIG_FILE ${DBUS_DATADIR}/dbus-1/system.conf) + set(DBUS_SESSION_CONFIG_FILE ${DBUS_DATADIR}/dbus-1/session.conf) set(DBUS_USER "messagebus") set(DBUS_TEST_USER "nobody") # For best security, assume that all non-Windows platforms can do @@ -623,11 +640,6 @@ set(DBUS_DAEMON_NAME "dbus-daemon" CACHE STRING "The name of the dbus daemon exe #include(ConfigureChecks.cmake) -# only defined but expected as boolean -if(DEFINED HAVE_DECL_ENVIRON) - set(HAVE_DECL_ENVIRON 1) -endif() - # compiler definitions add_definitions(-DHAVE_CONFIG_H) add_definitions(${DBUS_BUS_CFLAGS}) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d141fb8b..a83fceec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -270,86 +270,7 @@ This section is not directly relevant to infrequent contributors. ### Releasing -To make a release of D-Bus, do the following: - - - check out a fresh copy from Git - - - verify that the libtool versioning/library soname is - changed if it needs to be, or not changed if not - - - update the file NEWS based on the git history - - - verify that the version number of dbus-specification.xml is - changed if it needs to be; if changes have been made, update the - release date in that file - - - update the AUTHORS file with "make update-authors" if necessary - - - the version number should have major.minor.micro, even - if micro is 0, i.e. "1.0.0" and "1.2.0" not "1.0"/"1.2"; the micro - version should be even for releases, and odd for intermediate snapshots - - - "make distcheck" (DO NOT just "make dist" - pass the check!) - - - if make distcheck fails, fix it. - - - once distcheck succeeds, "git commit -a". This is the version - of the tree that corresponds exactly to the released tarball. - - - tag the tree with "git tag -s -m 'Released X.Y.Z' dbus-X.Y.Z" - where X.Y.Z is the version of the release. If you can't sign - then simply created an unsigned annotated tag: - "git tag -a -m 'Released X.Y.Z' dbus-X.Y.Z". - - - bump the version number up in configure.ac (so the micro version is odd), - and commit it. Make sure you do this *after* tagging the previous - release! The idea is that git has a newer version number - than anything released. Similarly, bump the version number of - dbus-specification.xml and set the release date to "(not finalized)". - - - merge the branch you've released to the chronologically-later - branch (usually "master"). You'll probably have to fix a merge - conflict in configure.ac (the version number). - - - push your changes and the tag to the central repository with - git push origin master dbus-X.Y dbus-X.Y.Z - - - scp your tarball to freedesktop.org server and copy it to - dbus.freedesktop.org:/srv/dbus.freedesktop.org/www/releases/dbus/dbus-X.Y.Z.tar.xz. - This should be possible if you're in group "dbus" - - - Update the online documentation with `make -C doc maintainer-upload-docs`. - - - update the wiki page http://www.freedesktop.org/Software/dbus by - adding the new release under the Download heading. Then, cut the - link and changelog for the previous that was there. - - - post to dbus@lists.freedesktop.org announcing the release. - -### Making a ".0" stable release - -We create a branch for each stable release. The branch name should be -dbus-X.Y which is a branch that has releases versioned X.Y.Z; -changes on a stable branch should be limited to significant bug fixes. - -Because we won't make minor changes like keeping up with the latest -deprecations on a stable branch, stable branches should turn off the -gcc warning for deprecated declarations (e.g. see commit 4ebb275ab7). - -Be extra-careful not to merge master (or any branch based on master) into a -stable branch. - -To branch: - - git branch dbus-X.Y - -and upload the branch tag to the server: - - git push origin dbus-X.Y - -To develop in this branch: - - git checkout dbus-X.Y +See maint/release-checklist.md. ### Code reviews @@ -1,4 +1,4 @@ -D-Bus is licensed to you under your choice of the Academic Free +dbus is licensed to you under your choice of the Academic Free License version 2.1, or the GNU General Public License version 2 (or, at your option any later version). @@ -3,10 +3,55 @@ dbus 1.14.2 (UNRELEASED) Fixes: -• When building with Autotools, don't treat --with-x or --with-x=yes - as a request to disable X11, fixing a regression in 1.13.20. - Instead, require X11 libraries and fail if they cannot be detected. - (dbus!263, Lars Wendler) +• Fix build failure on FreeBSD (dbus!277, Alex Richardson) + +• Fix build failure on macOS with launchd enabled + (dbus!287, Dawid Wróbel) + +• Preserve errno on failure to open /proc/self/oom_score_adj + (dbus!285, Gentoo#834725; Mike Gilbert) + +• On Linux, don't log warnings if oom_score_adj is read-only but does not + need to be changed (dbus!291, Simon McVittie) + +• Slightly improve error-handling for inotify + (dbus!235, Simon McVittie) + +• Don't crash if dbus-daemon is asked to watch more than 128 directories + for changes (dbus!302, Jan Tojnar) + +• Autotools build system fixes: + · Don't treat --with-x or --with-x=yes as a request to disable X11, + fixing a regression in 1.13.20. Instead, require X11 libraries and + fail if they cannot be detected. (dbus!263, Lars Wendler) + · When a CMake project uses an Autotools-built libdbus in a + non-standard prefix, find dbus-arch-deps.h successfully + (dbus#314, Simon McVittie) + · Don't include generated XML catalog in source releases + (dbus!317, Jan Tojnar) + · Improve robustness of detecting gcc __sync atomic builtins + (dbus!320, Alex Richardson) + +• CMake build system fixes: + · Detect endianness correctly, fixing interoperability with other D-Bus + implementations on big-endian systems (dbus#375, Ralf Habacker) + · When building for Unix, install session and system bus setup + in the intended locations + (dbus!267, dbus!297; Ralf Habacker, Alex Richardson) + · Detect setresuid() and getresuid() (dbus!319, Alex Richardson) + · Detect backtrace() on FreeBSD (dbus!281, Alex Richardson) + · Don't include headers from parent directory (dbus!282, Alex Richardson) + · Distinguish between host and target TMPDIR when cross-compiling + (dbus!279, Alex Richardson) + · Fix detection of atomic operations (dbus!306, Alex Richardson) + +Tests and CI enhancements: + +• On Unix, skip tests that switch uid if run in a container that is + unable to do so, instead of failing (dbus#407, Simon McVittie) + +• Use the latest MSYS2 packages for CI + (Ralf Habacker, Simon McVittie) dbus 1.14.0 (2022-02-28) ======================== diff --git a/README.cmake b/README.cmake index a1cfc96a..281b730d 100644 --- a/README.cmake +++ b/README.cmake @@ -179,6 +179,9 @@ DBUS_SESSION_BUS_LISTEN_ADDRESS:STRING=autolaunch: // session bus fallback address for clients DBUS_SESSION_BUS_CONNECT_ADDRESS:STRING=autolaunch: +//Default directory for session socket +DBUS_SESSION_SOCKET_DIR:STRING=/tmp + // system bus default address (only useful on Unix) DBUS_SYSTEM_BUS_DEFAULT_ADDRESS:STRING=unix:path=/var/run/dbus/system_bus_socket diff --git a/bus/CMakeLists.txt b/bus/CMakeLists.txt index 26f07dd2..dafee593 100644 --- a/bus/CMakeLists.txt +++ b/bus/CMakeLists.txt @@ -85,7 +85,6 @@ endif() include_directories( ${CMAKE_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/.. ${EXPAT_INCLUDE_DIR} ) diff --git a/bus/activation-helper.c b/bus/activation-helper.c index 8a4fd732..df0472ce 100644 --- a/bus/activation-helper.c +++ b/bus/activation-helper.c @@ -348,7 +348,7 @@ exec_for_correct_user (char *exec, char *user, DBusError *error) /* Resetting the OOM score adjustment is best-effort, so we don't * treat a failure to do so as fatal. */ if (!_dbus_reset_oom_score_adj (&error_str)) - _dbus_warn ("%s: %s", error_str, strerror (errno)); + _dbus_log (DBUS_SYSTEM_LOG_WARNING, "%s: %s", error_str, strerror (errno)); if (!switch_user (user, error)) return FALSE; diff --git a/bus/dir-watch-inotify.c b/bus/dir-watch-inotify.c index 940f09a0..9beadb0e 100644 --- a/bus/dir-watch-inotify.c +++ b/bus/dir-watch-inotify.c @@ -108,12 +108,17 @@ _set_watched_dirs_internal (DBusList **directories) i = 0; link = _dbus_list_get_first_link (directories); - while (link != NULL) + while (link != NULL && i < MAX_DIRS_TO_WATCH) { new_dirs[i++] = (char *)link->data; link = _dbus_list_get_next_link (directories, link); } + if (link != NULL) + { + _dbus_warn ("Too many directories to watch them all, only watching first %d.", MAX_DIRS_TO_WATCH); + } + /* Look for directories in both the old and new sets, if * we find one, move its data into the new set. */ @@ -234,9 +239,9 @@ _init_inotify (BusContext *context) #else inotify_fd = inotify_init (); #endif - if (inotify_fd <= 0) + if (inotify_fd < 0) { - _dbus_warn ("Cannot initialize inotify"); + _dbus_warn ("Cannot initialize inotify: %s", _dbus_strerror (errno)); goto out; } diff --git a/bus/dir-watch-kqueue.c b/bus/dir-watch-kqueue.c index 183db241..a4ed7ca5 100644 --- a/bus/dir-watch-kqueue.c +++ b/bus/dir-watch-kqueue.c @@ -51,7 +51,7 @@ static DBusWatch *watch = NULL; static DBusLoop *loop = NULL; static dbus_bool_t -_handle_kqueue_watch (DBusWatch *watch, unsigned int flags, void *data) +_handle_kqueue_watch (DBusWatch *_watch, unsigned int flags, void *data) { struct kevent ev; struct timespec nullts = { 0, 0 }; @@ -73,6 +73,7 @@ _handle_kqueue_watch (DBusWatch *watch, unsigned int flags, void *data) else if (res < 0 && errno == EBADF) { kq = -1; + _dbus_assert (watch == _watch); if (watch != NULL) { _dbus_loop_remove_watch (loop, watch); @@ -218,12 +219,17 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories) i = 0; link = _dbus_list_get_first_link (directories); - while (link != NULL) + while (link != NULL && i < MAX_DIRS_TO_WATCH) { new_dirs[i++] = (char *)link->data; link = _dbus_list_get_next_link (directories, link); } + if (link != NULL) + { + _dbus_warn ("Too many directories to watch them all, only watching first %d.", MAX_DIRS_TO_WATCH); + } + /* Look for directories in both the old and new sets, if * we find one, move its data into the new set. */ diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 7e21e084..e3a91711 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -34,7 +34,6 @@ check_include_file(sys/stat.h HAVE_SYS_STAT_H) check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(sys/uio.h HAVE_SYS_UIO_H) check_include_file(sys/prctl.h HAVE_SYS_PRCTL_H) -check_include_file(sys/syslimits.h HAVE_SYS_SYSLIMITS_H) # dbus-sysdeps-unix.c check_include_file(sys/time.h HAVE_SYS_TIME_H)# dbus-sysdeps-win.c check_include_file(sys/wait.h HAVE_SYS_WAIT_H)# dbus-sysdeps-win.c check_include_file(time.h HAVE_TIME_H) # dbus-sysdeps-win.c @@ -42,7 +41,9 @@ check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H)# dbus-sysdeps-win.c check_include_file(unistd.h HAVE_UNISTD_H) # dbus-sysdeps-util-win.c check_include_file(sys/inotify.h DBUS_BUS_ENABLE_INOTIFY) -check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE) # dbus-sysdeps.c, dbus-sysdeps-win.c +find_package(Backtrace) # dbus-sysdeps.c, dbus-sysdeps-win.c +set(HAVE_BACKTRACE ${Backtrace_FOUND}) + check_symbol_exists(getgrouplist "grp.h" HAVE_GETGROUPLIST) # dbus-sysdeps.c check_symbol_exists(getpeerucred "ucred.h" HAVE_GETPEERUCRED) # dbus-sysdeps.c, dbus-sysdeps-win.c check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP) # dbus-sysdeps.c @@ -74,6 +75,8 @@ check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF) check_symbol_exists(MSG_NOSIGNAL "sys/socket.h" HAVE_DECL_MSG_NOSIGNAL) check_symbol_exists(environ "unistd.h" HAVE_DECL_ENVIRON) check_symbol_exists(LOG_PERROR "syslog.h" HAVE_DECL_LOG_PERROR) +check_symbol_exists(setresuid "unistd.h" HAVE_SETRESUID) +check_symbol_exists(getresuid "unistd.h" HAVE_GETRESUID) check_struct_member(cmsgcred cmcred_pid "sys/types.h;sys/socket.h" HAVE_CMSGCRED) # dbus-sysdeps.c @@ -135,7 +138,7 @@ CHECK_C_SOURCE_COMPILES(" int main() { int a = 4; int b = __sync_sub_and_fetch(&a, 4); - exit(b); + return b; } " DBUS_USE_SYNC) diff --git a/cmake/DBus1Config.pkgconfig.in b/cmake/DBus1Config.pkgconfig.in index 93c593e1..0f021850 100644 --- a/cmake/DBus1Config.pkgconfig.in +++ b/cmake/DBus1Config.pkgconfig.in @@ -9,6 +9,7 @@ # to a target with target_link_libraries get_filename_component(DBus1_PKGCONFIG_DIR "${CMAKE_CURRENT_LIST_DIR}/../../pkgconfig" ABSOLUTE) +get_filename_component(DBus1_NEARBY_ARCH_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../dbus-1.0/include" ABSOLUTE) find_package(PkgConfig) if(DEFINED ENV{PKG_CONFIG_DIR}) set(_dbus_pkgconfig_dir "$ENV{PKG_CONFIG_DIR}") @@ -51,6 +52,9 @@ find_path(DBus1_INCLUDE_DIR dbus/dbus.h HINTS ${PC_DBUS1_INCLUDEDIR} ${PC_DBUS1_INCLUDE_DIRS} PATH_SUFFIXES dbus-1.0) find_path(DBus1_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h + PATHS ${DBus1_NEARBY_ARCH_INCLUDE_DIR} + NO_DEFAULT_PATH) +find_path(DBus1_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h HINTS ${PC_DBUS1_INCLUDE_DIRS} PATH_SUFFIXES dbus-1.0) find_library(DBus1_LIBRARY NAMES ${PC_DBUS1_LIBRARIES} diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 4215a903..fa42023f 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -21,6 +21,9 @@ * should be placed in this file */ +/* AC_C_BIGENDIAN */ +#cmakedefine WORDS_BIGENDIAN + /* Opt-in to modern APIs and thread-safety for Solaris. In the Autotools * build system we do the equivalent of this by appending to CFLAGS * in configure.ac */ @@ -148,9 +151,6 @@ #cmakedefine HAVE_SYS_RESOURCE_H 1 #cmakedefine HAVE_SYS_STAT_H 1 -/* Define to 1 if you have sys/syslimits.h */ -#cmakedefine HAVE_SYS_SYSLIMITS_H 1 - /* Define to 1 if you have sys/time.h */ #cmakedefine HAVE_SYS_TIME_H 1 @@ -243,10 +243,12 @@ #cmakedefine DBUS_HAVE_LINUX_EPOLL 1 /* Use the gcc __sync extension */ -#cmakedefine DBUS_USE_SYNC 1 +#cmakedefine01 DBUS_USE_SYNC #cmakedefine HAVE_VASPRINTF 1 #cmakedefine HAVE_VSNPRINTF 1 +#cmakedefine HAVE_SETRESUID 1 +#cmakedefine HAVE_GETRESUID 1 /* whether -export-dynamic was passed to libtool */ #cmakedefine DBUS_BUILT_R_DYNAMIC 1 diff --git a/configure.ac b/configure.ac index e33df00b..d1055514 100644 --- a/configure.ac +++ b/configure.ac @@ -424,7 +424,6 @@ stdint.h sys/prctl.h sys/random.h sys/resource.h -sys/syslimits.h sys/time.h unistd.h ws2tcpip.h @@ -613,7 +612,7 @@ AS_IF([test -n "$dbus_va_copy_func"], AC_CACHE_CHECK([whether $CC knows __sync_sub_and_fetch()], dbus_cv_sync_sub_and_fetch, [AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[]], [[int a = 4; int b = __sync_sub_and_fetch(&a, 4); exit(b); ]])], + AC_LANG_PROGRAM([[]], [[int a = 4; int b = __sync_sub_and_fetch(&a, 4); return b; ]])], [dbus_cv_sync_sub_and_fetch=yes], [dbus_cv_sync_sub_and_fetch=no]) ]) diff --git a/dbus/CMakeLists.txt b/dbus/CMakeLists.txt index e9203ca6..9e3f0a14 100644 --- a/dbus/CMakeLists.txt +++ b/dbus/CMakeLists.txt @@ -292,6 +292,10 @@ else(WIN32) if(LIBSOCKET) target_link_libraries(dbus-1 ${LIBSOCKET}) endif() + if (HAVE_BACKTRACE) + target_link_libraries(dbus-1 ${Backtrace_LIBRARY}) + target_include_directories(dbus-1 PRIVATE ${Backtrace_INCLUDE_DIR}) + endif() endif() target_include_directories(dbus-1 INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/dbus-1.0>;$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}/dbus-1.0/include>) diff --git a/dbus/dbus-server-launchd.c b/dbus/dbus-server-launchd.c index 21292973..5c2b1d65 100644 --- a/dbus/dbus-server-launchd.c +++ b/dbus/dbus-server-launchd.c @@ -39,6 +39,7 @@ #ifdef DBUS_ENABLE_LAUNCHD #include <launch.h> #include <errno.h> +#include <unistd.h> #include "dbus-misc.h" #include "dbus-server-socket.h" diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index 314ce64b..9fe7d55f 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -43,6 +43,7 @@ #include <stdio.h> #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <sys/stat.h> #ifdef HAVE_SYS_RESOURCE_H #include <sys/resource.h> @@ -56,10 +57,6 @@ #include <sys/prctl.h> #endif -#ifdef HAVE_SYS_SYSLIMITS_H -#include <sys/syslimits.h> -#endif - #ifdef HAVE_SYSTEMD #include <systemd/sd-daemon.h> #endif @@ -1627,13 +1624,14 @@ _dbus_reset_oom_score_adj (const char **error_str_p) const char *error_str = NULL; #ifdef O_CLOEXEC - fd = open ("/proc/self/oom_score_adj", O_RDWR | O_CLOEXEC); + fd = open ("/proc/self/oom_score_adj", O_RDONLY | O_CLOEXEC); #endif if (fd < 0) { - fd = open ("/proc/self/oom_score_adj", O_RDWR); - _dbus_fd_set_close_on_exec (fd); + fd = open ("/proc/self/oom_score_adj", O_RDONLY); + if (fd >= 0) + _dbus_fd_set_close_on_exec (fd); } if (fd >= 0) @@ -1679,6 +1677,26 @@ _dbus_reset_oom_score_adj (const char **error_str_p) goto out; } + close (fd); +#ifdef O_CLOEXEC + fd = open ("/proc/self/oom_score_adj", O_WRONLY | O_CLOEXEC); + + if (fd < 0) +#endif + { + fd = open ("/proc/self/oom_score_adj", O_WRONLY); + if (fd >= 0) + _dbus_fd_set_close_on_exec (fd); + } + + if (fd < 0) + { + ret = FALSE; + error_str = "open(/proc/self/oom_score_adj) for writing"; + saved_errno = errno; + goto out; + } + if (pwrite (fd, "0", sizeof (char), 0) < 0) { ret = FALSE; @@ -1699,7 +1717,7 @@ _dbus_reset_oom_score_adj (const char **error_str_p) else { ret = FALSE; - error_str = "open(/proc/self/oom_score_adj)"; + error_str = "open(/proc/self/oom_score_adj) for reading"; saved_errno = errno; goto out; } diff --git a/doc/Makefile.am b/doc/Makefile.am index 605f8666..471ac2b5 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -30,7 +30,7 @@ xmlcatalogdir = $(dtddir) catalog.xml: catalog.xml.in $(SED) "s|@DBUS_DTD_DIR@|$(dtddir)|" $< >$@ -dist_xmlcatalog_DATA = \ +xmlcatalog_DATA = \ catalog.xml dist_doc_DATA = system-activation.txt @@ -211,6 +211,7 @@ endif CLEANFILES = \ $(man1_MANS) \ $(MAN_XML_FILES) \ + $(xmlcatalog_DATA) \ $(XMLTO_HTML) \ $(YELP_HTML) \ $(YELP_STATIC_HTML) \ diff --git a/maint/release-checklist.md b/maint/release-checklist.md new file mode 100644 index 00000000..5de87933 --- /dev/null +++ b/maint/release-checklist.md @@ -0,0 +1,82 @@ +# dbus release checklist + +To make a release of D-Bus, do the following: + + - check out a fresh copy from Git + + - verify that the libtool versioning/library soname is + changed if it needs to be, or not changed if not + + - update the file NEWS based on the git history + + - verify that the version number of dbus-specification.xml is + changed if it needs to be; if changes have been made, update the + release date in that file + + - update the AUTHORS file with "make update-authors" if necessary + + - the version number should have major.minor.micro, even + if micro is 0, i.e. "1.0.0" and "1.2.0" not "1.0"/"1.2"; the micro + version should be even for releases, and odd for intermediate snapshots + + - "make distcheck" (DO NOT just "make dist" - pass the check!) + + - if make distcheck fails, fix it. + + - once distcheck succeeds, "git commit -a". This is the version + of the tree that corresponds exactly to the released tarball. + + - tag the tree with "git tag -s -m 'Released X.Y.Z' dbus-X.Y.Z" + where X.Y.Z is the version of the release. If you can't sign + then simply created an unsigned annotated tag: + "git tag -a -m 'Released X.Y.Z' dbus-X.Y.Z". + + - bump the version number up in configure.ac (so the micro version is odd), + and commit it. Make sure you do this *after* tagging the previous + release! The idea is that git has a newer version number + than anything released. Similarly, bump the version number of + dbus-specification.xml and set the release date to "(not finalized)". + + - merge the branch you've released to the chronologically-later + branch (usually "master"). You'll probably have to fix a merge + conflict in configure.ac (the version number). + + - push your changes and the tag to the central repository with + git push origin master dbus-X.Y dbus-X.Y.Z + + - scp your tarball to freedesktop.org server and copy it to + dbus.freedesktop.org:/srv/dbus.freedesktop.org/www/releases/dbus/dbus-X.Y.Z.tar.xz. + This should be possible if you're in group "dbus" + + - Update the online documentation with `make -C doc maintainer-upload-docs`. + + - update the wiki page http://www.freedesktop.org/Software/dbus by + adding the new release under the Download heading. Then, cut the + link and changelog for the previous that was there. + + - post to dbus@lists.freedesktop.org announcing the release. + +## Making a ".0" stable release + +We create a branch for each stable release. The branch name should be +dbus-X.Y which is a branch that has releases versioned X.Y.Z; +changes on a stable branch should be limited to significant bug fixes. + +Because we won't make minor changes like keeping up with the latest +deprecations on a stable branch, stable branches should turn off the +gcc warning for deprecated declarations (e.g. see commit 4ebb275ab7). + +Be extra-careful not to merge master (or any branch based on master) into a +stable branch. + +To branch: + + git branch dbus-X.Y + +and upload the branch tag to the server: + + git push origin dbus-X.Y + +To develop in this branch: + + git checkout dbus-X.Y diff --git a/test/test-utils-glib.c b/test/test-utils-glib.c index 2aafb03e..231860a1 100644 --- a/test/test-utils-glib.c +++ b/test/test-utils-glib.c @@ -40,6 +40,7 @@ # include <unistd.h> # include <sys/socket.h> # include <sys/types.h> +# include <sys/wait.h> # include <pwd.h> #endif @@ -66,6 +67,61 @@ _test_assert_no_error (const DBusError *e, } #ifdef DBUS_UNIX +static gboolean +can_become_user_or_skip (uid_t uid) +{ + gchar *message; + pid_t child_pid; + pid_t pid; + int wstatus; + + /* We can't switch to the uid without affecting the whole process, + * which we don't necessarily want to do, so try it in a child process. */ + child_pid = fork (); + + if (child_pid < 0) + g_error ("fork: %s", g_strerror (errno)); + + if (child_pid == 0) + { + /* Child process: try to become uid, exit 0 on success, exit with + * status = errno on failure */ + + if (setuid (uid) != 0) + { + /* make sure we report failure even if errno is wrong */ + if (errno == 0) + errno = ENODATA; + + _exit (errno); + } + + /* success */ + _exit (0); + } + + /* Parent process: wait for child and report result */ + + pid = waitpid (child_pid, &wstatus, 0); + g_assert_cmpuint (child_pid, ==, pid); + + if (WIFEXITED (wstatus) && WEXITSTATUS (wstatus) == 0) + return TRUE; + + if (WIFEXITED (wstatus)) + message = g_strdup_printf ("unable to become uid %lu: %s", + (unsigned long) uid, + g_strerror (WEXITSTATUS (wstatus))); + else + message = g_strdup_printf ("unable to become uid %lu: unknown wait status %d", + (unsigned long) uid, + wstatus); + + g_test_skip (message); + g_free (message); + return FALSE; +} + static void child_setup (gpointer user_data) { @@ -141,6 +197,9 @@ spawn_dbus_daemon (const gchar *binary, return NULL; } + if (!can_become_user_or_skip (pwd->pw_uid)) + return NULL; + if (user == TEST_USER_ROOT_DROP_TO_MESSAGEBUS) { /* Let the dbus-daemon start as root and drop privileges @@ -163,6 +222,9 @@ spawn_dbus_daemon (const gchar *binary, return NULL; } + if (!can_become_user_or_skip (pwd->pw_uid)) + return NULL; + break; case TEST_USER_ME: diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index f1a5b970..74e39691 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -846,9 +846,7 @@ main (int argc, char **argv) dbus_bool_t user_bus_supported = FALSE; DBusString user_bus; const char *error_str; -#ifdef DBUS_BUILD_X11 DBusError error = DBUS_ERROR_INIT; -#endif exit_with_session = FALSE; config_file = NULL; |