Find a file
Simon McVittie 3072109b11 On 32-bit glibc, define _TIME_BITS to 64 if not already defined
On older 32-bit architectures such as i386, this redefines time_t to be
64-bit, and correspondingly increases the size of all system data
structures that contain a time_t, such as struct timeval and struct stat.
This is necessary to allow timestamps beyond January 2038 to be
represented; as well as things that obviously deal with timestamps,
this affects functions like stat() (and therefore our wrapper
_dbus_stat()), which will fail with EOVERFLOW if asked to inspect a
file whose correct timestamp does not fit in time_t.

In particular, if the modification or access timestamp on
/etc/machine-id has somehow been set to a post-2038 time, libdbus will
consider the inability to stat() that file to be an installation error,
and when using the deprecated dbus_get_local_machine_id(), that can
cause third-party i386 software such as the Steam client to crash.
Using 64-bit timestamps avoids that failure mode.

Using 64-bit timestamps in glibc is an opt-in and not the default,
because if done carelessly it can change libraries' ABIs. However,
libdbus is careful not to include system headers and system data
types in its own headers, with the only exceptions being extremely
basic ISO C headers like <stddef.h> and <stdarg.h>; so we can safely
do this without it breaking our ABI. This is similar to the reasoning
for why commit 96ffc2a0 "configure.ac: support large-file for stat64"
was a safe change.

This change only affects glibc. Some non-GNU operating system libraries
(such as musl) are less concerned with binary backwards compatibility
than glibc, and therefore have incompatibly changed their ABI on 32-bit
platforms to switch to 64-bit timestamps throughout; no action is needed
on those platforms. If other non-GNU OS libraries have taken a route
similar to GNU's, then maintainers of those operating systems are
welcome to send tested merge requests similar to this one.

An extra subtlety here is that _TIME_BITS=64 requires
_FILE_OFFSET_BITS=64. In the Meson build, Meson unconditionally enables
_FILE_OFFSET_BITS=64 where appropriate, and in the Autotools build,
we already had that via AC_SYS_LARGEFILE, but in the CMake build we
did not necessarily have this; so we also define _FILE_OFFSET_BITS=64
there if necessary, as a continuation of commit 96ffc2a0
"configure.ac: support large-file for stat64".

On newer 32-bit architectures like x32, time_t is always 64-bit and so
this has no practical effect.

On 64-bit, setting these would have no practical effect, but to minimize
risk I'm only doing this for 32-bit architectures.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/465
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-14 14:18:25 +00:00
.gitlab/issue_templates Add feature template 2022-03-18 08:36:35 +01:00
bus bus: return ProcessFD in GetConnectionCredentials() 2023-08-08 12:24:20 +01:00
cmake On 32-bit glibc, define _TIME_BITS to 64 if not already defined 2023-08-14 14:18:25 +00:00
dbus _dbus_asv_add_unix_fd: add 2023-08-08 12:24:20 +01:00
doc spec: add ProcessFD to GetConnectionCredentials() 2023-08-01 19:31:33 +00:00
LICENSES Add SPDX license marker for the FSFULLR license 2023-01-03 19:24:02 +00:00
m4 Add SPDX license marker for the FSFULLR license 2023-01-03 19:24:02 +00:00
maint maint: Make update-authors.sh executable when not going via a shell 2022-09-22 13:52:24 +01:00
subprojects subprojects: Allow expat and GLib to be built as subprojects 2022-07-13 20:36:13 +01:00
test DBusCredentials: add support for PID FDs via SO_PEERPIDFD 2023-08-08 12:24:20 +01:00
tools tools/ci-build.sh: cleanup setup and usage of ci_builddir 2023-08-07 19:59:16 +02:00
.clang-format clang-format: don't align escaped newlines in macro definitions 2022-09-21 11:35:05 +00:00
.editorconfig .editorconfig: Automatically configure multiple text editors 2022-05-20 12:17:48 +00:00
.gitignore m4: Stop shipping our own copy of pkg.m4 2022-10-12 06:20:33 +00:00
.gitlab-ci.yml CI: add prefix 'ci_' to env var 'builddir' 2023-08-07 19:49:53 +02:00
.mailmap Reduce duplicates from authors list 2011-08-06 00:08:22 +02:00
AUTHORS AUTHORS: Update 2023-06-06 13:58:16 +01:00
autogen.sh autogen.sh: fail cleanly if autoconf fails 2016-08-15 20:11:49 +01:00
cleanup-man-pages.sh 2006-10-21 Havoc Pennington <hp@redhat.com> 2006-10-22 00:31:08 +00:00
CMakeLists.txt Let cmake retrieve version and variable information from meson build system 2023-08-07 16:10:21 +02:00
configure.ac On 32-bit glibc, define _TIME_BITS to 64 if not already defined 2023-08-14 14:18:25 +00:00
CONTRIBUTING.md Move release checklist to its own file 2022-07-23 11:23:06 +01:00
COPYING Fix some stray filename references for GPL-2.0-or-later 2022-11-29 20:43:01 +00:00
dbus-1-uninstalled.pc.in Let pkg-config expand directory variables recursively 2014-10-13 13:41:36 +01:00
dbus-1.pc.in cmake: Optionally create relocatable dbus-1.pc file 2017-03-20 14:14:42 +00:00
Doxyfile.in Doxyfile: browse for build-dir sources 2022-05-18 16:40:30 +01:00
INSTALL dir-watch: remove dnotify backend 2013-06-28 11:53:29 +01:00
Makefile.am Add missing license text for LGPL-2.1-or-later 2022-11-29 20:43:49 +00:00
meson.build On 32-bit glibc, define _TIME_BITS to 64 if not already defined 2023-08-14 14:18:25 +00:00
meson_options.txt meson: Introduce message_bus and tools command line option 2023-01-04 09:35:06 +01:00
meson_post_install.py meson_post_install.py: Correct path to dbus-daemon-launch-helper 2022-07-13 20:36:13 +01:00
NEWS Release v1.15.6 2023-06-06 14:00:04 +01:00
NEWS.pre-1-0 * Split NEWS and ChangeLog into a .pre-1-0 file as per HACKING 2007-05-25 20:49:50 +00:00
NEWS.pre-1-2 getting ready for 1.2 stable branch 2008-04-04 15:37:50 -04:00
README README: Mention not opening merge requests for security issues 2023-06-06 10:41:35 +01:00
README.cmake Bump CMake version to 3.4 2022-07-25 14:14:56 -05:00
README.cygwin Clean up cygwin readme 2011-08-06 00:36:42 +02:00
README.launchd Enable launchd. 2010-12-06 21:33:14 +01:00
README.valgrind Add documentation on running clients with Valgrind 2012-11-09 15:27:27 +00:00
README.win NEWS, README.win: Officially drop support for non-C99 compilers 2022-07-19 20:45:24 +01:00
README.wince Add README for Windows CE. 2010-04-13 21:09:09 +02:00

Sections in this file describe:
 - introduction and overview
 - low-level vs. high-level API
 - version numbers
 - options to the configure script
 - ABI stability policy

Introduction
===

D-Bus is a simple system for interprocess communication and coordination.

The "and coordination" part is important; D-Bus provides a bus daemon that does things like:
 - notify applications when other apps exit
 - start services on demand
 - support single-instance applications

See https://www.freedesktop.org/wiki/Software/dbus/ for lots of documentation,
mailing lists, etc.

See also the file CONTRIBUTING.md for notes of interest to developers
working on D-Bus.

If you're considering D-Bus for use in a project, you should be aware
that D-Bus was designed for a couple of specific use cases, a "system
bus" and a "desktop session bus." These are documented in more detail
in the D-Bus specification and FAQ available on the web site.

If your use-case isn't one of these, D-Bus may still be useful, but
only by accident; so you should evaluate carefully whether D-Bus makes
sense for your project.

Security
===

If you find a security vulnerability that is not known to the public,
please report it privately to dbus-security@lists.freedesktop.org
or by reporting a Gitlab issue at
https://gitlab.freedesktop.org/dbus/dbus/issues/new and marking it
as "confidential".
Please do not open merge requests for security issues: if you have a
proposed patch, it can be discussed on the confidential issue or by
private email.

On Unix systems, the system bus (dbus-daemon --system) is designed
to be a security boundary between users with different privileges.

On Unix systems, the session bus (dbus-daemon --session) is designed
to be used by a single user, and only accessible by that user.

We do not currently consider D-Bus on Windows to be security-supported,
and we do not recommend allowing untrusted users to access Windows
D-Bus via TCP.

Note: low-level API vs. high-level binding APIs
===

A core concept of the D-Bus implementation is that "libdbus" is
intended to be a low-level API. Most programmers are intended to use
the bindings to GLib, Qt, Python, Mono, Java, or whatever. These
bindings have varying levels of completeness and are maintained as
separate projects from the main D-Bus package. The main D-Bus package
contains the low-level libdbus, the bus daemon, and a few command-line
tools such as dbus-launch.

If you use the low-level API directly, you're signing up for some
pain. Think of the low-level API as analogous to Xlib or GDI, and the
high-level API as analogous to Qt/GTK+/HTML.

Version numbers
===

D-Bus uses the common "Linux kernel" versioning system, where
even-numbered minor versions are stable and odd-numbered minor
versions are development snapshots.

So for example, development snapshots: 1.1.1, 1.1.2, 1.1.3, 1.3.4
Stable versions: 1.0, 1.0.1, 1.0.2, 1.2.1, 1.2.3

All pre-1.0 versions were development snapshots.

Development snapshots make no ABI stability guarantees for new ABI
introduced since the last stable release. Development snapshots are
likely to have more bugs than stable releases, obviously.

Configuration
===

This branch of dbus can be built by using Autotools, CMake or Meson.
The Meson build system is the recommended build system for the master
branch (versions >= 1.15.0).

Meson only supports out-of-tree builds, and must be passed a directory to put
built and generated sources into. We'll call that directory "build" here. It's
recommended to create a separate build directory for each configuration you
might want to use.

Basic configuration is done with:

``` sh
meson build/
```

This will create the build directory. If any dependencies are missing, you can
install them, or try to remove the dependency with a Meson configuration option
(see below).

Configuration flags
===

When using Meson, to review the options which Meson chose, run:

``` sh
meson configure build/
```

With additional arguments meson configure can be used to change options for a
previously configured build directory. All options passed to this command are in
the form `-D "option"="value"`. For example:

``` sh
meson configure build/ -Dprefix=/tmp/install
```


Building
===

To build with meson, here is a quick guide:

``` sh
cd dbus
meson setup build/ && cd build/
meson compile
meson test
```

Full build instructions can be found on mesonbuild website:
https://mesonbuild.com/Running-Meson.html


Configuration and Building for Older Versions
===

Older versions of dbus required Autotools or CMake, with Autotools
recommended for Unix systems and CMake recommended for Windows systems.

When using Autotools, the configure step is initiated by running ./configure
with or without additional configuration flags. dbus requires GNU Make
(on BSD systems, this is typically called gmake) or a "make" implementation
with compatible extensions.

When using CMake, the configure step is initiated by running the cmake
program with or without additional configuration flags.

When using Autotools, run "./configure --help" to see the possible
configuration options and environment variables.

When using CMake, inspect README.cmake to see the possible
configuration options and environment variables.

Building instructions using cmake are described under README.cmake

API/ABI Policy
===

Now that D-Bus has reached version 1.0, the objective is that all
applications dynamically linked to libdbus will continue working
indefinitely with the most recent system and session bus daemons.

 - The protocol will never be broken again; any message bus should 
   work with any client forever. However, extensions are possible
   where the protocol is extensible.

 - If the library API is modified incompatibly, we will rename it 
   as in http://ometer.com/parallel.html - in other words, 
   it will always be possible to compile against and use the older 
   API, and apps will always get the API they expect.

Interfaces can and probably will be _added_. This means both new
functions and types in libdbus, and new methods exported to
applications by the bus daemon.

The above policy is intended to make D-Bus as API-stable as other
widely-used libraries (such as GTK+, Qt, Xlib, or your favorite
example). If you have questions or concerns they are very welcome on
the D-Bus mailing list.

NOTE ABOUT DEVELOPMENT SNAPSHOTS AND VERSIONING

Odd-numbered minor releases (1.1.x, 1.3.x, 2.1.x, etc. -
major.minor.micro) are devel snapshots for testing, and any new ABI
they introduce relative to the last stable version is subject to
change during the development cycle.

Any ABI found in a stable release, however, is frozen.

ABI will not be added in a stable series if we can help it. i.e. the
ABI of 1.2.0 and 1.2.5 you can expect to be the same, while the ABI of
1.4.x may add more stuff not found in 1.2.x.

NOTE ABOUT STATIC LINKING

We are not yet firmly freezing all runtime dependencies of the libdbus
library. For example, the library may read certain files as part of
its implementation, and these files may move around between versions.

As a result, we don't yet recommend statically linking to
libdbus. Also, reimplementations of the protocol from scratch might
have to work to stay in sync with how libdbus behaves.

To lock things down and declare static linking and reimplementation to
be safe, we'd like to see all the internal dependencies of libdbus
(for example, files read) well-documented in the specification, and
we'd like to have a high degree of confidence that these dependencies
are supportable over the long term and extensible where required.

NOTE ABOUT HIGH-LEVEL BINDINGS

Note that the high-level bindings are _separate projects_ from the
main D-Bus package, and have their own release cycles, levels of
maturity, and ABI stability policies. Please consult the documentation
for your binding.

Bootstrapping D-Bus on new platforms
===

A full build of dbus, with all regression tests enabled and run, depends
on GLib. A full build of GLib, with all regression tests enabled and run,
depends on dbus.

To break this cycle, don't enable full test coverage (for at least one
of those projects) during bootstrapping. You can rebuild with full test
coverage after you have built both dbus and GLib at least once.