Commit graph

3407 commits

Author SHA1 Message Date
Lennart Poettering 6e6fb527f9 shared: add API for replacing @FOO@ style variables in strings 2012-11-14 22:21:16 +01:00
Lennart Poettering 409bc9c33e util: add strreplace() to replace a substring by another string 2012-11-14 22:21:16 +01:00
Lennart Poettering 7ae03f3697 specifier: minor modernizations 2012-11-14 22:21:16 +01:00
Lennart Poettering 0290296582 polkit: fix type on comparison 2012-11-14 22:21:16 +01:00
Thomas Hindoe Paaboel Andersen 377ec8bf19 delta.c: fix option '-t'
Both the help and man page claims that it accepts -t with an argument
so let's do that.
2012-11-14 00:18:02 +01:00
Thomas Hindoe Paaboel Andersen e26970a82c delta.c: use _cleanup_ 2012-11-13 23:45:41 +01:00
Marti Raudsepp 73c0495f68 python: add journal backend for the logging framework
Supports Python versions 2.6 through 3.3 (tested on 2.7 and 3.2).
See JournalHandler docstring for usage details.

[zj: - use send() instead of using sendv() directly
     - do exception handling like in the logging module
     - bumped min version to python2.6, since the module
       does not work with python2.5 anyway ]
2012-11-13 11:13:52 +01:00
Zbigniew Jędrzejewski-Szmek 0c0271841a systemd-analyze: use argparse instead of getopt
Makes the output way nicer with shorter code. Also brings
systemd-analyze behaviour more in line with other systemd-programs.

Argparse is in Python since 2.6, and is available as a package for
previous versions, if someone is stuck with very old Python.
2012-11-13 02:23:02 +01:00
Zbigniew Jędrzejewski-Szmek c94f4b8b53 systemd-python: fix nesting of #ifs and #pragmas 2012-11-13 02:23:02 +01:00
Zbigniew Jędrzejewski-Szmek 6b6ed3e3eb shared/socket-util: kill gcc warning about uninitialized variable
The warning was invalid, but distracting.
2012-11-13 02:23:02 +01:00
Kay Sievers bf9d233f78 udev: properly handle symlink removal by 'change' event
If a 'change' event is supposed to remove created symlinks, we create
a new device structure from the sysfs device and fill it with the list
of links, to compute the delta of the old and new list of links to apply.
If the device is already 'remove'd by the kernel though, udev fails to
create the device structure, so the links are not removed properly.

> From: Neil Brown <nfbrown@suse.com>
> Date: Thu, 8 Nov 2012 10:39:06 +0100
> Subject: [PATCH] If a 'change' event does not get handled by udev until
> after the device has subsequently disappeared, udev mis-handles
> it. This can happen with 'md' devices which emit a change
> event and then a remove event when they are stopped. It is
> normally only noticed if udev is very busy (lots of arrays
> being stopped at once) or the machine is otherwise loaded
> and reponding slowly.
>
> There are two problems.
>
> 1/ udev_device_new_from_syspath() will refuse to create the device
>    structure if the device does not exist in /sys, and particularly if
>    the uevent file does not exist.
>    If a 'db' file does exist, that is sufficient evidence that the device
>    is genuine and should be created.  Equally if we have just received an
>    event from the kernel about the device, it must be real.
>
>    This patch just disabled the test for the 'uevent' file, it doesn't
>    try imposing any other tests - it isn't clear that they are really
>    needed.
>
> 2/ udev_event_execute_rules() calls udev_device_read_db() on a 'device'
>    structure that is largely uninitialised and in particular does not
>    have the 'subsystem' set.  udev_device_read_db() needs the subsystem
>    so it tries to read the 'subsystem' symlink out of sysfs.  If the
>    device is already deleted, this naturally fails.
>    udev_event_execute_rules() knows the subsystem (as it was in the
>    event message) so this patch simply sets the subsystem for the device
>    structure to be loaded to match the subsystem of the device structure
>    that is handling the event.
>
> With these two changes, deleted handling of change events will still
> correctly remove any symlinks that are not needed any more.

Use udev_device_new() instead of allowing udev_device_new_from_syspath()
to proceed without a sysfs device.
2012-11-13 02:14:17 +01:00
Mauro Dreissig cf2292f5ac libudev: avoid leak during realloc failure 2012-11-13 01:59:33 +01:00
Thomas Hindoe Paaboel Andersen 33b4055123 remove duplicate semicolons 2012-11-12 22:38:44 +01:00
Michal Schmidt 45a5ff0de7 util: nicer tree drawings
Draw trees more similar to pstree/findmnt/lsblk/...
2012-11-12 22:27:48 +01:00
Dave Reisner a9cdc94f7f enable localization for common *ctl commands 2012-11-12 14:16:07 -05:00
Kay Sievers 1298001ec5 use the same email address everywhere 2012-11-12 19:47:43 +01:00
Kay Sievers 88a6477ef3 libudev: update copyright headers 2012-11-12 17:50:33 +01:00
Kay Sievers 40fe8b11be udev: use usec_t and now() 2012-11-12 01:03:14 +01:00
Kay Sievers 2311eb2ff0 timedatectl: properly print 30 minutes DST transitions 2012-11-11 16:55:25 +01:00
Dave Reisner ef216ca3d7 coredumpctl: add missing -F, --field option to help 2012-11-09 14:14:53 -05:00
Dave Reisner 584f587295 systemd-coredumpctl: add 'gdb' to usage output 2012-11-09 10:04:08 -05:00
Lennart Poettering bece1f5215 dbus: when verifying PK privs, bypass PK if uid=0 of client
This reduces the number of roundtrips when the client is privileged and
makes the PK dep optional for root clients.
2012-11-09 15:55:36 +01:00
Kay Sievers a660c63c55 udev: net_id - add builtin to retrieve data for network devices 2012-11-09 13:05:19 +01:00
Kay Sievers 59803c380d udev: hwdb - search parents for 'modalias' and data 2012-11-09 13:05:11 +01:00
Kay Sievers c3cfed0d6c udev: update file headers 2012-11-09 12:39:27 +01:00
Michal Schmidt 40b8acd039 fstab-generator: more specific error messages 2012-11-09 12:00:46 +01:00
Dave Reisner 8db9d8c2a4 cryptsetup: fix inverted comparison in pass_volume_key 2012-11-06 10:18:10 -05:00
Dave Reisner e4f44e734c Revert "Implement SocketUser= and SocketGroup= for [Socket]"
This was never intended to be pushed.

This reverts commit aea54018a5.
2012-11-06 09:54:17 -05:00
Dave Reisner 65343c7494 cryptsetup: hash=plain means don't use a hash
"plain" is a semantic value that cryptsetup(8) uses to describe a plain
dm-crypt volume that does not use a hash. Catch this value earlier and
ensure that a NULL params.hash is passed to crypt_format to avoid
passing an invalid hash type to the libcryptsetup backend.

FDO bug #56593.
2012-11-06 09:53:00 -05:00
Dave Reisner aea54018a5 Implement SocketUser= and SocketGroup= for [Socket]
Since we already allow defining the mode of AF_UNIX sockets and FIFO, it
makes sense to also allow specific user/group ownership of the socket
file for restricting access.
2012-11-05 21:17:55 -05:00
Kay Sievers 6aa220e019 mount-setup: try mounting 'efivarfs' only if the system bootet with EFI 2012-11-04 17:03:48 +01:00
Kay Sievers 3dfb265083 kmod-setup: mounting efivarfs, *after* we tried to mount it, is pointless
The mount() system call, which we issue before loading modules, will trigger
a modprobe by the kernel and block until it returns. Trying to load it again
later, will have exactly the same result as the first time.
2012-11-04 17:00:57 +01:00
Kay Sievers 1022373284 kmod-setup: add conditional module loading callback 2012-11-04 16:54:19 +01:00
Kay Sievers c1e5704657 shared: add is_efiboot() 2012-11-04 16:06:27 +01:00
Dave Reisner 075ff6863d drop Arch Linux support for reading /etc/rc.conf 2012-11-03 20:11:52 -04:00
Dave Reisner 53d05b44f1 drop Arch Linux support for reading /etc/rc.conf 2012-11-03 19:59:42 -04:00
Miklos Vajna da974c2ff2 vconsole: remove Frugalware legacy file support 2012-11-03 21:23:37 +01:00
Michal Schmidt c339d9775d util : fallback to plain ASCII drawing if locale is not UTF-8
When printing cgroup and sysfs hierarchies, avoid using UTF-8 box drawing
characters if the locale is not UTF-8.

https://bugzilla.redhat.com/show_bug.cgi?id=871153
2012-11-02 17:39:52 +01:00
Michal Schmidt 0901758558 util: add is_locale_utf8()
journalctl and vconsole-setup both implement utf8 locale detection.
Let's have a common function for it.
The next patch will add another use.
2012-11-02 17:27:15 +01:00
Cosimo Cecchi 4940c64240 analyze: use GDBus instead of dbus-python 2012-11-02 16:54:28 +01:00
Kay Sievers e2fd5e5ba2 timedatectl: show "DST active: n/a" if no DST data is available 2012-11-02 05:45:02 -10:00
Kay Sievers f18ca9dcde timedatectl: explain everything nobody wants to know about DST 2012-11-02 03:45:07 +01:00
Kay Sievers b7f1542c8b shared: add timer_get_dst() 2012-11-02 00:44:23 +01:00
Kay Sievers 3a4431ef72 udev: break over-long lines 2012-11-02 00:32:10 +01:00
Lennart Poettering 669b04a492 service: drop special HTTP server target, as it is a bad idea anf Fedora specific
This was premarily intended to support the LSB facility $httpd which is
only known by Fedora, and a bad idea since it lacks any real-life
usecase.

Similar, drop support for some other old Fedora-specific facilities.

Also, document the rules for introduction of new facilities, to clarify
the situation for the future.
2012-10-31 02:55:04 +01:00
Lennart Poettering 1fd8d04e38 strv: cleanup error path loops
https://bugzilla.redhat.com/show_bug.cgi?id=858799
2012-10-30 18:30:45 +01:00
Michal Schmidt 8511dd1871 shared: "max" in the string->number conversion is meant to be inclusive 2012-10-30 15:46:49 +01:00
Michal Schmidt f8b69d1dfc shared, core: do not always accept numbers in string lookups
The behaviour of the common name##_from_string conversion is surprising.
It accepts not only the strings from name##_table but also any number
that falls within the range of the table. The order of items in most of
our tables is an internal affair. It should not be visible to the user.

I know of a case where the surprising numeric conversion leads to a crash.

We will allow the direct numeric conversion only for the tables where the
mapping of strings to numeric values has an external meaning. This holds
for the following lookup tables:
 - netlink_family, ioprio_class, ip_tos, sched_policy - their numeric
   values are stable as they are defined by the Linux kernel interface.
 - log_level, log_facility_unshifted - the well-known syslog interface.

We allow the user to use numeric values whose string names systemd does
not know. For instance, the user may want to test a new kernel featuring
a scheduling policy that did not exist when his systemd version was
released. A slightly unpleasant effect of this is that the
name##_to_string conversion cannot return pointers to constant strings
anymore. The strings have to be allocated on demand and freed by the
caller.
2012-10-30 15:41:15 +01:00
Zbigniew Jędrzejewski-Szmek 4f76ae1b4b coredumpctl: add --field/-F option
Useful for completion generation.
2012-10-30 11:26:49 +01:00
Zbigniew Jędrzejewski-Szmek 9a34088094 coredumpctl: add --no-legend option
Useful for completion generation.
2012-10-30 11:26:49 +01:00