Hello community, here is the log from the commit of package systemd for openSUSE:Factory checked in at 2015-03-09 09:20:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/systemd (Old) and /work/SRC/openSUSE:Factory/.systemd.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "systemd" Changes: -------- --- /work/SRC/openSUSE:Factory/systemd/systemd-mini.changes 2015-03-05 15:28:46.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.systemd.new/systemd-mini.changes 2015-03-09 09:20:54.000000000 +0100 @@ -2,94 +1,0 @@ -Tue Mar 3 16:03:07 UTC 2015 - jengelh@inai.de - -- Add 0001-core-rework-device-state-logic.patch to fix spurious - automated umount after mount. - -------------------------------------------------------------------- -Wed Feb 18 12:13:52 UTC 2015 - meissner@suse.com - -- mark more subpackages as !bootstrap for systemd-mini usage. - -------------------------------------------------------------------- -Wed Feb 18 05:01:38 UTC 2015 - crrodriguez@opensuse.org - -- spec : remove --with-firmware-path, firmware loader was removed in v217 -- spec: remove --disable-multi-seat-x, gone.(fixed in xorg) -- spec: Do not enable systemd-readahead-collect.service and -systemd-readahead-replay.service as these do not exist anymore. -- spec: drop timedate-add-support-for-openSUSE-version-of-etc-sysconfig.patch - Yast was fixed to write all timezone changes exactly how timedated expects - things to be done. -- spec: remove handle-etc-HOSTNAME.patch, since late 2014 the netcfg - package handles the migration from /etc/HOSTNAME to /etc/hostname - and owns both files. --spec: remove boot.udev and systemd-journald.init as they currently - serve no purpose. -- suse-sysv-bootd-support.diff: Remove HAVE_SYSVINIT conditions, we - are in sysvcompat-only codepath, also remove the code targetting other - distributions, never compiled as the TARGET_$DISTRO macros are never defined. -- systemd-powerd-initctl-support.patch guard with HAVE_SYSV_COMPAT -- set-and-use-default-logconsole.patch: fix HAVE_SYSV_COMPAT guards -- insserv-generator.patch: Only build when sysvcompat is enabled -- vhangup-on-all-consoles.patch add a comment indicating this is a workaround - for a kernel bug. -- spec: Add option to allow disabling sysvinit compat at build time. -- spec: Add option to enable resolved at build time. -- spec: Remove all %ifs for !factory products, current systemd releases can - neither be built nor installed in older products without upgrading - several components of the base system. - (removed: 1008-add-msft-compability-rules.patch was only for =< 13.1) -- spec: remove all dummy "aliases" to /etc/init.d, that made sense only when - those init scripts still existed. (dummy localfs.service source: gone) -- systemd-sleep-grub: moved to the grub2 package where it belongs as a - suspend/resume hook (SR#286533) (drops prepare-suspend-to-disk.patch) -- remove LFS_CFLAGS from CFLAGS, never needed in systemd as it force feds - config.h everywhere in the preprocessor cmdline. - -------------------------------------------------------------------- -Mon Feb 16 23:46:11 UTC 2015 - jengelh@inai.de - -- Update to new upstream release 219 -* systemd units can now be "unsupported" (like, for example, - .device in a containers), similar to the "skipped" state in - SUSE's prior sysvinit scripts. -* tmpfiles gained the 'v' type for creating btrfs subvolumes. -* tmpfiles gained the 'a' type for setting ACLs. -* systemd-nspawn gained new switches: --ephemeral, --template -* The /var/lib/containers location is deprecated and replaced by - /var/lib/machines. -* machinectl gained the copy-from and copy-to commands. -* machinectl now knows a "bind" command (for use with nspawn) -* new "systemd-importd" daemon to download container images and run - them as nspawn containers. -* networkd collects LLDP network announcements, if available, and - so shown in networkctl. -* The fallback terminal type was changed from "vt102" to "vt220", - allowing PgUp/PgDn keys to work. -* Pressing Ctrl-Alt-Del 7x in 2 seconds forces a umount+reboot now, - useful should the regular shutdown hang. -* Removing storage will cause systemd to unmount the associated - mountpoints so that they don't linger around. - -------------------------------------------------------------------- -Mon Feb 16 11:47:04 UTC 2015 - jengelh@inai.de - -- Add suse-sysv-bootd-support.diff (reinstate old - Revert-service-drop-support-for-SysV-scripts-for-the-early.patch) - -------------------------------------------------------------------- -Mon Feb 16 10:18:18 UTC 2015 - jengelh@inai.de - -- Update to systemd v218-1050-g38ab096 -- Remove patches - use-usr-sbin-sulogin-for-emergency-service.patch (upstream fixed it) -- Reinstate and improve (remove huge indents from) - tty-ask-password-agent-on-console.patch, - 0014-journald-with-journaling-FS.patch, rootsymlink_generator. - -------------------------------------------------------------------- -Mon Feb 16 09:42:48 UTC 2015 - meissner@suse.com - -- disable systemd-resolved for now as it interacts not well with - our methods and security has concerns regarding spoofing. bsc#917781 - -------------------------------------------------------------------- @@ -100,472 +5,0 @@ - -------------------------------------------------------------------- -Fri Jan 9 18:48:28 UTC 2015 - jengelh@inai.de - -- Update to new upstream release 218 -* New utilities: systemd-timesyncd (SNTP client), - systemd-resolved, systemd-networkd, networkctl, - systemd-sysusers -* machinectl gained a "poweroff" command for clean container shutdown -* The udev hwdb now contains DPI information for mice. -* Userspace firmware loading support has been removed and - the minimum supported kernel version is thus bumped to 3.7. -- Remove patches: - G=gone locally, is upstream; - D=dropped: no longer needed; - N=no longer applies to source nor is it deemed needed; - K=killed: no longer applicable and too complex to resolve: - ---- - G 0002-rfkill-rework-how-we-generate-file-names-from-rfkill.patch - G avoid-assertion-if-invalid-address-familily-is-passed-to-g.patch - K service-flags-sysv-service-with-detected-pid-as-RemainAfte.patch - K remain_after_exit-initscript-heuristic-and-add-new-LSB-hea.patch - K handle-SYSTEMCTL_OPTIONS-environment-variable.patch - K 0018-Make-LSB-Skripts-know-about-Required-and-Should.patch - K log-target-null-instead-kmsg.patch - K tty-ask-password-agent-on-console.patch - K 513-nspawn-veth.patch - K 1087-infinit-timeout-for-kmod-loaded-modules.patch - D module-load-handle-SUSE-etc-sysconfig-kernel-module-list.patch - D avoid-leaking-socket-descriptors.patch - D 0001-make-fortify-happy-with-ppoll.patch - N fix-owner-of-var-log-btmp.patch - N disable-nss-myhostname-warning-bnc-783841.patch - N Revert-service-drop-support-for-SysV-scripts-for-the-early.patch - N 0001-make-209-working-on-older-dist.patch - N 0001-Don-t-snprintf-a-potentially-NULL-pointer.patch - N tmpfiles-do-not-clean-for-mandb-index-files.patch - G 0001-sd-bus-don-t-look-for-a-64bit-value-when-we-only-hav.patch - G avoid-assertion-if-invalid-address-familily-is-passed-to-g.patc - G optionally-warn-if-nss-myhostname-is-called.patch - G 0001-units-systemd-sysctl.service.in-run-after-load-modul.patch - G 0004-getty-generator-properly-escape-instance-names.patch - G rules-add-lid-switch-of-ARM-based-Chromebook-as-a-power-sw.patch - G 0008-Reset-signal-mask-on-re-exec-to-init.patch - G 0001-login-fix-pos-array-allocation.patch - G 0002-login-set-pos-slot-to-fallback-on-pos-eviction.patch - G 0003-login-Allow-calling-org.freedesktop.login1.Seat.Swit.patch - G 0004-fix-typo-in-iDRAC-network-interface-name-irdac-idrac.patch - G 0005-Replace-var-run-with-run-in-remaining-places.patch - G 0006-Revert-back-to-var-run-at-a-couple-of-problems.patch - G 0007-README-document-that-var-run-must-be-a-symlink-run.patch - G 0008-Use-var-run-dbus-system_bus_socket-for-the-D-Bus-soc.patch - G 0009-mount-don-t-send-out-PropertiesChanged-message-if-ac.patch - G 0010-mount-don-t-fire-PropertiesChanged-signals-for-mount.patch - G 0011-logs-show-fix-corrupt-output-with-empty-messages.patch - G 0012-journalctl-refuse-extra-arguments-with-verify-and-si.patch - G 0014-nspawn-fix-detection-of-missing-proc-self-loginuid.patch - G 0001-Fix-systemd-stdio-bridge-symlink.patch - G 0002-execute-free-directory-path-if-we-fail-to-remove-it-.patch - G 0003-Do-not-print-invalid-UTF-8-in-error-messages.patch - G 0004-man-document-missing-options-of-systemd-run.patch - G 0005-systemd-run-add-some-extra-safety-checks.patch - G 0006-journal-assume-that-next-entry-is-after-previous-ent.patch - G 0007-journal-forget-file-after-encountering-an-error.patch - G 0008-core-correctly-unregister-PIDs-from-PID-hashtables.patch - G 0009-logind-fix-reference-to-systemd-user-sessions.servic.patch - G 0010-man-update-link-to-LSB.patch - G 0011-man-systemd-bootchart-fix-spacing-in-command.patch - G 0012-man-add-missing-comma.patch - G 0013-units-Do-not-unescape-instance-name-in-systemd-backl.patch - G 0001-core-busname-add-lookup-string-for-BUSNAME_FAILURE_S.patch - G 0002-manager-flush-memory-stream-before-using-the-buffer.patch - G 0003-busname-don-t-drop-service-from-the-result-string.patch - G 0004-fix-off-by-one-error-in-array-index-assertion.patch - G 0005-logind-fix-policykit-checks.patch - G 0006-rules-mark-loop-device-as-SYSTEMD_READY-0-if-no-file.patch - G 0008-man-multiple-sleep-modes-are-to-be-separated-by-whit.patch - G 0001-gpt-auto-generator-don-t-return-OOM-on-parentless-de.patch - G 0002-bus-fix-memory-leak-when-kdbus-is-not-enabled.patch - G 0006-Do-not-return-1-EINVAL-on-allocation-error.patch - G 0007-networkd-fix-typo.patch - G 0008-sd-bus-don-t-access-invalid-memory-if-a-signal-match.patch - G 0009-sd-bus-don-t-choke-if-somebody-sends-us-a-message-wi.patch - G 0012-journald-remove-stray-reset-of-error-return-value.patch - G 0013-core-libsystemd-systemd-timedate-udev-spelling-fixes.patch - G 0001-cgroup-it-s-not-OK-to-invoke-alloca-in-loops.patch - G 0002-machined-fix-Kill-bus-call-on-machine-objects-when-w.patch - G 0003-sd-bus-don-t-use-assert_return-to-check-for-disconne.patch - G 0004-core-don-t-try-to-relabel-mounts-before-we-loaded-th.patch - G 0005-sd-daemon-fix-incorrect-variable-access.patch - G 0006-sd-event-initialization-perturbation-value-right-bef.patch - G 0007-sd-event-don-t-accidentally-turn-of-watchdog-timer-e.patch - G 0008-systemctl-kill-mode-is-long-long-gone-don-t-mention-.patch - G 0009-ask-password-when-the-user-types-a-overly-long-passw.patch - G 0001-journal-fix-export-of-messages-containing-newlines.patch - G 0002-systemctl-update-NAME-to-PATTERN-in-help.patch - G 0003-tty-ask-password-agent-return-negative-errno.patch - G 0004-systemd-python-use-.hex-instead-of-.get_hex.patch - G 0005-systemd-python-fix-failing-assert.patch - G 0007-dbus-suppress-duplicate-and-misleading-messages.patch - G 0001-reduce-the-amount-of-messages-logged-to-dev-kmsg-whe.patch - G 0001-bash-completion-fix-__get_startable_units.patch ++++ 370 more lines (skipped) ++++ between /work/SRC/openSUSE:Factory/systemd/systemd-mini.changes ++++ and /work/SRC/openSUSE:Factory/.systemd.new/systemd-mini.changes systemd.changes: same change Old: ---- 0001-core-rework-device-state-logic.patch suse-sysv-bootd-support.diff systemd-219.tar.xz New: ---- 0001-Clear-up-confusion-wrt.-ENTRY_SIZE_MAX-and-DATA_SIZE.patch 0001-Do-not-unescape-unit-names-in-Install-section.patch 0001-Don-t-snprintf-a-potentially-NULL-pointer.patch 0001-Fix-systemd-stdio-bridge-symlink.patch 0001-Fix-warning-about-unused-variable-with-SELINUX.patch 0001-activate-fix-fd-leak-in-do_accept.patch 0001-architecture-Add-tilegx.patch 0001-backlight-Avoid-restoring-brightness-to-an-unreadabl.patch 0001-bash-completion-fix-__get_startable_units.patch 0001-bash-completion-p-option-for-journalctl.patch 0001-build-sys-use-glibc-s-xattr-support-instead-of-requi.patch 0001-bus-proxyd-fix-incorrect-comparison.patch 0001-cgroup-it-s-not-OK-to-invoke-alloca-in-loops.patch 0001-completion-filter-templates-from-restartable-units.patch 0001-conf-parser-silently-ignore-sections-starting-with-X.patch 0001-core-busname-add-lookup-string-for-BUSNAME_FAILURE_S.patch 0001-core-close-socket-fds-asynchronously.patch 0001-core-don-t-allow-enabling-if-unit-is-masked.patch 0001-core-fix-invalid-free-in-killall.patch 0001-core-fix-resource-leak-in-manager_environment_add.patch 0001-core-swap-only-make-configured-units-part-of-swap.ta.patch 0001-core-sysvcompat-network-should-be-equivalent-to-netw.patch 0001-core-use-correct-format-string-for-UIDs.patch 0001-detect-virt-Fix-Xen-domU-discovery.patch 0001-errno-make-sure-to-handle-the-3-errnos-that-are-alia.patch 0001-event-pull-in-sd-event.h-from-event-util.h.patch 0001-gpt-auto-generator-don-t-return-OOM-on-parentless-de.patch 0001-hwdb-Update-database-of-Bluetooth-company-identifier.patch 0001-hwdb-fix-case-sensitive-match.patch 0001-hwdb-keymaps-for-Samsung-900X3E-900X3F.patch 0001-hwdb-update.patch 0001-initrd-parse-etc.service-ignore-return-code-of-daemo.patch 0001-journal-Do-not-count-on-the-compiler-initializing-fo.patch 0001-journal-cleanup-up-error-handling-in-update_catalog.patch 0001-journal-compress-return-early-in-uncompress_startswi.patch 0001-journal-fix-export-of-messages-containing-newlines.patch 0001-journalctl-do-not-output-reboot-markers-when-running.patch 0001-keymap-Add-Lenovo-Enhanced-USB-Keyboard.patch 0001-keymap-Add-support-for-IBM-ThinkPad-X41-Tablet.patch 0001-keymap-Fix-touchpad-toggle-on-Toshiba-Satellite-P75-.patch 0001-login-fix-memory-leak-on-DropController.patch 0001-login-fix-pos-array-allocation.patch 0001-login-pause-devices-before-acknowledging-VT-switches.patch 0001-login-rerun-vconsole-setup-when-switching-from-vgaco.patch 0001-login-simplify-controller-handling.patch 0001-logind-add-support-for-Triton2-Power-Button.patch 0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch 0001-logind-ignore-lid-switch-if-more-than-1-display-is-c.patch 0001-machine-don-t-return-uninitialized-variable.patch 0001-main-uid_to_name-might-fail-due-to-OOM-protect-again.patch 0001-make-209-working-on-older-dist.patch 0001-make-fortify-happy-with-ppoll.patch 0001-manager-Linux-on-hppa-has-fewer-rtsigs-hence-avoid-u.patch 0001-nspawn-allow-to-bind-mount-journal-on-top-of-a-non-e.patch 0001-nspawn-don-t-try-to-create-veth-link-with-too-long-i.patch 0001-nspawn-fix-network-interface.patch 0001-nspawn-fix-truncation-of-machine-names-in-interface-.patch 0001-parse_uid-return-ENXIO-for-1-uids.patch 0001-po-add-Ukrainian-translation.patch 0001-reduce-the-amount-of-messages-logged-to-dev-kmsg-whe.patch 0001-replace-more-dup-by-F_DUPFD_CLOEXEC.patch 0001-sd-bus-don-t-look-for-a-64bit-value-when-we-only-hav.patch 0001-sd-bus-properly-handle-removals-of-non-existing-matc.patch 0001-sd-event-don-t-require-a-signal-event-source-to-be-e.patch 0001-sd-event-restore-correct-timeout-behaviour.patch 0001-sd-rtnl-message-append-fix-uninitialized-memory.patch 0001-selinux-access-fix-broken-ternary-operator.patch 0001-shell-completion-fix-completion-of-inactive-units.patch 0001-shutdownd-clean-up-initialization-of-struct.patch 0001-socket-introduce-SELinuxContextFromNet-option.patch 0001-strv-add-an-additional-overflow-check-when-enlarging.patch 0001-systemctl-Correct-error-message-printed-when-bus_pro.patch 0001-systemctl-allow-to-change-the-default-target-without.patch 0001-systemctl-let-list-units-unit-files-honour-type.patch 0001-systemctl-when-mangle-unit-names-for-the-isolate-suf.patch 0001-systemd-continue-switch-root-even-if-umount-fails.patch 0001-systemd-detect-virt-detect-s390-virtualization.patch 0001-systemd-tmpfiles-Fix-IGNORE_DIRECTORY_PATH-age-handl.patch 0001-sysv-order-initscripts-which-provide-network-before-.patch 0001-tmpfiles-compare-return-against-correct-errno.patch 0001-tmpfiles-fix-permissions-on-new-journal-files.patch 0001-umount-modernizations.patch 0001-units-introduce-network-pre.target-as-place-to-hook-.patch 0001-units-make-ExecStopPost-action-part-of-ExecStart.patch 0001-units-make-sure-rfkill-service-is-bount-to-the-actua.patch 0001-units-order-network-online.target-after-network.targ.patch 0001-units-systemd-sysctl.service.in-run-after-load-modul.patch 0001-units-tmpfiles-setup-dev-allow-unsafe-file-creation-.patch 0001-util-consider-0x7F-a-control-chracter-which-it-is-DE.patch 0001-vconsole-also-copy-character-maps-not-just-fonts-fro.patch 0001-virt-detect-that-we-are-running-inside-the-docker-co.patch 0001-virt-rework-container-detection-logic.patch 0002-Add-hwdb-entry-for-Samsung-Series-7-Ultra.patch 0002-Be-more-verbose-when-bind-or-listen-fails.patch 0002-analyze-avoid-a-null-dereference.patch 0002-analyze-run-use-bus_open_transport_systemd-instead-o.patch 0002-architecture-Add-cris.patch 0002-backlight-do-nothing-if-max_brightness-is-0.patch 0002-bootchart-use-n-a-if-PRETTY_NAME-is-not-found.patch 0002-bus-fix-memory-leak-when-kdbus-is-not-enabled.patch 0002-bus-make-use-of-sd_bus_try_close-in-exit-on-idle-ser.patch 0002-bus-remove-unused-check.patch 0002-core-make-sure-Environment-fields-passed-in-for-tran.patch 0002-core-transaction-fix-cycle-break-attempts-outside-tr.patch 0002-core-watchdog-bus-properties-cannot-be-both-writable.patch 0002-execute-free-directory-path-if-we-fail-to-remove-it-.patch 0002-fsck-include-device-name-in-the-message-about-missin.patch 0002-hostnamed-add-a-new-chassis-type-for-watches.patch 0002-hwdb-Add-mapping-for-special-keys-on-compaq-ku-0133-.patch 0002-hwdb-Update-database-of-Bluetooth-company-identifier.patch 0002-hwdb-update.patch 0002-include-fcntl.h-rather-than-sys-fcntl.h.patch 0002-journal-compress-improve-xz-compression-performance.patch 0002-journal-properly-detect-language-specified-in-line.patch 0002-journalctl-man-allow-only-between-terms.patch 0002-journald-make-MaxFileSec-really-default-to-1month.patch 0002-keymap-Add-microphone-mute-keymap-for-Dell-Latitude.patch 0002-keymap-Asus-EeePC-touchpad-toggle-key.patch 0002-keymap-Fix-special-keys-on-ThinkPad-X60-X61-Tablet.patch 0002-keymap-Fix-touchpad-toggle-key-on-Asus-laptops.patch 0002-keymap-Ignore-brightness-keys-on-Dell-Inspiron-1520-.patch 0002-login-set-pos-slot-to-fallback-on-pos-eviction.patch 0002-logind-add-support-for-TPS65217-Power-Button.patch 0002-logind-bring-polkit-policy-for-hibernate-in-line-wit.patch 0002-logind-fix-printf-format.patch 0002-machined-fix-Kill-bus-call-on-machine-objects-when-w.patch 0002-man-document-yearly-and-annually-in-systemd.time-7.patch 0002-man-note-that-entire-sections-can-now-be-ignored.patch 0002-man-tmpfiles.d-recommend-using-b-and-c.patch 0002-manager-flush-memory-stream-before-using-the-buffer.patch 0002-namespace-fix-uninitialized-memory-access.patch 0002-namespace-when-setting-up-an-inaccessible-mount-poin.patch 0002-nspawn-restore-journal-directory-is-empty-check.patch 0002-pam_systemd-use-F_DUPFD_CLOEXEC-when-dupping-session.patch 0002-rfkill-rework-how-we-generate-file-names-from-rfkill.patch 0002-shell-completion-prevent-mangling-unit-names.patch 0002-shell-completion-propose-templates-for-disable-re-en.patch 0002-shutdown-fix-arguments-to-run-initramfs-shutdown.patch 0002-shutdown-pass-own-argv-to-run-initramfs-shutdown.patch 0002-snapshot-return-error-when-snapshot-exists.patch 0002-switch-root-umount-the-old-root-correctly.patch 0002-sysctl-replaces-some-slashes-with-dots.patch 0002-systemctl-obey-state-in-list-unit-files.patch 0002-systemctl-show-BindsTo-BoundBy-in-list-dependencies.patch 0002-systemctl-update-NAME-to-PATTERN-in-help.patch 0002-systemd-fix-error-message.patch 0002-systemd-try-harder-to-bind-to-notify-socket.patch 0002-time-also-support-infinity-syntax-in-parse_nsec.patch 0002-udev-hwdb-New-Entry-for-Dell-XPS12-9Q33-keyboard.patch 0002-units-add-missing-caps-so-that-GetAddresses-can-work.patch 0002-units-order-systemd-fsck-.service-after-local-fs-pre.patch 0002-units-serial-getty-.service-use-the-default-RestartS.patch 0002-util-avoid-non-portable-__WORDSIZE.patch 0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch 0002-util-fix-has-cc-check-and-add-test.patch 0002-util-fix-minimal-race-where-we-might-miss-SIGTERMs-w.patch 0002-util-remove-a-unnecessary-check.patch 0002-util-when-unescaping-strings-don-t-allow-smuggling-i.patch 0002-vconsole-setup-run-setfont-before-loadkeys.patch 0003-Add-quotes-to-warning-message.patch 0003-Always-check-asprintf-return-code.patch 0003-Do-not-print-invalid-UTF-8-in-error-messages.patch 0003-Quote-unit-names-in-suggested-systemctl-commandlines.patch 0003-analyze-fix-mem-leak.patch 0003-analyze-fix-plot-with-bad-y-size.patch 0003-arch-add-crisv32-to-uname-check.patch 0003-architecture-add-string-table-entries-for-mips-le-ar.patch 0003-backlight-unify-error-messages.patch 0003-bootchart-it-s-not-OK-to-return-1-from-a-main-progra.patch 0003-bootchart-parse-userinput-with-safe_atoi.patch 0003-busname-don-t-drop-service-from-the-result-string.patch 0003-core-You-can-not-put-the-cached-result-of-use_smack-.patch 0003-core-allow-transient-mount-units.patch 0003-core-make-sure-to-serialize-jobs-for-all-units.patch 0003-core-never-consider-failure-when-reading-drop-ins-fa.patch 0003-core-nicer-message-when-inotify-watches-are-exhauste.patch 0003-cryptsetup-default-to-no-hash-when-keyfile-is-specif.patch 0003-delta-do-not-use-unicode-chars-in-C-locale.patch 0003-fileio-label-return-error-when-writing-fails.patch 0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch 0003-hwdb-PCI-include-primary-model-string-in-subsystem-m.patch 0003-hwdb-Update-database-of-Bluetooth-company-identifier.patch 0003-install-fix-invalid-free-in-unit_file_mask.patch 0003-journald-add-CAP_MAC_OVERRIDE-in-journald-for-SMACK-.patch 0003-keymap-Adjust-for-more-Samsung-900X4-series.patch 0003-keymap-Annotate-all-micmute-workarounds.patch 0003-keymap-Fix-HP-Pavillon-DV7.patch 0003-localed-consider-an-unset-model-as-a-wildcard.patch 0003-login-Allow-calling-org.freedesktop.login1.Seat.Swit.patch 0003-logind-ignore-lid-switch-events-for-30s-after-each-s.patch 0003-man-mention-XDG_CONFIG_HOME-in-systemd.unit.patch 0003-man-we-don-t-have-Wanted-dependency.patch 0003-mount-order-options-before-other-arguments-to-mount.patch 0003-namespace-make-sure-tmp-var-tmp-and-dev-are-writable.patch 0003-sd-bus-check-return-value-of-vasprintf.patch 0003-sd-bus-don-t-use-assert_return-to-check-for-disconne.patch 0003-sd-bus-refuse-properties-that-claim-to-be-both-writa.patch 0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch 0003-sd-journal-properly-convert-object-size-on-big-endia.patch 0003-shared-install-avoid-prematurely-rejecting-missing-u.patch 0003-systemd-use-pager-for-test-and-help.patch 0003-time-earlier-exit-from-format_timestamp_relative-on-.patch 0003-tty-ask-password-agent-return-negative-errno.patch 0003-udev-event-explicitly-don-t-read-from-invalid-fd.patch 0003-units-order-systemd-tmpfiles-clean.service-after-tim.patch 0003-units-remove-RefuseManualStart-from-units-which-are-.patch 0003-units-use-KillMode-mixed-for-systemd-nspawn-.service.patch 0003-utf8-when-looking-at-the-next-unichar-honour-the-siz.patch 0004-Raise-level-of-Found-dependency.-lines.patch 0004-architecture-remove-cris-from-uname-list.patch 0004-backlight-Avoid-error-when-state-restore-is-disabled.patch 0004-backlight-warn-if-kernel-exposes-backlight-device-wi.patch 0004-bash-completion-use-list-unit-files-to-get-all-units.patch 0004-bootchart-check-return-of-strftime.patch 0004-config-parser-fix-mem-leak.patch 0004-core-Added-support-for-ERRNO-NOTIFY_SOCKET-message-p.patch 0004-core-don-t-try-to-relabel-mounts-before-we-loaded-th.patch 0004-core-fix-transaction-destructiveness-check-once-more.patch 0004-core-map-the-rescue-argument-to-rescue.target.patch 0004-cryptsetup-don-t-add-unit-dependency-on-dev-null-dev.patch 0004-fileio-quote-more-shell-characters-in-envfiles.patch 0004-fix-off-by-one-error-in-array-index-assertion.patch 0004-fix-typo-in-iDRAC-network-interface-name-irdac-idrac.patch 0004-getty-generator-properly-escape-instance-names.patch 0004-hwdb-Update-database-of-Bluetooth-company-identifier.patch 0004-hwdb-update-format-description-and-document-reloadin.patch 0004-hwdb-update.patch 0004-implement-a-union-to-pad-out-file_handle.patch 0004-job-add-waiting-jobs-to-run-queue-in-unit_coldplug.patch 0004-journal-do-server_vacuum-for-sigusr1.patch 0004-login-set_controller-should-fail-if-prepare_vt-fails.patch 0004-logind-Do-not-fail-display-count-if-a-device-has-no-.patch 0004-machined-make-sure-GetMachineAddresses-is-available-.patch 0004-man-document-missing-options-of-systemd-run.patch 0004-sd-bus-if-we-don-t-manage-to-properly-allocate-the-e.patch 0004-sd-bus-when-an-event-loop-terminates-explicitly-clos.patch 0004-sd-event-check-the-value-of-received-signal.patch 0004-sd-journal-verify-that-object-start-with-the-field-n.patch 0004-selinux-fix-potential-double-free-crash-in-child-pro.patch 0004-shared-conf-parser.patch 0004-shared-wtmp-utmp-don-t-clear-store_wtmp-in-utmp_put_.patch 0004-socket-properly-handle-if-our-service-vanished-durin.patch 0004-systemd-detect-virt-only-discover-Xen-domU.patch 0004-systemd-python-use-.hex-instead-of-.get_hex.patch 0004-systemd-return-the-first-error-from-manager_startup.patch 0004-util-ignore_file-should-not-allow-files-ending-with.patch 0004-util-refuse-considering-UID-0xFFFF-and-0xFFFFFFFF-va.patch 0005-Replace-var-run-with-run-in-remaining-places.patch 0005-backlight-Do-not-clamp-brightness-for-LEDs.patch 0005-backlight-handle-saved-brightness-exceeding-max-brig.patch 0005-bootchart-Do-not-try-to-access-data-for-non-existing.patch 0005-bus-avoid-using-m-kdbus-after-freeing-it.patch 0005-bus-close-a-bus-that-failed-to-connect.patch 0005-core-Filter-by-state-behind-the-D-Bus-API-not-in-the.patch 0005-core-only-set-the-kernel-s-timezone-when-the-RTC-run.patch 0005-cryptsetup-fix-an-OOM-check.patch 0005-hwdb-Update-database-of-Bluetooth-company-identifier.patch 0005-hwdb-update.patch 0005-job-always-add-waiting-jobs-to-run-queue-during-cold.patch 0005-journalctl-correct-help-text-for-until.patch 0005-login-fix-mem-leak.patch 0005-logind-fix-policykit-checks.patch 0005-logind-fix-typo.patch 0005-logind-move-lid-switch-handling-from-logind-main-to-.patch 0005-man-fix-path-in-crypttab-5.patch 0005-nspawn-block-open_by_handle_at-and-others-via-seccom.patch 0005-po-add-Greek-translation.patch 0005-sd-daemon-fix-incorrect-variable-access.patch 0005-sd-id128-do-stricter-checking-of-random-boot-id.patch 0005-sd-resolve-fix-allocation-if-query-ids-never-reuse-t.patch 0005-service-don-t-accept-negative-ERRNO-notification-mes.patch 0005-shared-label.h-add-missing-stdio.h-include.patch 0005-systemd-python-fix-failing-assert.patch 0005-systemd-run-add-some-extra-safety-checks.patch 0005-units-order-sd-journal-flush-after-sd-remount-fs.patch 0005-util-avoid-double-close-of-fd.patch 0006-Do-not-return-1-EINVAL-on-allocation-error.patch 0006-Revert-back-to-var-run-at-a-couple-of-problems.patch 0006-bus-unref-buscreds-on-failure.patch 0006-calendarspec-fix-typo-in-annually.patch 0006-hwdb-Update-database-of-Bluetooth-company-identifier.patch 0006-hwdb-update.patch 0006-journal-assume-that-next-entry-is-after-previous-ent.patch 0006-journald-fix-minor-memory-leak.patch 0006-log-honour-the-kernel-s-quiet-cmdline-argument.patch 0006-login-add-mir-to-the-list-of-session-types.patch 0006-login-share-VT-signal-handler-between-sessions.patch 0006-man-clarify-that-the-ExecReload-command-should-be-sy.patch 0006-parse_boolean-require-exact-matches.patch 0006-rules-mark-loop-device-as-SYSTEMD_READY-0-if-no-file.patch 0006-sd-event-initialization-perturbation-value-right-bef.patch 0006-shared-sparse-endian.h-add-missing-byteswap.h-includ.patch 0006-systemctl-fix-resource-leak-CID-1237747.patch 0006-systemctl-show-StatusErrno-value-in-systemctl-status.patch 0006-tmpfiles-don-t-do-automatic-cleanup-in-XDG_RUNTIME_D.patch 0006-tty-ask-password-agent-Do-tell-what-directory-we-fai.patch 0007-README-document-that-var-run-must-be-a-symlink-run.patch 0007-core-fix-a-potential-mem-leak.patch 0007-dbus-suppress-duplicate-and-misleading-messages.patch 0007-drop_duplicates-copy-full-BindMount-struct.patch 0007-hwdb-Update-database-of-Bluetooth-company-identifier.patch 0007-hwdb-update.patch 0007-journal-forget-file-after-encountering-an-error.patch 0007-journald-also-check-journal-file-size-to-deduce-if-i.patch 0007-journald-also-increase-the-SendBuffer-of-dev-log-to-.patch 0007-keyboard-add-Plantronics-.Audio-mute-button.patch 0007-libudev-monitor-warn-if-we-fail-to-request-SO_PASSCR.patch 0007-logind-fix-Display-property-of-user-objects.patch 0007-man-readahead-fix-cmdline-switch-inconsistency-betwe.patch 0007-networkd-fix-typo.patch 0007-po-add-German-translation.patch 0007-sd-event-don-t-accidentally-turn-of-watchdog-timer-e.patch 0007-service-flush-status-text-and-errno-values-each-time.patch 0007-systemctl-do-not-ignore-errors-in-symlink-removal.patch 0007-units-skip-mounting-tmp-if-it-is-a-symlink.patch 0008-Reset-signal-mask-on-re-exec-to-init.patch 0008-Use-var-run-dbus-system_bus_socket-for-the-D-Bus-soc.patch 0008-core-correctly-unregister-PIDs-from-PID-hashtables.patch 0008-core-smack-setup-Actually-allow-for-succesfully-load.patch 0008-hwdb-Update-database-of-Bluetooth-company-identifier.patch 0008-hwdb-update.patch 0008-journald-fix-memory-leak-on-error-path.patch 0008-man-multiple-sleep-modes-are-to-be-separated-by-whit.patch 0008-man-update-journald-rate-limit-defaults.patch 0008-mount-setup-fix-counting-of-early-mounts-without-SMA.patch 0008-sd-bus-don-t-access-invalid-memory-if-a-signal-match.patch 0008-shared-conf-parser-don-t-leak-memory-on-error-in-DEF.patch 0008-shell-completion-prevent-mangling-unit-names-bash.patch 0008-systemctl-kill-mode-is-long-long-gone-don-t-mention-.patch 0008-util-introduce-sethostname_idempotent.patch 0009-ask-password-when-the-user-types-a-overly-long-passw.patch 0009-bus-fix-bus_print_property-to-use-int-for-booleans.patch 0009-core-clean-up-signal-reset-logic-when-reexec.patch 0009-hwdb-Update-database-of-Bluetooth-company-identifier.patch 0009-hwdb-update.patch 0009-journal-do-not-leak-mmaps-on-OOM.patch 0009-journald-Fix-off-by-one-error-in-Missed-X-kernel-mes.patch 0009-journald-always-add-syslog-facility-for-messages-com.patch 0009-logind-fix-reference-to-systemd-user-sessions.servic.patch 0009-mount-don-t-send-out-PropertiesChanged-message-if-ac.patch 0009-nspawn-properly-format-container_uuid-in-UUID-format.patch 0009-sd-bus-don-t-choke-if-somebody-sends-us-a-message-wi.patch 0009-units-make-systemd-journald.service-Type-notify.patch 0009-util-fix-copy-paste-error-and-actually-set-the-new-h.patch 0010-hwdb-Update-database-of-Bluetooth-company-identifier.patch 0010-logind-allow-suspending-if-there-are-no-displays.patch 0010-machine_kill-Don-t-kill-the-unit-when-killing-the-le.patch 0010-man-update-link-to-LSB.patch 0010-manager-use-correct-cleanup-function.patch 0010-mount-don-t-fire-PropertiesChanged-signals-for-mount.patch 0010-shutdown-do-final-unmounting-only-if-not-running-ins.patch 0010-util-treat-fuse.sshfs-as-a-network-filesystem.patch 0011-build-sys-add-pthread-flag-for-libsystemd-shared.patch 0011-logs-show-fix-corrupt-output-with-empty-messages.patch 0011-man-systemd-bootchart-fix-spacing-in-command.patch 0011-selinux-make-sure-we-do-not-try-to-print-missing-fie.patch 0011-units-fix-BindsTo-logic-when-applied-relative-to-ser.patch 0012-core-transaction-avoid-misleading-error-message-when.patch 0012-journalctl-refuse-extra-arguments-with-verify-and-si.patch 0012-journald-remove-stray-reset-of-error-return-value.patch 0012-man-add-missing-comma.patch 0012-manager-do-not-print-anything-while-passwords-are-be.patch 0012-util-try-to-be-a-bit-more-NFS-compatible-when-checki.patch 0013-core-libsystemd-systemd-timedate-udev-spelling-fixes.patch 0013-units-Do-not-unescape-instance-name-in-systemd-backl.patch 0014-nspawn-fix-detection-of-missing-proc-self-loginuid.patch 0018-Make-LSB-Skripts-know-about-Required-and-Should.patch 1008-add-msft-compability-rules.patch 1009-cdrom_id-use-the-old-MMC-fallback.patch 1010-udev-increase-result-size-for-programs.patch 1014-udev-update-net_id-comments.patch 1015-udev-persistent-naming-we-cannot-use-virtio-numbers-.patch 1016-udev-warn-when-name_to_handle_at-is-not-implemented.patch 1017-udev-serialize-synchronize-block-device-event-handli.patch 1018-udev-do-not-skip-the-execution-of-RUN-when-renaming-.patch 1019-udev-avoid-use-of-uninitialized-err.patch 1020-udev-keyboard-also-hook-into-change-events.patch 1022-udev-remove-seqnum-API-and-all-assumptions-about-seq.patch 1023-udev-builtin-keyboard-do-tell-on-which-device-EVIOCS.patch 1024-udev-always-close-lock-file-descriptor.patch 1025-udev-exclude-device-mapper-from-block-device-ownersh.patch 1026-udevd-inotify-modernizations.patch 1027-udev-synthesize-change-events-for-partitions-when-to.patch 1028-udev-link-config-fix-mem-leak.patch 1029-udev-try-first-re-reading-the-partition-table.patch 1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch 1031-udev-make-sure-we-always-get-change-for-the-disk.patch 1032-udev-guard-REREADPT-by-exclusive-lock-instead-of-O_E.patch 1033-udev-really-exclude-device-mapper-from-block-device.patch 1034-udev-check-the-return-value-from-udev_enumerate_scan.patch 1038-udev-fix-invalid-free-in-enable_name_policy.patch 1039-udevadm-settle-fixed-return-code-for-empty-queue.patch 1041-libudev-fix-udev_queue_get_queue_is_empty-logic.patch 1042-libudev-queue-provide-file-descriptor-to-watch-busy-.patch 1043-libudev-queue-watch-entire-directory-to-allow-the-re.patch 1044-rules-update-qemu-hid-rules.patch 1045-rules-don-t-enable-usb-pm-for-Avocent-devices.patch 1047-udev-net_setup_link-builtin-should-print-the-reason-.patch 1048-udev-net_setup_link-add-a-bit-more-logging.patch 1049-udev-link_config-ignore-errors-due-to-missing-MAC-ad.patch 1052-rules-uaccess-add-ID_SOFTWARE_RADIO.patch 1054-udev-exclude-MD-from-block-device-ownership-event-lo.patch 1056-udevd-add-event-timeout-commandline-option.patch 1057-udev-unify-event-timeout-handling.patch 1058-udev-unify-event-timeout-handling.patch 1059-udev-fixup-commit-dd5eddd28a74a49607a8fffcaf960040db.patch 1061-rules-allow-systemd-to-manage-loop-device-partitions.patch 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch 1064-udev-hwdb-do-not-look-at-usb_device-parents.patch 1065-udev-bump-event-timeout-to-60-seconds.patch 1067-udev-always-resolve-correctly-database-names-on-chan.patch 1068-udev-net_setup_link-export-the-.link-filename-applie.patch 1069-rules-net-setup-link-preserve-ID_NET_LINK_FILE-and-I.patch 1070-rules-net-setup-link-remove-stray-linebreak.patch 1071-udev-import-the-full-db-on-MOVE-events-for-devices-w.patch 1072-udev-netif_rename-don-t-log-to-kmsg.patch 1073-udev-drop-print_kmsg.patch 1074-udev-fix-copy-paste-error-in-log-message.patch 1075-udev-timeout-increase-timeout.patch 1076-udev-timeout-warn-after-a-third-of-the-timeout-befor.patch 1077-udev-timeout-warn-after-a-third-of-the-timeout-befor.patch 1078-udev-remove-userspace-firmware-loading-support.patch 1079-udev-remove-userspace-firmware-loading-support.patch 1080-udevd-parse_argv-warn-if-argumens-are-invalid.patch 1081-udevd-check-return-of-various-functions.patch 1082-udevadm-hwdb-check-return-value-of-fseeko.patch 1083-udev-node-warn-if-chmod-chown-fails.patch 1084-udev-ctrl-log-if-setting-SO_PASSCRED-fails.patch 1085-udev-fix-typos.patch 1086-udevd-don-t-fail-if-run-udev-exists.patch 1087-infinit-timeout-for-kmod-loaded-modules.patch 1089-fix-cgroup-device-controller.patch 1090-udev-path_id-set-supported_parent-for-well-known-SCS.patch 1091-udev-path_id-update-comments.patch 1092-libudev-do-not-accept-invalid-log-levels.patch 1093-udev-Fix-parsing-of-udev.event-timeout-kernel-parame.patch 1094-udev-avoid-magic-constants-in-kernel-cmdline-parsers.patch 1098-udev-link_setup-respect-kernel-name-assign-policy.patch 513-nspawn-veth.patch Revert-service-drop-support-for-SysV-scripts-for-the-early.patch avoid-assertion-if-invalid-address-familily-is-passed-to-g.patch avoid-leaking-socket-descriptors.patch boot.udev disable-nss-myhostname-warning-bnc-783841.patch fix-owner-of-var-log-btmp.patch handle-SYSTEMCTL_OPTIONS-environment-variable.patch handle-etc-HOSTNAME.patch localfs.service log-target-null-instead-kmsg.patch module-load-handle-SUSE-etc-sysconfig-kernel-module-list.patch optionally-warn-if-nss-myhostname-is-called.patch prepare-suspend-to-disk.patch remain_after_exit-initscript-heuristic-and-add-new-LSB-hea.patch service-flags-sysv-service-with-detected-pid-as-RemainAfte.patch shut-up-annoying-assertion-monotonic-clock-message.patch systemd-210.tar.xz systemd-journald.init systemd-sleep-grub timedate-add-support-for-openSUSE-version-of-etc-sysconfig.patch tmpfiles-do-not-clean-for-mandb-index-files.patch use-usr-sbin-sulogin-for-emergency-service.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ systemd-mini.spec ++++++ ++++ 2296 lines (skipped) ++++ between /work/SRC/openSUSE:Factory/systemd/systemd-mini.spec ++++ and /work/SRC/openSUSE:Factory/.systemd.new/systemd-mini.spec systemd.spec: same change ++++++ 0001-Clear-up-confusion-wrt.-ENTRY_SIZE_MAX-and-DATA_SIZE.patch ++++++ Based on 874bc134ac6504c45e94174e37af13ff21a6bfe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Mon, 14 Jul 2014 16:53:23 -0400 Subject: [PATCH] Clear up confusion wrt. ENTRY_SIZE_MAX and DATA_SIZE_MAX Define DATA_SIZE_MAX to mean the maximum size of a single field, and ENTRY_SIZE_MAX to mean the size of the whole entry, with some rough calculation of overhead over the payload. Check if entries are not too big when processing native journal messages. --- src/journal/coredump.c | 6 +++--- src/journal/journald-native.c | 25 +++++++++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) --- src/journal/coredump.c +++ src/journal/coredump.c 2014-07-16 13:02:54.438235659 +0000 @@ -38,10 +38,10 @@ #include "cgroup-util.h" /* Few programs have less than 3MiB resident */ -#define COREDUMP_MIN_START (3*1024*1024) +#define COREDUMP_MIN_START (3*1024*1024u) /* Make sure to not make this larger than the maximum journal entry - * size. See ENTRY_SIZE_MAX in journald-native.c. */ -#define COREDUMP_MAX (767*1024*1024) + * size. See DATA_SIZE_MAX in journald-native.c. */ +#define COREDUMP_MAX (1024*1024*767u) enum { ARG_PID = 1, --- src/journal/journald-native.c +++ src/journal/journald-native.c 2014-07-16 12:50:45.000000000 +0000 @@ -34,8 +34,8 @@ /* Make sure not to make this smaller than the maximum coredump * size. See COREDUMP_MAX in coredump.c */ -#define ENTRY_SIZE_MAX (1024*1024*768) -#define DATA_SIZE_MAX (1024*1024*768) +#define ENTRY_SIZE_MAX (1024*1024*770u) +#define DATA_SIZE_MAX (1024*1024*768u) static bool valid_user_field(const char *p, size_t l) { const char *a; @@ -86,7 +86,7 @@ void server_process_native_message( struct iovec *iovec = NULL; unsigned n = 0, j, tn = (unsigned) -1; const char *p; - size_t remaining, m = 0; + size_t remaining, m = 0, entry_size = 0; int priority = LOG_INFO; char *identifier = NULL, *message = NULL; pid_t object_pid = 0; @@ -110,9 +110,17 @@ void server_process_native_message( if (e == p) { /* Entry separator */ + + if (entry_size + n + 1 > ENTRY_SIZE_MAX) { /* data + separators + trailer */ + log_debug("Entry is too big with %u properties and %zu bytes, ignoring.", + n, entry_size); + continue; + } + server_dispatch_message(s, iovec, n, m, ucred, tv, label, label_len, NULL, priority, object_pid); n = 0; priority = LOG_INFO; + entry_size = 0; p++; remaining--; @@ -150,6 +158,7 @@ void server_process_native_message( iovec[n].iov_base = (char*) p; iovec[n].iov_len = l; n++; + entry_size += iovec[n].iov_len; /* We need to determine the priority * of this entry for the rate limiting @@ -218,7 +227,7 @@ void server_process_native_message( l = le64toh(l_le); if (l > DATA_SIZE_MAX) { - log_debug("Received binary data block too large, ignoring."); + log_debug("Received binary data block of %zu bytes is too large, ignoring.", l); break; } @@ -242,6 +251,7 @@ void server_process_native_message( iovec[n].iov_base = k; iovec[n].iov_len = (e - p) + 1 + l; n++; + entry_size += iovec[n].iov_len; } else free(k); @@ -255,6 +265,13 @@ void server_process_native_message( tn = n++; IOVEC_SET_STRING(iovec[tn], "_TRANSPORT=journal"); + entry_size += strlen("_TRANSPORT=journal"); + + if (entry_size + n + 1 > ENTRY_SIZE_MAX) { /* data + separators + trailer */ + log_debug("Entry is too big with %u properties and %zu bytes, ignoring.", + n, entry_size); + goto finish; + } if (message) { if (s->forward_to_syslog) ++++++ 0001-Do-not-unescape-unit-names-in-Install-section.patch ++++++ Based on 000f6e5667eb4f73e137cbd0d7395a9f9db7728a Mon Sep 17 00:00:00 2001 From: Michal Sekletar <msekleta@redhat.com> Date: Mon, 26 May 2014 20:09:45 +0200 Subject: [PATCH] Do not unescape unit names in [Install] section https://bugs.freedesktop.org/show_bug.cgi?id=49316 --- src/shared/conf-parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- src/shared/conf-parser.c +++ src/shared/conf-parser.c 2014-05-27 07:36:20.478236631 +0000 @@ -723,7 +723,7 @@ int config_parse_strv(const char *unit, FOREACH_WORD_QUOTED(w, l, rvalue, state) { _cleanup_free_ char *n; - n = cunescape_length(w, l); + n = strndup(w, l); if (!n) return log_oom(); ++++++ 0001-Don-t-snprintf-a-potentially-NULL-pointer.patch ++++++
From 5effdfa831d75306fc0ff9b47d39997e4ae87f16 Mon Sep 17 00:00:00 2001 From: Michael Meeks <michael.meeks@collabora.com> Date: Tue, 11 Feb 2014 14:42:26 +0000 Subject: [PATCH] Don't snprintf a potentially NULL pointer.
--- src/shared/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/log.c b/src/shared/log.c index 2a075ff..d6b138f 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -479,7 +479,7 @@ static int log_do_header(char *header, size_t size, func ? "CODE_FUNCTION=" : "", func ? LINE_MAX : 0, func, func ? "\n" : "", - object ? object_name : "", + object_name ? object_name : "", object ? LINE_MAX : 0, object, /* %.0s means no output */ object ? "\n" : "", program_invocation_short_name); -- 1.8.4.5 ++++++ 0001-Fix-systemd-stdio-bridge-symlink.patch ++++++
From 8100c1a8f58b2fb5d97e156420a7e16562e93bc4 Mon Sep 17 00:00:00 2001 From: Mike Gilbert <floppym@gentoo.org> Date: Sun, 2 Mar 2014 23:37:39 -0500 Subject: [PATCH] Fix systemd-stdio-bridge symlink
The symlink is created in bindir (/usr/bin), and points to a binary which lives in rootlibexecdir (/lib/systemd or /usr/lib/systemd). A relative symlink does not work here. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git Makefile.am Makefile.am index 38445fb..e7134a2 100644 --- Makefile.am +++ Makefile.am @@ -1978,7 +1978,7 @@ systemd_bus_proxyd_LDADD = \ bus-proxyd-install-hook: $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir) - $(AM_V_LN)$(LN_S) -f ../lib/systemd/systemd-bus-proxyd $(DESTDIR)$(bindir)/systemd-stdio-bridge + $(AM_V_LN)$(LN_S) -f $(rootlibexecdir)/systemd-bus-proxyd $(DESTDIR)$(bindir)/systemd-stdio-bridge bus-proxyd-uninstall-hook: rm -f $(DESTDIR)$(bindir)/systemd-stdio-bridge -- 1.7.9.2 ++++++ 0001-Fix-warning-about-unused-variable-with-SELINUX.patch ++++++
From 493d521d9ffe706741665a88ea14929913ea2eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 23 Sep 2014 09:22:40 -0400 Subject: [PATCH] Fix warning about unused variable with !SELINUX
src/shared/label.c:255:15: warning: unused variable 'l' [-Wunused-variable] char *l = NULL; ^ --- src/shared/label.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git src/shared/label.c src/shared/label.c index 02b41f0..b6af38d 100644 --- src/shared/label.c +++ src/shared/label.c @@ -252,9 +252,10 @@ fail: int label_get_our_label(char **label) { int r = -EOPNOTSUPP; - char *l = NULL; #ifdef HAVE_SELINUX + char *l = NULL; + r = getcon(&l); if (r < 0) return r; -- 1.7.9.2 ++++++ 0001-On_s390_con3270_disable_ANSI_colour_esc.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:20:59.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:20:59.000000000 +0100 @@ -1,29 +1,25 @@ --- rules/99-systemd.rules.in | 2 - src/core/manager.c | 24 ++++++++--- - src/shared/util.c | 99 ++++++++++++++++++++++++++++++++++++++++++++-- + src/core/manager.c | 24 ++++++++-- + src/shared/util.c | 101 ++++++++++++++++++++++++++++++++++++++++++++-- src/shared/util.h | 1 - 4 files changed, 116 insertions(+), 10 deletions(-) + 4 files changed, 118 insertions(+), 10 deletions(-) -Index: systemd/rules/99-systemd.rules.in -=================================================================== ---- systemd.orig/rules/99-systemd.rules.in -+++ systemd/rules/99-systemd.rules.in +--- systemd-208/rules/99-systemd.rules.in ++++ systemd-208/rules/99-systemd.rules.in 2014-02-05 10:34:17.346235540 +0000 @@ -7,7 +7,7 @@ ACTION=="remove", GOTO="systemd_end" --SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty[0-9]*", TAG+="systemd" +-SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*", TAG+="systemd" +SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty*", TAG+="systemd" KERNEL=="vport*", TAG+="systemd" -Index: systemd/src/core/manager.c -=================================================================== ---- systemd.orig/src/core/manager.c -+++ systemd/src/core/manager.c -@@ -113,7 +113,7 @@ static int manager_watch_jobs_in_progres +--- systemd-210/src/core/manager.c ++++ systemd-210/src/core/manager.c 2014-04-30 10:51:43.398735332 +0000 +@@ -110,7 +110,7 @@ static int manager_watch_jobs_in_progres #define CYLON_BUFFER_EXTRA (2*(sizeof(ANSI_RED_ON)-1) + sizeof(ANSI_HIGHLIGHT_RED_ON)-1 + 2*(sizeof(ANSI_HIGHLIGHT_OFF)-1)) @@ -32,7 +28,7 @@ char *p = buffer; assert(buflen >= CYLON_BUFFER_EXTRA + width + 1); -@@ -122,12 +122,14 @@ static void draw_cylon(char buffer[], si +@@ -119,12 +119,14 @@ static void draw_cylon(char buffer[], si if (pos > 1) { if (pos > 2) p = mempset(p, ' ', pos-2); @@ -49,7 +45,7 @@ *p++ = '*'; } -@@ -138,7 +140,8 @@ static void draw_cylon(char buffer[], si +@@ -135,7 +137,8 @@ static void draw_cylon(char buffer[], si *p++ = '*'; if (pos < width-1) p = mempset(p, ' ', width-1-pos); @@ -59,7 +55,7 @@ } } -@@ -155,6 +158,7 @@ void manager_flip_auto_status(Manager *m +@@ -150,6 +153,7 @@ void manager_flip_auto_status(Manager *m } static void manager_print_jobs_in_progress(Manager *m) { @@ -67,7 +63,7 @@ _cleanup_free_ char *job_of_n = NULL; Iterator i; Job *j; -@@ -180,10 +184,20 @@ static void manager_print_jobs_in_progre +@@ -174,10 +178,20 @@ static void manager_print_jobs_in_progre assert(counter == print_nr + 1); assert(j); @@ -89,11 +85,9 @@ m->jobs_in_progress_iteration++; -Index: systemd/src/shared/util.c -=================================================================== ---- systemd.orig/src/shared/util.c -+++ systemd/src/shared/util.c -@@ -3212,6 +3212,7 @@ int status_vprintf(const char *status, b +--- systemd-210/src/shared/util.c ++++ systemd-210/src/shared/util.c 2014-04-30 10:39:17.154736438 +0000 +@@ -2886,6 +2886,7 @@ int status_vprintf(const char *status, b struct iovec iovec[6] = {}; int n = 0; static bool prev_ephemeral; @@ -101,12 +95,12 @@ assert(format); -@@ -3225,6 +3226,41 @@ int status_vprintf(const char *status, b +@@ -2899,6 +2900,41 @@ int status_vprintf(const char *status, b if (fd < 0) return fd; + if (_unlikely_(is_ansi_console < 0)) -+ is_ansi_console = ansi_console(fd); ++ is_ansi_console = (int)ansi_console(fd); + + if (status && !is_ansi_console) { + const char *esc, *ptr; @@ -143,7 +137,7 @@ if (ellipse) { char *e; size_t emax, sl; -@@ -3247,8 +3283,12 @@ int status_vprintf(const char *status, b +@@ -2921,8 +2957,12 @@ int status_vprintf(const char *status, b } } @@ -158,7 +152,7 @@ prev_ephemeral = ephemeral; if (status) { -@@ -3504,8 +3544,22 @@ void columns_lines_cache_reset(int signu +@@ -3169,12 +3209,47 @@ void columns_lines_cache_reset(int signu bool on_tty(void) { static int cached_on_tty = -1; @@ -182,9 +176,6 @@ return cached_on_tty; } -@@ -3523,6 +3577,27 @@ int files_same(const char *filea, const - a.st_ino == b.st_ino; - } +bool ansi_console(int fd) { + static int cached_ansi_console = -1; @@ -208,13 +199,13 @@ +} + int running_in_chroot(void) { - int ret; + struct stat a = {}, b = {}; -@@ -4006,7 +4081,23 @@ bool tty_is_vc_resolve(const char *tty) +@@ -3630,7 +3705,25 @@ bool tty_is_vc_resolve(const char *tty) const char *default_term_for_tty(const char *tty) { assert(tty); -- return tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt220"; +- return tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt102"; + if (tty_is_vc_resolve(tty)) + return "TERM=linux"; + @@ -230,16 +221,16 @@ + if (streq(mode, "3270")) + return "TERM=ibm327x"; + } ++ if (streq(tty, "ttyS1")) ++ return "TERM=vt220"; +#endif -+ return "TERM=vt220"; ++ return "TERM=vt102"; } bool dirent_is_file(const struct dirent *de) { -Index: systemd/src/shared/util.h -=================================================================== ---- systemd.orig/src/shared/util.h -+++ systemd/src/shared/util.h -@@ -475,6 +475,7 @@ unsigned lines(void); +--- systemd-210/src/shared/util.h ++++ systemd-210/src/shared/util.h 2014-04-30 10:24:51.134235665 +0000 +@@ -418,6 +418,7 @@ unsigned lines(void); void columns_lines_cache_reset(int _unused_ signum); bool on_tty(void); ++++++ 0001-activate-fix-fd-leak-in-do_accept.patch ++++++
From aa44499da15a8fa7026463555a7a27e55e4e24a8 Mon Sep 17 00:00:00 2001 From: Philippe De Swert <philippedeswert@gmail.com> Date: Wed, 10 Sep 2014 22:14:41 +0300 Subject: [PATCH] activate: fix fd leak in do_accept()
Found with Coverity. --- src/activate/activate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/activate/activate.c src/activate/activate.c index 8942773..0a1df37 100644 --- src/activate/activate.c +++ src/activate/activate.c @@ -242,7 +242,7 @@ static int launch1(const char* child, char** argv, char **env, int fd) { static int do_accept(const char* name, char **argv, char **envp, int fd) { _cleanup_free_ char *local = NULL, *peer = NULL; - int fd2; + _cleanup_close_ int fd2 = -1; fd2 = accept(fd, NULL, NULL); if (fd2 < 0) { -- 1.7.9.2 ++++++ 0001-add-hdflush-for-reboot-or-hddown-for-poweroff.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:20:59.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:20:59.000000000 +0100 @@ -1,13 +1,11 @@ --- - src/core/shutdown.c | 4 ++++ - src/systemctl/systemctl.c | 18 ++++++++++++------ - 2 files changed, 16 insertions(+), 6 deletions(-) + systemd-209/src/core/shutdown.c | 4 ++++ + systemd-209/src/systemctl/systemctl.c | 22 +++++++++++++++------- + 2 files changed, 19 insertions(+), 7 deletions(-) -Index: systemd-218/src/core/shutdown.c -=================================================================== ---- systemd-218.orig/src/core/shutdown.c -+++ systemd-218/src/core/shutdown.c -@@ -400,6 +400,10 @@ int main(int argc, char *argv[]) { +--- systemd-209/src/core/shutdown.c ++++ systemd-209/src/core/shutdown.c 2014-02-28 11:17:22.000000000 +0000 +@@ -449,6 +449,10 @@ int main(int argc, char *argv[]) { } reboot(cmd); @@ -18,11 +16,9 @@ if (errno == EPERM && in_container) { /* If we are in a container, and we lacked * CAP_SYS_BOOT just exit, this will kill our -Index: systemd-218/src/systemctl/systemctl.c -=================================================================== ---- systemd-218.orig/src/systemctl/systemctl.c -+++ systemd-218/src/systemctl/systemctl.c -@@ -94,6 +94,7 @@ static bool arg_no_pager = false; +--- systemd-209/src/systemctl/systemctl.c ++++ systemd-209/src/systemctl/systemctl.c 2014-02-28 11:19:35.000000000 +0000 +@@ -93,6 +93,7 @@ static bool arg_no_pager = false; static bool arg_no_wtmp = false; static bool arg_no_wall = false; static bool arg_no_reload = false; @@ -30,7 +26,7 @@ static bool arg_show_types = false; static bool arg_ignore_inhibitors = false; static bool arg_dry = false; -@@ -6813,6 +6814,7 @@ static int halt_parse_argv(int argc, cha +@@ -5578,6 +5579,7 @@ static int halt_parse_argv(int argc, cha { "reboot", no_argument, NULL, ARG_REBOOT }, { "force", no_argument, NULL, 'f' }, { "wtmp-only", no_argument, NULL, 'w' }, @@ -38,7 +34,7 @@ { "no-wtmp", no_argument, NULL, 'd' }, { "no-wall", no_argument, NULL, ARG_NO_WALL }, {} -@@ -6865,10 +6867,13 @@ static int halt_parse_argv(int argc, cha +@@ -5629,10 +5631,13 @@ static int halt_parse_argv(int argc, cha case 'i': case 'h': @@ -53,17 +49,17 @@ case '?': return -EINVAL; -@@ -7511,7 +7516,8 @@ static int halt_now(enum action a) { - /* The kernel will automaticall flush ATA disks and suchlike - * on reboot(), but the file systems need to be synce'd - * explicitly in advance. */ -- sync(); +@@ -6274,20 +6279,23 @@ done: + + static int halt_now(enum action a) { + +-/* Make sure C-A-D is handled by the kernel from this + if (!arg_no_sync) + sync(); - - /* Make sure C-A-D is handled by the kernel from this point - * on... */ -@@ -7519,14 +7525,14 @@ static int halt_now(enum action a) { ++ ++ /* Make sure C-A-D is handled by the kernel from this + * point on... */ + reboot(RB_ENABLE_CAD); switch (a) { @@ -71,11 +67,12 @@ - log_info("Halting."); - reboot(RB_HALT_SYSTEM); - return -errno; - +- case ACTION_POWEROFF: log_info("Powering off."); reboot(RB_POWER_OFF); -+ /* fall-through */ ++ /* Fall through */ ++ + case ACTION_HALT: + log_info("Halting."); + reboot(RB_HALT_SYSTEM); ++++++ 0001-add-network-device-after-NFS-mount-units.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:20:59.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:20:59.000000000 +0100 @@ -11,23 +11,19 @@ src/shared/util.c | 1 5 files changed, 234 insertions(+), 2 deletions(-) -Index: systemd-218/Makefile.am -=================================================================== ---- systemd-218.orig/Makefile.am -+++ systemd-218/Makefile.am -@@ -1134,6 +1134,8 @@ libsystemd_core_la_SOURCES = \ +--- systemd-210/Makefile.am ++++ systemd-210/Makefile.am 2014-02-26 12:44:20.000000000 +0000 +@@ -994,6 +994,8 @@ libsystemd_core_la_SOURCES = \ src/core/machine-id-setup.h \ src/core/mount-setup.c \ src/core/mount-setup.h \ + src/core/mount-iface.c \ + src/core/mount-iface.h \ - src/core/kmod-setup.c \ - src/core/kmod-setup.h \ src/core/loopback-setup.h \ -Index: systemd-218/src/core/mount-iface.c -=================================================================== ---- /dev/null -+++ systemd-218/src/core/mount-iface.c + src/core/loopback-setup.c \ + src/core/condition.c \ +--- systemd-210/src/core/mount-iface.c ++++ systemd-210/src/core/mount-iface.c 2014-02-26 10:18:36.000000000 +0000 @@ -0,0 +1,173 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + @@ -170,7 +166,7 @@ + continue; + + ret = ifa->ifa_name; -+ break; ++ break; + } else if (ifa->ifa_addr->sa_family == AF_INET6) { + struct in6_addr *addr, *mask, dest, ip6; + unsigned int prefix; @@ -202,10 +198,8 @@ + freeifaddrs(ifa_list); + ifa_list = NULL; +} -Index: systemd-218/src/core/mount-iface.h -=================================================================== ---- /dev/null -+++ systemd-218/src/core/mount-iface.h +--- systemd-210/src/core/mount-iface.h ++++ systemd-210/src/core/mount-iface.h 2014-02-26 10:08:20.000000000 +0000 @@ -0,0 +1,25 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + @@ -232,11 +226,9 @@ + +char *host2iface(const char *ip); +void freeroutes(void); -Index: systemd-218/src/core/mount.c -=================================================================== ---- systemd-218.orig/src/core/mount.c -+++ systemd-218/src/core/mount.c -@@ -38,6 +38,7 @@ +--- systemd-210/src/core/mount.c ++++ systemd-210/src/core/mount.c 2014-03-03 12:13:23.406246117 +0000 +@@ -36,6 +36,7 @@ #include "mkdir.h" #include "path-util.h" #include "mount-setup.h" @@ -244,7 +236,7 @@ #include "unit-name.h" #include "dbus-mount.h" #include "special.h" -@@ -1365,8 +1366,9 @@ static int mount_add_one( +@@ -1388,8 +1389,9 @@ static int mount_add_one( _cleanup_free_ char *e = NULL, *w = NULL, *o = NULL, *f = NULL; bool load_extras = false; MountParameters *p; @@ -255,7 +247,7 @@ int r; assert(m); -@@ -1391,6 +1393,8 @@ static int mount_add_one( +@@ -1414,6 +1416,8 @@ static int mount_add_one( if (!e) return -ENOMEM; @@ -264,16 +256,16 @@ u = manager_get_unit(m, e); if (!u) { delete = true; -@@ -1419,7 +1423,7 @@ static int mount_add_one( +@@ -1442,7 +1446,7 @@ static int mount_add_one( if (m->running_as == SYSTEMD_SYSTEM) { const char* target; -- target = mount_needs_network(options, fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET; +- target = fstype_is_network(fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET; + target = isnetwork ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET; + r = unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true); if (r < 0) - goto fail; -@@ -1505,6 +1509,32 @@ static int mount_add_one( +@@ -1519,6 +1523,32 @@ static int mount_add_one( goto fail; } @@ -296,7 +288,7 @@ + else { + r = unit_add_dependency_by_name(u, UNIT_AFTER, target, NULL, true); + if (r < 0) -+ log_unit_error(u->id, "Failed to add dependency on %s, ignoring: %s", ++ log_error_unit(u->id, "Failed to add dependency on %s, ignoring: %s", + target, strerror(-r)); + } + } @@ -306,23 +298,21 @@ if (changed) unit_add_to_dbus_queue(u); -@@ -1560,6 +1590,7 @@ static int mount_load_proc_self_mountinf - if (r == 0 && k < 0) +@@ -1583,6 +1613,7 @@ static int mount_load_proc_self_mountinf + if (k < 0) r = k; } + freeroutes(); /* Just in case of using the routing table with host2iface() */ return r; } -Index: systemd-218/src/shared/util.c -=================================================================== ---- systemd-218.orig/src/shared/util.c -+++ systemd-218/src/shared/util.c -@@ -1667,6 +1667,7 @@ bool fstype_is_network(const char *fstyp +--- systemd-210/src/shared/util.c ++++ systemd-210/src/shared/util.c 2014-02-24 15:17:42.000000000 +0000 +@@ -1502,6 +1502,7 @@ bool fstype_is_network(const char *fstyp "ncp\0" "nfs\0" "nfs4\0" + "afs\0" "gfs\0" - "gfs2\0" - "glusterfs\0"; + "gfs2\0"; + ++++++ 0001-architecture-Add-tilegx.patch ++++++
From 46eea341c36f0caf0bdd5b2274a1ef7cb4e83e97 Mon Sep 17 00:00:00 2001 From: Henrik Grindal Bakken <hgb@ifi.uio.no> Date: Thu, 27 Feb 2014 21:19:13 +0100 Subject: [PATCH] architecture: Add tilegx
Add Tilera's TILE-GX processor family support. --- src/shared/architecture.c | 3 +++ src/shared/architecture.h | 3 +++ 2 files changed, 6 insertions(+) diff --git src/shared/architecture.c src/shared/architecture.c index ceba492..fcdb3d5 100644 --- src/shared/architecture.c +++ src/shared/architecture.c @@ -112,6 +112,8 @@ Architecture uname_architecture(void) { { "sh", ARCHITECTURE_SH }, #elif defined(__m68k__) { "m68k", ARCHITECTURE_M68K }, +#elif defined(__tilegx__) + { "tilegx", ARCHITECTURE_TILEGX }, #else #error "Please register your architecture here!" #endif @@ -158,6 +160,7 @@ static const char *const architecture_table[_ARCHITECTURE_MAX] = { [ARCHITECTURE_SH] = "sh", [ARCHITECTURE_SH64] = "sh64", [ARCHITECTURE_M68K] = "m68k", + [ARCHITECTURE_TILEGX] = "tilegx", }; DEFINE_STRING_TABLE_LOOKUP(architecture, Architecture); diff --git src/shared/architecture.h src/shared/architecture.h index 3183645..e589a91 100644 --- src/shared/architecture.h +++ src/shared/architecture.h @@ -47,6 +47,7 @@ typedef enum Architecture { ARCHITECTURE_SH, ARCHITECTURE_SH64, ARCHITECTURE_M68K, + ARCHITECTURE_TILEGX, _ARCHITECTURE_MAX, _ARCHITECTURE_INVALID = -1 } Architecture; @@ -107,6 +108,8 @@ Architecture uname_architecture(void); # define native_architecture() ARCHITECTURE_SH #elif defined(__m68k__) # define native_architecture() ARCHITECTURE_M68K +#elif defined(__tilegx__) +# define native_architecture() ARCHITECTURE_TILEGX #else #error "Please register your architecture here!" #endif -- 1.7.9.2 ++++++ 0001-backlight-Avoid-restoring-brightness-to-an-unreadabl.patch ++++++
From 7b909d7407965c03caaba30daae7aee113627a83 Mon Sep 17 00:00:00 2001 From: Josh Triplett <josh@joshtriplett.org> Date: Tue, 11 Mar 2014 21:16:33 -0700 Subject: [PATCH] backlight: Avoid restoring brightness to an unreadably dim level
Some systems turn the backlight all the way off at the lowest levels. Clamp saved brightness to at least 1 or 5% of max_brightness. This avoids preserving an unreadably dim screen, which would otherwise force the user to disable state restoration. --- src/backlight/backlight.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git src/backlight/backlight.c src/backlight/backlight.c index 81470b3..abf8bcf 100644 --- src/backlight/backlight.c +++ src/backlight/backlight.c @@ -192,6 +192,48 @@ static bool validate_device(struct udev *udev, struct udev_device *device) { return true; } +/* Some systems turn the backlight all the way off at the lowest levels. + * clamp_brightness clamps the saved brightness to at least 1 or 5% of + * max_brightness. This avoids preserving an unreadably dim screen, which + * would otherwise force the user to disable state restoration. */ +static void clamp_brightness(struct udev_device *device, char **value) { + int r; + const char *max_brightness_str; + unsigned brightness, max_brightness, new_brightness; + + max_brightness_str = udev_device_get_sysattr_value(device, "max_brightness"); + if (!max_brightness_str) { + log_warning("Failed to read max_brightness attribute; not checking saved brightness"); + return; + } + + r = safe_atou(*value, &brightness); + if (r < 0) { + log_warning("Failed to parse brightness \"%s\": %s", *value, strerror(-r)); + return; + } + + r = safe_atou(max_brightness_str, &max_brightness); + if (r < 0) { + log_warning("Failed to parse max_brightness \"%s\": %s", max_brightness_str, strerror(-r)); + return; + } + + new_brightness = MAX3(brightness, 1U, max_brightness/20); + if (new_brightness != brightness) { + char *old_value = *value; + + r = asprintf(value, "%u", new_brightness); + if (r < 0) { + log_oom(); + return; + } + + log_debug("Saved brightness %s too low; increasing to %s.", old_value, *value); + free(old_value); + } +} + int main(int argc, char *argv[]) { _cleanup_udev_unref_ struct udev *udev = NULL; _cleanup_udev_device_unref_ struct udev_device *device = NULL; @@ -306,6 +348,8 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } + clamp_brightness(device, &value); + r = udev_device_set_sysattr_value(device, "brightness", value); if (r < 0) { log_error("Failed to write system attribute: %s", strerror(-r)); -- 1.7.9.2 ++++++ 0001-bash-completion-fix-__get_startable_units.patch ++++++
From a163b64c4b08e8a4ad39a9a295acf3d1634024a3 Mon Sep 17 00:00:00 2001 From: Dan Kilman <dankilman@gmail.com> Date: Sun, 13 Apr 2014 18:06:13 +0300 Subject: [PATCH] bash completion: fix __get_startable_units
--- shell-completion/bash/systemctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git shell-completion/bash/systemctl shell-completion/bash/systemctl index 992e52d..e1c8420 100644 --- shell-completion/bash/systemctl +++ shell-completion/bash/systemctl @@ -56,7 +56,7 @@ __get_all_units () { __systemctl $1 list-units --all \ __get_active_units () { __systemctl $1 list-units \ | { while read -r a b; do echo " $a"; done; }; } __get_startable_units () { __systemctl $1 list-units --all -t service,timer,socket,mount,automount,path,snapshot,swap \ - | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed " ]] && echo " $a"; done; }; } + | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }; } __get_failed_units () { __systemctl $1 list-units \ | { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; } __get_enabled_units () { __systemctl $1 list-unit-files \ -- 1.7.9.2 ++++++ 0001-bash-completion-p-option-for-journalctl.patch ++++++
From be8f4a9fa732d61e845e1ab1a62ac3a6b368d3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 19 Jul 2014 19:46:04 -0400 Subject: [PATCH] bash-completion: -p option for journalctl
--- shell-completion/bash/journalctl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git shell-completion/bash/journalctl shell-completion/bash/journalctl index e4b2f4a..14dcd22 100644 --- shell-completion/bash/journalctl +++ shell-completion/bash/journalctl @@ -35,6 +35,8 @@ __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC} _UDEV_{SYSNAME,DEVNODE,DEVLINK} __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP) +__syslog_priorities=(emerg alert crit err warning notice info debug) + _journalctl() { local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( @@ -44,8 +46,8 @@ _journalctl() { --no-tail -q --quiet --setup-keys --this-boot --verify --version --list-catalog --update-catalog --list-boots' [ARG]='-b --boot --this-boot -D --directory --file -F --field - -o --output -u --unit --user-unit' - [ARGUNKNOWN]='-c --cursor --interval -n --lines -p --priority --since --until + -o --output -u --unit --user-unit -p --priority' + [ARGUNKNOWN]='-c --cursor --interval -n --lines --since --until --verify-key' ) @@ -68,6 +70,9 @@ _journalctl() { --field|-F) comps=${__journal_fields[*]} ;; + --priority|-p) + comps=${__syslog_priorities[*]} + ;; --unit|-u) comps=$(journalctl -F '_SYSTEMD_UNIT' 2>/dev/null) ;; -- 1.7.9.2 ++++++ 0001-bnc888612-logind-polkit-acpi.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:20:59.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:20:59.000000000 +0100 @@ -3,11 +3,11 @@ src/login/logind-dbus.c | 20 ++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) -Index: systemd-218/src/login/logind-action.c +Index: systemd-210/src/login/logind-action.c =================================================================== ---- systemd-218.orig/src/login/logind-action.c -+++ systemd-218/src/login/logind-action.c -@@ -83,6 +83,11 @@ int manager_handle_action( +--- systemd-210.orig/src/login/logind-action.c ++++ systemd-210/src/login/logind-action.c +@@ -101,6 +101,11 @@ int manager_handle_action( /* If the key handling is inhibited, don't do anything */ if (inhibit_key > 0) { @@ -19,11 +19,11 @@ if (manager_is_inhibited(m, inhibit_key, INHIBIT_BLOCK, NULL, true, false, 0, NULL)) { log_debug("Refusing operation, %s is inhibited.", inhibit_what_to_string(inhibit_key)); return 0; -Index: systemd-218/src/login/logind-dbus.c +Index: systemd-210/src/login/logind-dbus.c =================================================================== ---- systemd-218.orig/src/login/logind-dbus.c -+++ systemd-218/src/login/logind-dbus.c -@@ -1487,9 +1487,11 @@ static int method_do_shutdown_or_sleep( +--- systemd-210.orig/src/login/logind-dbus.c ++++ systemd-210/src/login/logind-dbus.c +@@ -1469,9 +1469,11 @@ static int method_do_shutdown_or_sleep( sd_bus_error *error) { _cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL; @@ -36,7 +36,7 @@ assert(m); assert(message); -@@ -1533,7 +1535,17 @@ static int method_do_shutdown_or_sleep( +@@ -1515,7 +1517,17 @@ static int method_do_shutdown_or_sleep( multiple_sessions = r > 0; blocked = manager_is_inhibited(m, w, INHIBIT_BLOCK, NULL, false, true, uid, NULL); @@ -52,24 +52,24 @@ + + + if (multiple_sessions && !shutdown_through_acpi) { - r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action_multiple_sessions, interactive, &m->polkit_registry, error); + r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message, + action_multiple_sessions, interactive, error, method, m); if (r < 0) - return r; -@@ -1541,7 +1553,7 @@ static int method_do_shutdown_or_sleep( +@@ -1524,7 +1536,7 @@ static int method_do_shutdown_or_sleep( return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ } - if (blocked) { + if (blocked && !shutdown_through_acpi) { - r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action_ignore_inhibit, interactive, &m->polkit_registry, error); + r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message, + action_ignore_inhibit, interactive, error, method, m); if (r < 0) - return r; -@@ -1549,7 +1561,7 @@ static int method_do_shutdown_or_sleep( +@@ -1533,7 +1545,7 @@ static int method_do_shutdown_or_sleep( return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ } - if (!multiple_sessions && !blocked) { + if (!multiple_sessions && !blocked && !shutdown_through_acpi) { - r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action, interactive, &m->polkit_registry, error); + r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message, + action, interactive, error, method, m); if (r < 0) - return r; ++++++ 0001-build-sys-use-glibc-s-xattr-support-instead-of-requi.patch ++++++ Based on d2edfae0f9bdbecf6a8518e2a5bcf06f470e0d9e Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Wed, 28 May 2014 17:36:40 +0800 Subject: [PATCH] build-sys: use glibc's xattr support instead of requiring libattr --- configure.ac | 53 ++----------------------------------------- src/core/mount-setup.c | 2 - src/core/socket.c | 4 --- src/journal/journal-file.c | 7 ----- src/journal/journal-vacuum.c | 10 -------- src/shared/label.c | 2 - src/shared/smack-util.c | 4 --- 7 files changed, 7 insertions(+), 75 deletions(-) --- configure.ac +++ configure.ac 2014-06-03 00:00:00.000000000 +0000 @@ -526,44 +526,6 @@ AC_SUBST(ACL_LIBS) AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno]) # ------------------------------------------------------------------------------ -AC_ARG_ENABLE([xattr], - AS_HELP_STRING([--disable-xattr],[Disable optional XATTR support]), - [case "${enableval}" in - yes) have_xattr=yes ;; - no) have_xattr=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-xattr) ;; - esac], - [have_xattr=auto]) - -if test "x${have_xattr}" != xno ; then - AC_CHECK_HEADERS( - [attr/xattr.h], - [have_xattr=yes], - [if test "x$have_xattr" = xyes ; then - AC_MSG_ERROR([*** XATTR headers not found.]) - fi]) - - AC_CHECK_LIB( - [attr], - [fsetxattr], - [have_xattr=yes], - [if test "x$have_xattr" = xyes ; then - AC_MSG_ERROR([*** libattr not found.]) - fi]) - - if test "x$have_xattr" = xyes ; then - XATTR_LIBS="-lattr" - AC_DEFINE(HAVE_XATTR, 1, [XATTR available]) - else - have_xattr=no - fi -else - XATTR_LIBS= -fi -AC_SUBST(XATTR_LIBS) -AM_CONDITIONAL([HAVE_XATTR], [test "x$have_xattr" != xno]) - -# ------------------------------------------------------------------------------ AC_ARG_ENABLE([smack], AS_HELP_STRING([--disable-smack],[Disable optional SMACK support]), [case "${enableval}" in yes) have_smack=yes ;; @@ -572,17 +534,9 @@ AC_ARG_ENABLE([smack], AS_HELP_STRING([- esac], [have_smack=auto]) -if test "x${have_xattr}" = xno; then - if test "x${have_smack}" = xyes; then - AC_MSG_ERROR(SMACK requires xattr support) - else - have_smack=no - fi -else - if test "x${have_smack}" = xauto; then - M4_DEFINES="$M4_DEFINES -DHAVE_SMACK" - have_smack=yes - fi +if test "x${have_smack}" = xauto; then + M4_DEFINES="$M4_DEFINES -DHAVE_SMACK" + have_smack=yes fi AC_ARG_WITH(smack-run-label, @@ -1131,7 +1085,6 @@ AC_MSG_RESULT([ SMACK: ${have_smack} XZ: ${have_xz} ACL: ${have_acl} - XATTR: ${have_xattr} GCRYPT: ${have_gcrypt} QRENCODE: ${have_qrencode} MICROHTTPD: ${have_microhttpd} --- src/core/mount-setup.c +++ src/core/mount-setup.c 2014-06-03 00:00:00.000000000 +0000 @@ -93,10 +93,8 @@ static const MountPoint mount_table[] = NULL, MNT_FATAL|MNT_IN_CONTAINER }, { "tmpfs", "/sys/fs/cgroup", "tmpfs", "mode=755", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME, NULL, MNT_IN_CONTAINER }, -#ifdef HAVE_XATTR { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd,xattr", MS_NOSUID|MS_NOEXEC|MS_NODEV, NULL, MNT_IN_CONTAINER }, -#endif { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd", MS_NOSUID|MS_NOEXEC|MS_NODEV, NULL, MNT_IN_CONTAINER }, { "pstore", "/sys/fs/pstore", "pstore", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, --- src/core/socket.c +++ src/core/socket.c 2014-06-03 00:00:00.000000000 +0000 @@ -29,9 +29,7 @@ #include <arpa/inet.h> #include <netinet/tcp.h> #include <mqueue.h> -#ifdef HAVE_XATTR -#include <attr/xattr.h> -#endif +#include <sys/xattr.h> #include "sd-event.h" #include "log.h" --- src/journal/journal-file.c +++ src/journal/journal-file.c 2014-06-03 00:00:00.000000000 +0000 @@ -26,10 +26,7 @@ #include <sys/statvfs.h> #include <fcntl.h> #include <stddef.h> - -#ifdef HAVE_XATTR -#include <attr/xattr.h> -#endif +#include <sys/xattr.h> #include "journal-def.h" #include "journal-file.h" @@ -2515,7 +2512,6 @@ int journal_file_open( } if (f->last_stat.st_size == 0 && f->writable) { -#ifdef HAVE_XATTR uint64_t crtime; /* Let's attach the creation time to the journal file, @@ -2530,7 +2526,6 @@ int journal_file_open( crtime = htole64((uint64_t) now(CLOCK_REALTIME)); fsetxattr(f->fd, "user.crtime_usec", &crtime, sizeof(crtime), XATTR_CREATE); -#endif #ifdef HAVE_GCRYPT /* Try to load the FSPRG state, and if we can't, then --- src/journal/journal-vacuum.c +++ src/journal/journal-vacuum.c 2014-06-03 00:00:00.000000000 +0000 @@ -24,10 +24,7 @@ #include <sys/stat.h> #include <sys/statvfs.h> #include <unistd.h> - -#ifdef HAVE_XATTR -#include <attr/xattr.h> -#endif +#include <sys/xattr.h> #include "journal-def.h" #include "journal-file.h" @@ -79,11 +76,8 @@ static void patch_realtime( unsigned long long *realtime) { usec_t x; - -#ifdef HAVE_XATTR uint64_t crtime; _cleanup_free_ const char *path = NULL; -#endif /* The timestamp was determined by the file name, but let's * see if the file might actually be older than the file name @@ -106,7 +100,6 @@ static void patch_realtime( if (x > 0 && x != (usec_t) -1 && x < *realtime) *realtime = x; -#ifdef HAVE_XATTR /* Let's read the original creation time, if possible. Ideally * we'd just query the creation time the FS might provide, but * unfortunately there's currently no sane API to query @@ -125,7 +118,6 @@ static void patch_realtime( if (crtime > 0 && crtime != (uint64_t) -1 && crtime < *realtime) *realtime = crtime; } -#endif } static int journal_file_empty(int dir_fd, const char *name) { --- src/shared/label.c +++ src/shared/label.c 2014-06-03 00:00:00.000000000 +0000 @@ -27,9 +27,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#ifdef HAVE_XATTR #include <sys/xattr.h> -#endif #ifdef HAVE_SELINUX #include <selinux/selinux.h> #include <selinux/label.h> --- src/shared/smack-util.c +++ src/shared/smack-util.c 2014-06-03 00:00:00.000000000 +0000 @@ -23,9 +23,7 @@ #include <unistd.h> #include <string.h> -#ifdef HAVE_XATTR -#include <attr/xattr.h> -#endif +#include <sys/xattr.h> #include "smack-util.h" ++++++ 0001-bus-proxyd-fix-incorrect-comparison.patch ++++++ Based on e05aa2e02ba35d8b3741dddb79af3c802308414b Mon Sep 17 00:00:00 2001 From: Lukas Nykryn <lnykryn@redhat.com> Date: Fri, 25 Jul 2014 10:25:06 +0200 Subject: [PATCH] bus-proxyd: fix incorrect comparison We should be interested in k variable. --- src/bus-proxyd/bus-proxyd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- src/bus-proxyd/bus-proxyd.c +++ src/bus-proxyd/bus-proxyd.c 2014-07-28 09:37:29.274735818 +0000 @@ -698,7 +698,7 @@ int main(int argc, char *argv[]) { k = sd_bus_send(a, m, NULL); if (k < 0) { - if (r == -ECONNRESET) + if (k == -ECONNRESET) r = 0; else { r = k; ++++++ 0001-cgroup-it-s-not-OK-to-invoke-alloca-in-loops.patch ++++++
From a641dcd9bf05418d6a6c165e1c0cff615b4a0f47 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 18 Mar 2014 04:06:36 +0100 Subject: [PATCH] cgroup: it's not OK to invoke alloca() in loops
--- src/core/mount-setup.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git src/core/mount-setup.c src/core/mount-setup.c index 387030a..c6d3f4b 100644 --- src/core/mount-setup.c +++ src/core/mount-setup.c @@ -216,10 +216,10 @@ int mount_setup_early(void) { } int mount_cgroup_controllers(char ***join_controllers) { - int r; - char buf[LINE_MAX]; _cleanup_set_free_free_ Set *controllers = NULL; _cleanup_fclose_ FILE *f; + char buf[LINE_MAX]; + int r; /* Mount all available cgroup controllers that are built into the kernel. */ @@ -262,6 +262,7 @@ int mount_cgroup_controllers(char ***join_controllers) { } for (;;) { + _cleanup_free_ char *options = NULL, *controller = NULL, *where = NULL; MountPoint p = { .what = "cgroup", .type = "cgroup", @@ -269,7 +270,6 @@ int mount_cgroup_controllers(char ***join_controllers) { .mode = MNT_IN_CONTAINER, }; char ***k = NULL; - _cleanup_free_ char *options = NULL, *controller; controller = set_steal_first(controllers); if (!controller) @@ -286,7 +286,7 @@ int mount_cgroup_controllers(char ***join_controllers) { for (i = *k, j = *k; *i; i++) { if (!streq(*i, controller)) { - char _cleanup_free_ *t; + _cleanup_free_ char *t; t = set_remove(controllers, *i); if (!t) { @@ -308,7 +308,11 @@ int mount_cgroup_controllers(char ***join_controllers) { controller = NULL; } - p.where = strappenda("/sys/fs/cgroup/", options); + where = strappend("/sys/fs/cgroup/", options); + if (!where) + return log_oom(); + + p.where = where; p.options = options; r = mount_one(&p, true); @@ -319,7 +323,11 @@ int mount_cgroup_controllers(char ***join_controllers) { char **i; for (i = *k; *i; i++) { - char *t = strappenda("/sys/fs/cgroup/", *i); + _cleanup_free_ char *t = NULL; + + t = strappend("/sys/fs/cgroup/", *i); + if (!t) + return log_oom(); r = symlink(options, t); if (r < 0 && errno != EEXIST) { -- 1.7.9.2 ++++++ 0001-completion-filter-templates-from-restartable-units.patch ++++++ Based on ec15977a3cd82eff6c94bb13db72195f7cd512e8 Mon Sep 17 00:00:00 2001 From: Dave Reisner <dreisner@archlinux.org> Date: Fri, 29 Aug 2014 20:35:15 -0400 Subject: [PATCH] completion: filter templates from restartable units Since c6a373a2634854, we might encounter unit templates via the 'list-units' verb. These aren't restartable (and we throw errors), so make sure they're filtered out of the completion options. fixes downstream bug: https://bugs.archlinux.org/task/41719 --- shell-completion/bash/systemctl.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git shell-completion/bash/systemctl.in shell-completion/bash/systemctl.in index 64b15df..0150018 100644 --- shell-completion/bash/systemctl +++ shell-completion/bash/systemctl @@ -182,7 +182,7 @@ _systemctl () { comps=$( __filter_units_by_property $mode CanStart yes \ $( __get_all_units $mode \ | while read -r line; do \ - [[ "$line" =~ \.(device|snapshot|socket|timer)$ ]] || echo " $line"; \ + [[ "$line" =~ @\.|\.(device|snapshot|socket|timer)$ ]] || echo " $line"; \ done )) compopt -o filenames -- 1.7.9.2 ++++++ 0001-conf-parser-silently-ignore-sections-starting-with-X.patch ++++++
From 342aea195051633c69ba7b8c02c82a0e5f8cbde4 Mon Sep 17 00:00:00 2001 From: Michael Marineau <michael.marineau@coreos.com> Date: Fri, 16 May 2014 16:58:31 -0700 Subject: [PATCH] conf-parser: silently ignore sections starting with "X-"
This allows external tools to keep additional unit information in a separate section without scaring users with a big warning. --- src/shared/conf-parser.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git src/shared/conf-parser.c src/shared/conf-parser.c index d27b1b7..062b15b 100644 --- src/shared/conf-parser.c +++ src/shared/conf-parser.c @@ -204,6 +204,7 @@ static int parse_line(const char* unit, bool allow_include, char **section, unsigned *section_line, + bool *section_ignored, char *l, void *userdata) { @@ -266,7 +267,7 @@ static int parse_line(const char* unit, if (sections && !nulstr_contains(sections, n)) { - if (!relaxed) + if (!relaxed && !startswith(n, "X-")) log_syntax(unit, LOG_WARNING, filename, line, EINVAL, "Unknown section '%s'. Ignoring.", n); @@ -274,10 +275,12 @@ static int parse_line(const char* unit, free(*section); *section = NULL; *section_line = 0; + *section_ignored = true; } else { free(*section); *section = n; *section_line = line; + *section_ignored = false; } return 0; @@ -285,7 +288,7 @@ static int parse_line(const char* unit, if (sections && !*section) { - if (!relaxed) + if (!relaxed && !*section_ignored) log_syntax(unit, LOG_WARNING, filename, line, EINVAL, "Assignment outside of section. Ignoring."); @@ -328,6 +331,7 @@ int config_parse(const char *unit, _cleanup_free_ char *section = NULL, *continuation = NULL; _cleanup_fclose_ FILE *ours = NULL; unsigned line = 0, section_line = 0; + bool section_ignored = false; int r; assert(filename); @@ -399,6 +403,7 @@ int config_parse(const char *unit, allow_include, §ion, §ion_line, + §ion_ignored, p, userdata); free(c); -- 1.7.9.2 ++++++ 0001-core-busname-add-lookup-string-for-BUSNAME_FAILURE_S.patch ++++++
From 36d239dbdaf94ba2d96bb60ac45ecfc58624b1eb Mon Sep 17 00:00:00 2001 From: Daniel Mack <zonque@gmail.com> Date: Fri, 7 Mar 2014 11:41:18 +0100 Subject: [PATCH] core/busname: add lookup string for BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT
When a busname unit enters BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT, the serialization will not be able to look up the result as string via busname_result_to_string(). This leads to an assertion trap during daemon-reexec. --- src/core/busname.c | 1 + 1 file changed, 1 insertion(+) diff --git src/core/busname.c src/core/busname.c index 4c34538..237011a 100644 --- src/core/busname.c +++ src/core/busname.c @@ -548,6 +548,7 @@ DEFINE_STRING_TABLE_LOOKUP(busname_state, BusNameState); static const char* const busname_result_table[_BUSNAME_RESULT_MAX] = { [BUSNAME_SUCCESS] = "success", [BUSNAME_FAILURE_RESOURCES] = "resources", + [BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT] = "failed-permanent", }; DEFINE_STRING_TABLE_LOOKUP(busname_result, BusNameResult); -- 1.7.9.2 ++++++ 0001-core-close-socket-fds-asynchronously.patch ++++++ Based on 574634bcacb01efe15ca2742effd461a5b7afb5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 13 May 2014 23:22:13 +0200 Subject: [PATCH] core: close socket fds asynchronously http://lists.freedesktop.org/archives/systemd-devel/2014-April/018928.html --- src/core/async.c | 24 ++++++++++++++++++++++++ src/core/service.c | 5 +++-- 2 files changed, 27 insertions(+), 2 deletions(-) Index: src/core/service.c =================================================================== --- src/core/service.c.orig +++ src/core/service.c @@ -25,6 +25,7 @@ #include <unistd.h> #include <sys/reboot.h> +#include "async.h" #include "manager.h" #include "unit.h" #include "service.h" @@ -240,7 +241,7 @@ static void service_close_socket_fd(Serv if (s->socket_fd < 0) return; - close_nointr_nofail(s->socket_fd); + asynchronous_close(s->socket_fd); s->socket_fd = -1; } @@ -2767,7 +2768,7 @@ static int service_deserialize_item(Unit else { if (s->socket_fd >= 0) - close_nointr_nofail(s->socket_fd); + asynchronous_close(s->socket_fd); s->socket_fd = fdset_remove(fds, fd); } } else if (streq(key, "main-exec-status-pid")) { Index: src/core/async.c =================================================================== --- src/core/async.c.orig +++ src/core/async.c @@ -24,6 +24,7 @@ #include "async.h" #include "log.h" +#include "util.h" int asynchronous_job(void* (*func)(void *p), void *arg) { pthread_attr_t a; @@ -70,3 +71,26 @@ int asynchronous_sync(void) { return asynchronous_job(sync_thread, NULL); } + +static void *close_thread(void *p) { + int fd = PTR_TO_INT(p); + if (fd >= 0) + close_nointr_nofail(fd); + return NULL; +} + +int asynchronous_close(int fd) { + int r; + + /* This is supposed to behave similar to safe_close(), but + * actually invoke close() asynchronously, so that it will + * never block. Ideally the kernel would have an API for this, + * but it doesn't, so we work around it, and hide this as a + * far away as we can. */ + + r = asynchronous_job(close_thread, INT_TO_PTR(fd)); + if (r < 0 && fd >= 0) + close_nointr_nofail(fd); + + return -1; +} Index: src/core/async.h =================================================================== --- src/core/async.h.orig +++ src/core/async.h @@ -23,3 +23,4 @@ int asynchronous_job(void* (*func)(void *p), void *arg); int asynchronous_sync(void); +int asynchronous_close(int fd); ++++++ 0001-core-don-t-allow-enabling-if-unit-is-masked.patch ++++++
From f7101b7368dfe41dbc8b7203e06133cccb589c01 Mon Sep 17 00:00:00 2001 From: Jan Synacek <jsynacek@redhat.com> Date: Tue, 7 Oct 2014 13:35:41 +0200 Subject: [PATCH] core: don't allow enabling if unit is masked
--- src/shared/install.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git src/shared/install.c src/shared/install.c index fa064c2..945bb27 100644 --- src/shared/install.c +++ src/shared/install.c @@ -1516,6 +1516,19 @@ int unit_file_enable( return r; STRV_FOREACH(i, files) { + UnitFileState state; + + state = unit_file_get_state(scope, root_dir, *i); + if (state < 0) { + log_error("Failed to get unit file state for %s: %s", *i, strerror(-state)); + return state; + } + + if (state == UNIT_FILE_MASKED || state == UNIT_FILE_MASKED_RUNTIME) { + log_error("Failed to enable unit: Unit %s is masked", *i); + return -ENOTSUP; + } + r = install_info_add_auto(&c, *i); if (r < 0) return r; -- 1.7.9.2 ++++++ 0001-core-fix-invalid-free-in-killall.patch ++++++
From 3e09eb5c83e56bc0184bd9d9c44f76047464f77c Mon Sep 17 00:00:00 2001 From: Andreas Henriksson <andreas@fatal.se> Date: Fri, 13 Jun 2014 18:48:19 +0200 Subject: [PATCH] core: fix invalid free() in killall()
static int killall(....) in ./src/core/killall.c tries to get "s" initialized by calling get_process_comm(...) which calls read_one_line_file(...) which if it fails will mean it is left uninitialized. It is then used in argument to strna(s) call where it is dereferenced(!), in addition to nothing else initializing it before the scope it is in finishes. --- src/core/killall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/core/killall.c src/core/killall.c index 57ed41c..eab48f7 100644 --- src/core/killall.c +++ src/core/killall.c @@ -168,7 +168,7 @@ static int killall(int sig, Set *pids, bool send_sighup) { continue; if (sig == SIGKILL) { - _cleanup_free_ char *s; + _cleanup_free_ char *s = NULL; get_process_comm(pid, &s); log_notice("Sending SIGKILL to PID "PID_FMT" (%s).", pid, strna(s)); -- 1.7.9.2 ++++++ 0001-core-fix-resource-leak-in-manager_environment_add.patch ++++++
From aa9f8a30fd7dc7aa3aa2575b75b3f9a0ab3f02db Mon Sep 17 00:00:00 2001 From: Andreas Henriksson <andreas@fatal.se> Date: Tue, 16 Sep 2014 21:11:02 +0200 Subject: [PATCH] core: fix resource leak in manager_environment_add
Second error path must free the (potentially) allocated memory in the first code chunk before returning. Found by coverity. Fixes: CID#1237750 --- src/core/manager.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git src/core/manager.c src/core/manager.c index 0770727..e0c1cd1 100644 --- src/core/manager.c +++ src/core/manager.c @@ -2751,8 +2751,10 @@ int manager_environment_add(Manager *m, char **minus, char **plus) { if (!strv_isempty(plus)) { b = strv_env_merge(2, l, plus); - if (!b) + if (!b) { + strv_free(a); return -ENOMEM; + } l = b; } -- 1.7.9.2 ++++++ 0001-core-swap-only-make-configured-units-part-of-swap.ta.patch ++++++
From 3018d31238caabc2e204aa161e647dc1c1b5d1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Thu, 2 Oct 2014 00:11:36 -0400 Subject: [PATCH] core/swap: only make configured units part of swap.target
We used to make all .swap units either RequiredBy=swap.target or WantedBy=swap.target. But swap.target should be the "configured swap units", either through /etc/fstab or non-generated .swap units. It is surprising when systemd starts treating a swap device that was possibly temporarily enabled as a hard dependency for other units. So do not add dependencies with swap.target for units gleaned from /proc/swaps. Similarly, we added dependencies for all aliases of the device name, which clutters up the dependency graph but does not seem to bring any value, since the status of those following units is consistent with the main one anyway. This should be a fix for [1], and it seems the right thing to do anyway. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1114786 --- src/core/swap.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git src/core/swap.c src/core/swap.c index ef90d0e..b2ca048 100644 --- src/core/swap.c +++ src/core/swap.c @@ -213,7 +213,7 @@ static int swap_add_device_links(Swap *s) { } static int swap_add_default_dependencies(Swap *s) { - bool nofail = false, noauto = false; + bool nofail, noauto; int r; assert(s); @@ -228,23 +228,25 @@ static int swap_add_default_dependencies(Swap *s) { if (r < 0) return r; - if (s->from_fragment) { - SwapParameters *p = &s->parameters_fragment; + if (!s->from_fragment) + /* The swap unit can either be for an alternative device name, in which + * case we don't need to add the dependency on swap.target because this unit + * is following a different unit which will have this dependency added, + * or it can be derived from /proc/swaps, in which case it was started + * manually, and should not become a dependency of swap.target. */ + return 0; - nofail = p->nofail; - noauto = p->noauto; - } + nofail = s->parameters_fragment.nofail; + noauto = s->parameters_fragment.noauto; if (!noauto) { if (nofail) r = unit_add_dependency_by_name_inverse(UNIT(s), UNIT_WANTS, SPECIAL_SWAP_TARGET, NULL, true); else r = unit_add_two_dependencies_by_name_inverse(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SWAP_TARGET, NULL, true); - if (r < 0) - return r; } - return 0; + return r < 0 ? r : 0; } static int swap_verify(Swap *s) { -- 1.7.9.2 ++++++ 0001-core-sysvcompat-network-should-be-equivalent-to-netw.patch ++++++
From 0404c609f399b2092a3de52eef9d75b0dc12e94c Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Mon, 12 May 2014 21:26:54 +0200 Subject: [PATCH] core: sysvcompat - $network should be equivalent to network-online, rather than network target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
Most likely the facility needed is actual connectivity, rather than whether or not the network managment daemon is running. We also need to explicitly pull in the network-online.target, as it is not active by default. This means {systemd-networkd,NetworkManager}-wait-online.service, can be enabled by default as part of network-online.target, and only delay boot when some service actively pulls it in. See: <https://bugzilla.gnome.org/show_bug.cgi?id=728965> Cc: Pavel Šimerda <psimerda@redhat.com> Cc: Michal Sekletar <msekleta@redhat.com> --- TODO | 4 ---- src/core/service.c | 8 ++++++-- 2 files changed, 6 insertions(+), 6 deletions(-) Modified by Andrey Borzenkov <arvidjaar@gmail.com> for openSUSE. Index: systemd-210/src/core/service.c =================================================================== --- systemd-210.orig/src/core/service.c +++ systemd-210/src/core/service.c @@ -404,7 +404,7 @@ static int sysv_translate_facility(const static const char * const table[] = { /* LSB defined facilities */ "local_fs", NULL, - "network", SPECIAL_NETWORK_TARGET, + "network", SPECIAL_NETWORK_ONLINE_TARGET, "named", SPECIAL_NSS_LOOKUP_TARGET, "portmap", SPECIAL_RPCBIND_TARGET, "remote_fs", SPECIAL_REMOTE_FS_TARGET, @@ -881,6 +881,9 @@ static int service_load_sysv_path(Servic if (r == 0) continue; + if (streq(m, SPECIAL_NETWORK_ONLINE_TARGET) && d == UNIT_AFTER && e == _UNIT_DEPENDENCY_INVALID) + e = UNIT_WANTS; + if (e != _UNIT_DEPENDENCY_INVALID) r = unit_add_two_dependencies_by_name(u, d, e, m, NULL, true); else ++++++ 0001-core-use-correct-format-string-for-UIDs.patch ++++++ Based on d6239dc4b0cf55a953d6c40890859b85d504ef19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bartoszkiewicz?= <mbartoszkiewicz@gmail.com> Date: Wed, 25 Jun 2014 14:54:48 +0200 Subject: [PATCH] core: use correct format string for UIDs --- src/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- src/core/main.c +++ src/core/main.c 2014-06-26 09:29:28.182235325 +0000 @@ -1526,7 +1526,7 @@ int main(int argc, char *argv[]) { } else { _cleanup_free_ char *t = uid_to_name(getuid()); - log_debug(PACKAGE_STRING " running in user mode for user "PID_FMT"/%s. (" SYSTEMD_FEATURES ")", + log_debug(PACKAGE_STRING " running in user mode for user "UID_FMT"/%s. (" SYSTEMD_FEATURES ")", getuid(), t); } ++++++ 0001-detect-virt-Fix-Xen-domU-discovery.patch ++++++
From a71516dfd1858f37712ef52a288bf5fb274383e0 Mon Sep 17 00:00:00 2001 From: Thomas Blume <Thomas.Blume@suse.com> Date: Thu, 17 Jul 2014 11:25:37 +0200 Subject: [PATCH] detect-virt: Fix Xen domU discovery
The conditional for detection xen virtualization contained a little mistake. It is checking for i to be empty: 'if (!i) {', but it must check for cap instead, because: 'cap = strsep(&i, ",")' will set cap to the discovered value and i to the next value after the separator. Hence, i would be empty, if there is only control_d in domcap, leading to a wrong domU detection. https://bugs.freedesktop.org/show_bug.cgi?id=77271 --- src/shared/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/shared/virt.c src/shared/virt.c index 774915f..20a8d7c 100644 --- src/shared/virt.c +++ src/shared/virt.c @@ -173,7 +173,7 @@ int detect_vm(const char **id) { if (streq(cap, "control_d")) break; - if (!i) { + if (!cap) { _id = "xen"; r = 1; } -- 1.7.9.2 ++++++ 0001-errno-make-sure-to-handle-the-3-errnos-that-are-alia.patch ++++++ Based on 0d522a7a0547982eae9ab1b5971e4bed9c2fbc7c Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 24 Apr 2014 08:11:39 +0200 Subject: [PATCH] errno: make sure to handle the 3 errnos that are aliases for others properly --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- Makefile.am +++ Makefile.am 2014-05-12 00:00:00.000000000 +0000 @@ -1078,7 +1078,7 @@ BUILT_SOURCES += \ src/shared/errno-list.txt: $(AM_V_at)$(MKDIR_P) $(dir $@) - $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - < /dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+[0-9]/ { print $$2; }' > $@ + $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - < /dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' > $@ src/shared/errno-from-name.gperf: src/shared/errno-list.txt $(AM_V_at)$(MKDIR_P) $(dir $@) @@ -1090,7 +1090,7 @@ src/shared/errno-from-name.h: src/shared src/shared/errno-to-name.h: src/shared/errno-list.txt $(AM_V_at)$(MKDIR_P) $(dir $@) - $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' < $< > $@ + $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' < $< > $@ # ------------------------------------------------------------------------------ systemd_SOURCES = \ ++++++ 0001-event-pull-in-sd-event.h-from-event-util.h.patch ++++++
From 138992534878483de28417dfc61c546bba5cb8ad Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 10 Jul 2014 18:25:08 +0200 Subject: [PATCH] event: pull in sd-event.h from event-util.h
--- src/libsystemd/sd-event/event-util.h | 1 + 1 file changed, 1 insertion(+) diff --git src/libsystemd/sd-event/event-util.h src/libsystemd/sd-event/event-util.h index e58020d..e7cad9b 100644 --- src/libsystemd/sd-event/event-util.h +++ src/libsystemd/sd-event/event-util.h @@ -22,6 +22,7 @@ ***/ #include "util.h" +#include "sd-event.h" DEFINE_TRIVIAL_CLEANUP_FUNC(sd_event*, sd_event_unref); DEFINE_TRIVIAL_CLEANUP_FUNC(sd_event_source*, sd_event_source_unref); -- 1.7.9.2 ++++++ 0001-gpt-auto-generator-don-t-return-OOM-on-parentless-de.patch ++++++
From 9c4495ca561624c2f0085507dd1288ed5f1247c5 Mon Sep 17 00:00:00 2001 From: Tomasz Torcz <tomek@pipebreaker.pl> Date: Wed, 12 Mar 2014 19:25:11 +0100 Subject: [PATCH] gpt-auto-generator: don't return OOM on parentless devices
--- src/gpt-auto-generator/gpt-auto-generator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- src/gpt-auto-generator/gpt-auto-generator.c +++ src/gpt-auto-generator/gpt-auto-generator.c 2014-03-18 13:35:11.438235125 +0000 @@ -254,7 +254,7 @@ static int enumerate_partitions(struct u parent = udev_device_get_parent(d); if (!parent) - return log_oom(); + return 0; r = udev_enumerate_add_match_parent(e, parent); if (r < 0) ++++++ 0001-hwdb-Update-database-of-Bluetooth-company-identifier.patch ++++++
From e525326bd07ebf3cabcfd730bc479166723f2d44 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann <marcel@holtmann.org> Date: Sun, 2 Mar 2014 10:02:10 -0800 Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
--- hwdb/20-bluetooth-vendor-product.hwdb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git hwdb/20-bluetooth-vendor-product.hwdb hwdb/20-bluetooth-vendor-product.hwdb index db3bc24..0335a71 100644 --- hwdb/20-bluetooth-vendor-product.hwdb +++ hwdb/20-bluetooth-vendor-product.hwdb @@ -902,3 +902,12 @@ bluetooth:v0129* bluetooth:v012A* ID_VENDOR_FROM_DATABASE=Changzhou Yongse Infotech Co., Ltd + +bluetooth:v012B* + ID_VENDOR_FROM_DATABASE=SportIQ + +bluetooth:v012C* + ID_VENDOR_FROM_DATABASE=TEMEC Instruments B.V. + +bluetooth:v012D* + ID_VENDOR_FROM_DATABASE=Sony Corporation -- 1.7.9.2 ++++++ 0001-hwdb-fix-case-sensitive-match.patch ++++++
From 4c02dd7153f970244950b5e00f7bdfea8d2ff0be Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Wed, 4 Jun 2014 17:55:14 +0200 Subject: [PATCH] hwdb: fix case-sensitive match
--- hwdb/60-keyboard.hwdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index d053766..c7ff4e4 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -870,7 +870,7 @@ keyboard:dmi:bvn*:bvr*:bd*:svnOQO*Inc.*:pnOQO*Model*2*:pvr* ########################################################### # Plantronics .Audio 626 DSP -keyboard:usb:v047fpC006* +keyboard:usb:v047FpC006* KEYBOARD_KEY_b002f=f20 # Microphone mute button; should be micmute ########################################################### -- 1.7.9.2 ++++++ 0001-hwdb-keymaps-for-Samsung-900X3E-900X3F.patch ++++++
From 77e8ff6974ffaa6c9954e3d2264d9aa75ef25233 Mon Sep 17 00:00:00 2001 From: Kieran Clancy <clancy.kieran@gmail.com> Date: Thu, 27 Feb 2014 16:02:57 +1030 Subject: [PATCH] hwdb: keymaps for Samsung 900X3E/900X3F
Keymaps for Samsung 900X3E and 900X3F should be the same as for other models in the series. I have also moved the comment for '# Series 9' to the right place --- hwdb/60-keyboard.hwdb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index edfa842..bd8fd10 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -897,9 +897,10 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*550P*:pvr* KEYBOARD_KEY_a8=! # Fn Lock - Function lock on KEYBOARD_KEY_a9=! # Fn Lock - Function lock off +# Series 7 / 9 keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700Z*:pvr* keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700G*:pvr* -keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*900X[34][CDG]*:pvr* +keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*900X[34][CDEFG]*:pvr* keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*940X3G*:pvr* KEYBOARD_KEY_ce=!prog1 # Fn+F1 launch settings KEYBOARD_KEY_a0=!mute # Fn+F6 mute @@ -909,7 +910,6 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*940X3G*:pvr* KEYBOARD_KEY_96=!kbdillumup # Fn+F10 keyboard backlight up KEYBOARD_KEY_b3=!prog3 # Fn+F11 fan/cooling mode changer -# Series 9 keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*900X[34][AB]*:pvr* KEYBOARD_KEY_ce=! # Fn+F8 keyboard backlight up KEYBOARD_KEY_8d=! # Fn+F7 keyboard backlight down -- 1.7.9.2 ++++++ 0001-hwdb-update.patch ++++++ ++++ 6590 lines (skipped) ++++++ 0001-initrd-parse-etc.service-ignore-return-code-of-daemo.patch ++++++
From f3b8fbb1da6519e14985ea444f8304673d20ad3f Mon Sep 17 00:00:00 2001 From: Harald Hoyer <harald@redhat.com> Date: Wed, 3 Sep 2014 13:28:31 +0200 Subject: [PATCH] initrd-parse-etc.service: ignore return code of daemon-reload
It seems the return code of systemctl daemon-reload can be !=0 in some circumstances, which causes a failure of the unit and breaks booting in the initrd. --- units/initrd-parse-etc.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git units/initrd-parse-etc.service.in units/initrd-parse-etc.service.in index c0b2543..42c059b 100644 --- units/initrd-parse-etc.service.in +++ units/initrd-parse-etc.service.in @@ -16,7 +16,7 @@ ConditionPathExists=/etc/initrd-release [Service] Type=oneshot -ExecStartPre=@rootbindir@/systemctl daemon-reload +ExecStartPre=-@rootbindir@/systemctl daemon-reload # we have to retrigger initrd-fs.target after daemon-reload ExecStart=-@rootbindir@/systemctl --no-block start initrd-fs.target ExecStart=@rootbindir@/systemctl --no-block start initrd-cleanup.service -- 1.7.9.2 ++++++ 0001-journal-Do-not-count-on-the-compiler-initializing-fo.patch ++++++
From e8c108ca9f11a382742f212f5b42a02536b3d40f Mon Sep 17 00:00:00 2001 From: Philippe De Swert <philippedeswert@gmail.com> Date: Wed, 17 Sep 2014 00:27:16 +0300 Subject: [PATCH] journal: Do not count on the compiler initializing found_last to false
There is a very unlikely case where this can happen since gcc usually does the sane thing. But let's make sure found_last is initialized anyway. Fixes: CID#996386 --- src/journal/journal-verify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/journal/journal-verify.c src/journal/journal-verify.c index 6c8ca8c..b4e8f73 100644 --- src/journal/journal-verify.c +++ src/journal/journal-verify.c @@ -804,7 +804,7 @@ int journal_file_verify( usec_t last_usec = 0; int data_fd = -1, entry_fd = -1, entry_array_fd = -1; unsigned i; - bool found_last; + bool found_last = false; #ifdef HAVE_GCRYPT uint64_t last_tag = 0; #endif -- 1.7.9.2 ++++++ 0001-journal-cleanup-up-error-handling-in-update_catalog.patch ++++++
From e3b9d9c8027a7c4c55cf1614e0fe9423fad69e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 11 Apr 2014 08:44:55 -0400 Subject: [PATCH] journal: cleanup up error handling in update_catalog()
- Negative/positive errno mixup caused duplicates not to be detected properly. Now we get a warning about some duplicate entries in our own catalogs... - Errors in update_catalog would be ignored, but they should not be. --- src/journal/catalog.c | 25 +++++++++++++------------ src/journal/test-catalog.c | 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git src/journal/catalog.c src/journal/catalog.c index 3ed0b7e..02dedc4 100644 --- src/journal/catalog.c +++ src/journal/catalog.c @@ -103,7 +103,7 @@ static int finish_item( const char *payload) { ssize_t offset; - CatalogItem *i; + _cleanup_free_ CatalogItem *i = NULL; int r; assert(h); @@ -126,13 +126,14 @@ static int finish_item( i->offset = htole64((uint64_t) offset); r = hashmap_put(h, i, i); - if (r == EEXIST) { + if (r == -EEXIST) { log_warning("Duplicate entry for " SD_ID128_FORMAT_STR ".%s, ignoring.", SD_ID128_FORMAT_VAL(id), language ? language : "C"); - free(i); return 0; - } + } else if (r < 0) + return r; + i = NULL; return 0; } @@ -383,8 +384,8 @@ error: int catalog_update(const char* database, const char* root, const char* const* dirs) { _cleanup_strv_free_ char **files = NULL; char **f; - Hashmap *h; struct strbuf *sb = NULL; + _cleanup_hashmap_free_free_ Hashmap *h = NULL; _cleanup_free_ CatalogItem *items = NULL; CatalogItem *i; Iterator j; @@ -406,13 +407,17 @@ int catalog_update(const char* database, const char* root, const char* const* di } STRV_FOREACH(f, files) { - log_debug("reading file '%s'", *f); - catalog_import_file(h, sb, *f); + log_debug("Reading file '%s'", *f); + r = catalog_import_file(h, sb, *f); + if (r < 0) { + log_error("Failed to import file '%s': %s.", + *f, strerror(-r)); + goto finish; + } } if (hashmap_size(h) <= 0) { log_info("No items in catalog."); - r = 0; goto finish; } else log_debug("Found %u items in catalog.", hashmap_size(h)); @@ -443,11 +448,7 @@ int catalog_update(const char* database, const char* root, const char* const* di log_debug("%s: wrote %u items, with %zu bytes of strings, %ld total size.", database, n, sb->len, r); - r = 0; - finish: - if (h) - hashmap_free_free(h); if (sb) strbuf_cleanup(sb); diff --git src/journal/test-catalog.c src/journal/test-catalog.c index b087a8b..967ab67 100644 --- src/journal/test-catalog.c +++ src/journal/test-catalog.c @@ -157,7 +157,8 @@ int main(int argc, char *argv[]) { setlocale(LC_ALL, "de_DE.UTF-8"); - log_set_max_level(LOG_DEBUG); + log_parse_environment(); + log_open(); test_catalog_file_lang(); -- 1.7.9.2 ++++++ 0001-journal-compress-return-early-in-uncompress_startswi.patch ++++++ Based on 5e592c66bdf76dfc8445b332f7a5088ca504ee90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 4 Jul 2014 19:53:58 -0400 Subject: [PATCH] journal/compress: return early in uncompress_startswith uncompress_startswith would always decode the whole stream, even if it did not start with the given prefix. Reallocation policy was also strange. --- src/journal/compress.c | 91 ++++++++++++++----------------------------------- 1 file changed, 27 insertions(+), 64 deletions(-) Index: src/journal/compress.c =================================================================== --- src/journal/compress.c.orig +++ src/journal/compress.c @@ -25,6 +25,7 @@ #include <lzma.h> #include "macro.h" +#include "util.h" #include "compress.h" bool compress_blob(const void *src, uint64_t src_size, void *dst, uint64_t *dst_size) { @@ -69,10 +70,9 @@ fail: bool uncompress_blob(const void *src, uint64_t src_size, void **dst, uint64_t *dst_alloc_size, uint64_t* dst_size, uint64_t dst_max) { - lzma_stream s = LZMA_STREAM_INIT; + _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT; lzma_ret ret; uint64_t space; - bool b = false; assert(src); assert(src_size > 0); @@ -85,26 +85,18 @@ bool uncompress_blob(const void *src, ui if (ret != LZMA_OK) return false; - if (*dst_alloc_size <= src_size) { - void *p; - - p = realloc(*dst, src_size*2); - if (!p) - return false; - - *dst = p; - *dst_alloc_size = src_size*2; - } + space = MIN(src_size * 2, dst_max ?: (uint64_t) -1); + if (!greedy_realloc(dst, dst_alloc_size, space)) + return false; s.next_in = src; s.avail_in = src_size; s.next_out = *dst; - space = dst_max > 0 ? MIN(*dst_alloc_size, dst_max) : *dst_alloc_size; s.avail_out = space; for (;;) { - void *p; + uint64_t used; ret = lzma_code(&s, LZMA_FINISH); @@ -112,31 +104,25 @@ bool uncompress_blob(const void *src, ui break; if (ret != LZMA_OK) - goto fail; + return false; if (dst_max > 0 && (space - s.avail_out) >= dst_max) break; - p = realloc(*dst, space*2); - if (!p) - goto fail; - - s.next_out = (uint8_t*) p + ((uint8_t*) s.next_out - (uint8_t*) *dst); - s.avail_out += space; + if (dst_max > 0 && space == dst_max) + return false; - space *= 2; + used = space - s.avail_out; + space = MIN(2 * space, dst_max ?: (uint64_t) -1); + if (!greedy_realloc(dst, dst_alloc_size, space)) + return false; - *dst = p; - *dst_alloc_size = space; + s.avail_out = space - used; + s.next_out = *dst + used; } *dst_size = space - s.avail_out; - b = true; - -fail: - lzma_end(&s); - - return b; + return true; } bool uncompress_startswith(const void *src, uint64_t src_size, @@ -144,9 +130,8 @@ bool uncompress_startswith(const void *s const void *prefix, uint64_t prefix_len, uint8_t extra) { - lzma_stream s = LZMA_STREAM_INIT; + _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT; lzma_ret ret; - bool b = false; /* Checks whether the uncompressed blob starts with the * mentioned prefix. The byte extra needs to follow the @@ -163,16 +148,8 @@ bool uncompress_startswith(const void *s if (ret != LZMA_OK) return false; - if (*buffer_size <= prefix_len) { - void *p; - - p = realloc(*buffer, prefix_len*2); - if (!p) - return false; - - *buffer = p; - *buffer_size = prefix_len*2; - } + if (!(greedy_realloc(buffer, buffer_size, prefix_len + 1))) + return false; s.next_in = src; s.avail_in = src_size; @@ -181,36 +158,23 @@ bool uncompress_startswith(const void *s s.avail_out = *buffer_size; for (;;) { - void *p; - ret = lzma_code(&s, LZMA_FINISH); if (ret != LZMA_STREAM_END && ret != LZMA_OK) - goto fail; + return false; - if ((*buffer_size - s.avail_out > prefix_len) && - memcmp(*buffer, prefix, prefix_len) == 0 && - ((const uint8_t*) *buffer)[prefix_len] == extra) - break; + if (*buffer_size - s.avail_out >= prefix_len + 1) + return memcmp(*buffer, prefix, prefix_len) == 0 && + ((const uint8_t*) *buffer)[prefix_len] == extra; if (ret == LZMA_STREAM_END) - goto fail; - - p = realloc(*buffer, *buffer_size*2); - if (!p) - goto fail; + return false; - s.next_out = (uint8_t*) p + ((uint8_t*) s.next_out - (uint8_t*) *buffer); s.avail_out += *buffer_size; - *buffer = p; - *buffer_size *= 2; - } - - b = true; - -fail: - lzma_end(&s); + if (!(greedy_realloc(buffer, buffer_size, *buffer_size * 2))) + return false; - return b; + s.next_out = *buffer + *buffer_size - s.avail_out; + } } ++++++ 0001-journal-fix-export-of-messages-containing-newlines.patch ++++++
From 0ade5ffe2778e7b238bba8d979ca4d53dee1e702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Mon, 31 Mar 2014 08:57:28 -0400 Subject: [PATCH] journal: fix export of messages containing newlines
In "export" format, newlines are significant, and messages containing newlines must be exported as "binary". --- src/shared/logs-show.c | 7 ++++--- src/shared/utf8.c | 5 +++-- src/shared/utf8.h | 5 ++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git src/shared/logs-show.c src/shared/logs-show.c index 9d14933..b0b66f6 100644 --- src/shared/logs-show.c +++ src/shared/logs-show.c @@ -547,7 +547,9 @@ static int output_export( startswith(data, "_BOOT_ID=")) continue; - if (!utf8_is_printable(data, length)) { + if (utf8_is_printable_newline(data, length, false)) + fwrite(data, length, 1, f); + else { const char *c; uint64_t le64; @@ -562,8 +564,7 @@ static int output_export( le64 = htole64(length - (c - (const char*) data) - 1); fwrite(&le64, sizeof(le64), 1, f); fwrite(c + 1, length - (c - (const char*) data) - 1, 1, f); - } else - fwrite(data, length, 1, f); + } fputc('\n', f); } diff --git src/shared/utf8.c src/shared/utf8.c index 0b524d8..c559c13 100644 --- src/shared/utf8.c +++ src/shared/utf8.c @@ -136,7 +136,7 @@ int utf8_encoded_to_unichar(const char *str) { return unichar; } -bool utf8_is_printable(const char* str, size_t length) { +bool utf8_is_printable_newline(const char* str, size_t length, bool newline) { const uint8_t *p; assert(str); @@ -145,7 +145,8 @@ bool utf8_is_printable(const char* str, size_t length) { int encoded_len = utf8_encoded_valid_unichar((const char *)p); int val = utf8_encoded_to_unichar((const char*)p); - if (encoded_len < 0 || val < 0 || is_unicode_control(val)) + if (encoded_len < 0 || val < 0 || is_unicode_control(val) || + (!newline && val == '\n')) return false; length -= encoded_len; diff --git src/shared/utf8.h src/shared/utf8.h index c0eb73a..c087995 100644 --- src/shared/utf8.h +++ src/shared/utf8.h @@ -31,7 +31,10 @@ const char *utf8_is_valid(const char *s) _pure_; char *ascii_is_valid(const char *s) _pure_; char *utf8_escape_invalid(const char *s); -bool utf8_is_printable(const char* str, size_t length) _pure_; +bool utf8_is_printable_newline(const char* str, size_t length, bool newline) _pure_; +_pure_ static inline bool utf8_is_printable(const char* str, size_t length) { + return utf8_is_printable_newline(str, length, true); +} char *utf16_to_utf8(const void *s, size_t length); -- 1.7.9.2 ++++++ 0001-journalctl-do-not-output-reboot-markers-when-running.patch ++++++
From 4bed248505da4da94d82078fe60326a374970e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 26 Sep 2014 10:49:55 -0400 Subject: [PATCH] journalctl: do not output --reboot-- markers when running non-interactively
They are not legal in the export format. --- src/journal/journalctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/journal/journalctl.c src/journal/journalctl.c index 47206d3..89a922c 100644 --- src/journal/journalctl.c +++ src/journal/journalctl.c @@ -1939,7 +1939,7 @@ int main(int argc, char *argv[]) { goto finish; } - if (!arg_merge) { + if (!arg_merge && !arg_quiet) { sd_id128_t boot_id; r = sd_journal_get_monotonic_usec(j, NULL, &boot_id); -- 1.7.9.2 ++++++ 0001-keymap-Add-Lenovo-Enhanced-USB-Keyboard.patch ++++++
From d258d4967eb24122c2b1014d4e873f61b633f1d2 Mon Sep 17 00:00:00 2001 From: Martin Pitt <martin.pitt@ubuntu.com> Date: Sun, 25 May 2014 11:57:22 +0200 Subject: [PATCH] keymap: Add Lenovo Enhanced USB Keyboard
https://bugs.freedesktop.org/show_bug.cgi?id=77234 --- hwdb/60-keyboard.hwdb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index 832c686..fe5b3ee 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -579,6 +579,18 @@ keyboard:dmi:bvn*:bvr*:svnLENOVO*:pn*IdeaPad*Z370*:pvr* keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*Lenovo*V480*:pvr* KEYBOARD_KEY_f1=f21 +# enhanced USB keyboard +keyboard:usb:v04B3p301B* + KEYBOARD_KEY_90001=prog1 # ThinkVantage + KEYBOARD_KEY_90002=screenlock + KEYBOARD_KEY_90003=file + KEYBOARD_KEY_90004=wordprocessor + KEYBOARD_KEY_90005=spreadsheet + KEYBOARD_KEY_90006=calc + KEYBOARD_KEY_90007=mail + KEYBOARD_KEY_90008=www + + ########################################################### # Logitech ########################################################### -- 1.7.9.2 ++++++ 0001-keymap-Add-support-for-IBM-ThinkPad-X41-Tablet.patch ++++++
From 71ed2d38711e345f22e2200bc7bb156aed98972a Mon Sep 17 00:00:00 2001 From: Bastien Nocera <hadess@hadess.net> Date: Wed, 12 Nov 2014 23:30:46 +0100 Subject: [PATCH] keymap: Add support for IBM ThinkPad X41 Tablet
Scancode taken from: http://www.thinkwiki.org/wiki/Tablet_Hardware_Buttons#Linux_Support William Jon McCann provided the DMI match. IBM seems to have swapped the version and model of the system: Manufacturer: IBM Product Name: 18666TU Version: ThinkPad X41 Tablet --- hwdb/60-keyboard.hwdb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index d2ca965..56a4009 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -594,6 +594,13 @@ keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pnThinkPad*X6*:pvr* KEYBOARD_KEY_6f=down # down on d-pad KEYBOARD_KEY_69=enter # enter on d-pad +# ThinkPad X41 Tablet +keyboard:dmi:bvn*:bvr*:bd*:svnIBM*:pn18666TU:pvr* + KEYBOARD_KEY_6c=direction # rotate + KEYBOARD_KEY_68=f13 # toolbox + KEYBOARD_KEY_6b=esc # escape + KEYBOARD_KEY_69=enter # enter on d-pad + # IdeaPad keyboard:name:Ideapad extra buttons:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn* KEYBOARD_KEY_42=f23 -- 1.7.9.2 ++++++ 0001-keymap-Fix-touchpad-toggle-on-Toshiba-Satellite-P75-.patch ++++++
From a046659f8551e1c8f79ba4b66472444e285255df Mon Sep 17 00:00:00 2001 From: Martin Pitt <martin.pitt@ubuntu.com> Date: Tue, 7 Oct 2014 11:20:04 +0200 Subject: [PATCH] keymap: Fix touchpad toggle on Toshiba Satellite P75-A7200
Just like everywhere else we use KEY_F21 instead of KEY_TOUCHPAD_TOGGLE for X friendliness. --- hwdb/60-keyboard.hwdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index 8a1baa7..1fea32a 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -1094,7 +1094,7 @@ keyboard:name:Toshiba*input*device:dmi:bvn*:bvr*:bd*:svnTOSHIBA*:pnSatellite*P75 KEYBOARD_KEY_13c=brightnessdown KEYBOARD_KEY_13d=brightnessup KEYBOARD_KEY_13e=switchvideomode - KEYBOARD_KEY_13f=touchpad_toggle + KEYBOARD_KEY_13f=f21 # Touchpad toggle KEYBOARD_KEY_9e=wlan ########################################################### -- 1.7.9.2 ++++++ 0001-let-systemctl-completion-ignore-at-names.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:00.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:00.000000000 +0100 @@ -1,5 +1,5 @@ ---- systemd-210/shell-completion/bash/systemctl.in -+++ systemd-210/shell-completion/bash/systemctl.in 2014-08-20 15:01:04.502736981 +0000 +--- systemd-210/shell-completion/bash/systemctl ++++ systemd-210/shell-completion/bash/systemctl 2014-08-20 15:01:04.502736981 +0000 @@ -43,7 +43,7 @@ __filter_units_by_property () { local units=("$@") local props ++++++ 0001-login-fix-memory-leak-on-DropController.patch ++++++
From 60240797a4ce464ec7a0537ccbec4c83f599251c Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Fri, 22 Aug 2014 14:57:11 +0200 Subject: [PATCH] login: fix memory-leak on DropController()
Our bus-name watch helpers only remove a bus-name if it's not a controller, anymore. If we call manager_drop_busname() before unregistering the controller, the busname will not be dropped. Therefore, first drop the controller, then drop the bus-name. --- src/login/logind-session.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git src/login/logind-session.c src/login/logind-session.c index 136bbce..0c6e425 100644 --- src/login/logind-session.c +++ src/login/logind-session.c @@ -1061,11 +1061,13 @@ bool session_is_controller(Session *s, const char *sender) { static void session_swap_controller(Session *s, char *name) { SessionDevice *sd; + char *c; if (s->controller) { - manager_drop_busname(s->manager, s->controller); - free(s->controller); + c = s->controller; s->controller = NULL; + manager_drop_busname(s->manager, c); + free(c); /* Drop all devices as they're now unused. Do that after the * controller is released to avoid sending out useles -- 1.7.9.2 ++++++ 0001-login-fix-pos-array-allocation.patch ++++++
From a1937e679f76758635d295287398abe526de2522 Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Tue, 25 Feb 2014 12:20:25 +0100 Subject: [PATCH] login: fix pos-array allocation
GREEDY_REALLOC takes a pointer to the real size, not the array-width as argument. Therefore, our array is currently way to small to keep the seat positions. Introduce GREEDY_REALLOC0_T() as typed version of GREEDY_REALLOC and store the array-width instead of array-size. --- src/login/logind-seat.c | 2 +- src/shared/util.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git src/login/logind-seat.c src/login/logind-seat.c index 631be5f..36ec7ed 100644 --- src/login/logind-seat.c +++ src/login/logind-seat.c @@ -475,7 +475,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) { if (seat_has_vts(s)) pos = session->vtnr; - if (!GREEDY_REALLOC0(s->positions, s->position_count, pos + 1)) + if (!GREEDY_REALLOC0_T(s->positions, s->position_count, pos + 1)) return; seat_evict_position(s, session); diff --git src/shared/util.h src/shared/util.h index 9913fce..78b1444 100644 --- src/shared/util.h +++ src/shared/util.h @@ -723,6 +723,15 @@ void* greedy_realloc0(void **p, size_t *allocated, size_t need); #define GREEDY_REALLOC0(array, allocated, need) \ greedy_realloc0((void**) &(array), &(allocated), sizeof((array)[0]) * (need)) +#define GREEDY_REALLOC0_T(array, count, need) \ + ({ \ + size_t _size = (count) * sizeof((array)[0]); \ + void *_ptr = GREEDY_REALLOC0((array), _size, (need)); \ + if (_ptr) \ + (count) = _size / sizeof((array)[0]); \ + _ptr; \ + }) + static inline void _reset_errno_(int *saved_errno) { errno = *saved_errno; } -- 1.7.9.2 ++++++ 0001-login-pause-devices-before-acknowledging-VT-switches.patch ++++++ Based on 2ec3ff668ff03410e94cfef8e3ee9384a8222211 Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Fri, 19 Sep 2014 13:26:39 +0200 Subject: [PATCH] login: pause devices before acknowledging VT switches If a session controller does not need synchronous VT switches, we allow them to pass VT control to logind, which acknowledges all VT switches unconditionally. This works fine with all sessions using the dbus API, but causes out-of-sync device use if we switch to legacy sessions that are notified via VT signals. Those are processed before logind notices the session-switch via sysfs. Therefore, leaving the old session still active for a short amount of time. This, in fact, may cause the legacy session to prepare graphics devices before the old session was deactivated, and thus, maybe causing the old session to interfer with graphics device usage. Fix this by releasing devices immediately before acknowledging VT switches. This way, sessions without VT handlers are required to support async session switching (which they do in that case, anyway). --- src/login/logind-session.c | 21 +++++++++++++++++++++ src/login/logind-session.h | 1 + src/login/logind.c | 4 ++-- 3 files changed, 24 insertions(+), 2 deletions(-) --- src/login/logind-session.c +++ src/login/logind-session.c 2014-09-24 07:40:45.786639180 +0000 @@ -1040,6 +1040,27 @@ void session_restore_vt(Session *s) { s->vtfd = -1; } +void session_leave_vt(Session *s) { + assert(s); + + /* This is called whenever we get a VT-switch signal from the kernel. + * We acknowledge all of them unconditionally. Note that session are + * free to overwrite those handlers and we only register them for + * sessions with controllers. Legacy sessions are not affected. + * However, if we switch from a non-legacy to a legacy session, we must + * make sure to pause all device before acknowledging the switch. We + * process the real switch only after we are notified via sysfs, so the + * legacy session might have already started using the devices. If we + * don't pause the devices before the switch, we might confuse the + * session we switch to. */ + + if (s->vtfd < 0) + return; + + session_device_pause_all(s); + ioctl(s->vtfd, VT_RELDISP, 1); +} + bool session_is_controller(Session *s, const char *sender) { assert(s); --- src/login/logind-session.h +++ src/login/logind-session.h 2014-09-24 07:41:50.290236363 +0000 @@ -173,6 +173,7 @@ KillWho kill_who_from_string(const char int session_mute_vt(Session *s); void session_restore_vt(Session *s); +void session_leave_vt(Session *s); bool session_is_controller(Session *s, const char *sender); int session_set_controller(Session *s, const char *sender, bool force); --- src/login/logind.c +++ src/login/logind.c 2014-09-24 00:00:00.000000000 +0000 @@ -743,11 +743,11 @@ static int manager_vt_switch(sd_event_so } if (active->vtfd >= 0) { - ioctl(active->vtfd, VT_RELDISP, 1); + session_leave_vt(active); } else { LIST_FOREACH(sessions_by_seat, iter, m->seat0->sessions) { if (iter->vtnr == active->vtnr && iter->vtfd >= 0) { - ioctl(iter->vtfd, VT_RELDISP, 1); + session_leave_vt(iter); break; } } ++++++ 0001-login-rerun-vconsole-setup-when-switching-from-vgaco.patch ++++++
From f6ba8671d83f9fce9a00045d8fa399a1c07ba7fc Mon Sep 17 00:00:00 2001 From: Ray Strode <rstrode@redhat.com> Date: Wed, 5 Nov 2014 08:30:52 -0500 Subject: [PATCH] login: rerun vconsole-setup when switching from vgacon to fbcon
The initialization performed by systemd-vconsole-setup is reset when changing console drivers (say from vgacon to fbcon), so we need to run it in that case. See http://lists.freedesktop.org/archives/systemd-devel/2014-October/023919.html http://lists.freedesktop.org/archives/systemd-devel/2014-October/024423.html http://lists.freedesktop.org/archives/systemd-devel/2014-November/024881.htm... This commit adds a udev rule to make systemd-vconsole-setup get run when the fbcon device becomes available. (david: moved into new file 90-vconsole.rules instead of 71-seats.rules; build-failures are on me, not on Ray) --- Makefile.am | 3 +++ src/vconsole/90-vconsole.rules | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 src/vconsole/90-vconsole.rules diff --git Makefile.am Makefile.am index 3686103..f614b86 100644 --- Makefile.am +++ Makefile.am @@ -4439,6 +4439,9 @@ rootlibexec_PROGRAMS += \ nodist_systemunit_DATA += \ units/systemd-vconsole-setup.service +dist_udevrules_DATA += \ + src/vconsole/90-vconsole.rules + SYSINIT_TARGET_WANTS += \ systemd-vconsole-setup.service endif diff --git src/vconsole/90-vconsole.rules src/vconsole/90-vconsole.rules new file mode 100644 index 0000000..bf6a9ef --- /dev/null +++ src/vconsole/90-vconsole.rules @@ -0,0 +1,11 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +# Kernel resets vconsole state when changing console drivers so run +# systemd-vconsole-setup when fbcon loads + +ACTION=="add", SUBSYSTEM=="graphics", KERNEL=="fbcon", RUN+="/usr/lib/systemd/systemd-vconsole-setup" -- 1.7.9.2 ++++++ 0001-login-simplify-controller-handling.patch ++++++ Based on b12e56156e5f363ebb8dc4ea5c10f5fd0665dc9d Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Mon, 1 Sep 2014 14:04:44 +0200 Subject: [PATCH] login: simplify controller handling Simplify the way we handler session-controllers and fix several shortcomings: * send ReleaseDevice() signals on forced session takeover * fix mem-leaks for busnames in case VT preparation fails (non-critical) * avoid passing pre-allocated names to helpers --- src/login/logind-session.c | 55 ++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git src/login/logind-session.c src/login/logind-session.c index 58453b5..10a43a4 100644 --- src/login/logind-session.c +++ src/login/logind-session.c @@ -1059,32 +1059,30 @@ bool session_is_controller(Session *s, const char *sender) { return streq_ptr(s->controller, sender); } -static void session_swap_controller(Session *s, char *name) { +static void session_release_controller(Session *s, bool notify) { + _cleanup_free_ char *name = NULL; SessionDevice *sd; - char *c; - if (s->controller) { - c = s->controller; - s->controller = NULL; - manager_drop_busname(s->manager, c); - free(c); + if (!s->controller) + return; - /* Drop all devices as they're now unused. Do that after the - * controller is released to avoid sending out useles - * dbus signals. */ - while ((sd = hashmap_first(s->devices))) - session_device_free(sd); + name = s->controller; - if (!name) - session_restore_vt(s); - } + /* By resetting the controller before releasing the devices, we won't + * send notification signals. This avoids sending useless notifications + * if the controller is released on disconnects. */ + if (!notify) + s->controller = NULL; - s->controller = name; - session_save(s); + while ((sd = hashmap_first(s->devices))) + session_device_free(sd); + + s->controller = NULL; + manager_drop_busname(s->manager, name); } int session_set_controller(Session *s, const char *sender, bool force) { - char *t; + _cleanup_free_ char *name = NULL; int r; assert(s); @@ -1095,15 +1093,13 @@ int session_set_controller(Session *s, const char *sender, bool force) { if (s->controller && !force) return -EBUSY; - t = strdup(sender); - if (!t) + name = strdup(sender); + if (!name) return -ENOMEM; - r = manager_watch_busname(s->manager, sender); - if (r) { - free(t); + r = manager_watch_busname(s->manager, name); + if (r) return r; - } /* When setting a session controller, we forcibly mute the VT and set * it into graphics-mode. Applications can override that by changing @@ -1115,11 +1111,14 @@ int session_set_controller(Session *s, const char *sender, bool force) { * or reset the VT in case it crashed/exited, too. */ r = session_mute_vt(s); if (r < 0) { - free(t); + manager_drop_busname(s->manager, name); return r; } - session_swap_controller(s, t); + session_release_controller(s, true); + s->controller = name; + name = NULL; + session_save(s); return 0; } @@ -1130,7 +1129,9 @@ void session_drop_controller(Session *s) { if (!s->controller) return; - session_swap_controller(s, NULL); + session_release_controller(s, false); + session_save(s); + session_restore_vt(s); } static const char* const session_state_table[_SESSION_STATE_MAX] = { -- 1.7.9.2 ++++++ 0001-logind-add-support-for-Triton2-Power-Button.patch ++++++
From 58d4aabedd415a735efeb8c2608ee73618c07f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Mon, 22 Sep 2014 22:14:39 -0400 Subject: [PATCH] logind: add support for Triton2 Power Button
https://bugs.freedesktop.org/show_bug.cgi?id=84201 --- src/login/70-power-switch.rules | 1 + 1 file changed, 1 insertion(+) diff --git src/login/70-power-switch.rules src/login/70-power-switch.rules index 36fb827..a6997f7 100644 --- src/login/70-power-switch.rules +++ src/login/70-power-switch.rules @@ -9,5 +9,6 @@ ACTION=="remove", GOTO="power_switch_end" SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", TAG+="power-switch" SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", TAG+="power-switch" +SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="twl4030_pwrbutton", TAG+="power-switch" LABEL="power_switch_end" -- 1.7.9.2 ++++++ 0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch ++++++
From 154034270c4643b7cfe61c0be1676d78bb1b7b07 Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Tue, 8 Jul 2014 12:56:55 +0200 Subject: [PATCH] logind: allow switching to unused VTs via SwitchTo()
If compositors use the new SwitchTo() logic to map F1-F12, we should allow them to switch to unregistered VTs, too. Otherwise, the auto-spawn logic of gettys won't trigger. Reported-by: Jasper St. Pierre <jstpierre@mecheye.net> Signed-off-by: David Herrmann <dh.herrmann@gmail.com> --- src/login/logind-seat.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git src/login/logind-seat.c src/login/logind-seat.c index 3114de8..9992195 100644 --- src/login/logind-seat.c +++ src/login/logind-seat.c @@ -275,8 +275,13 @@ int seat_switch_to(Seat *s, unsigned int num) { if (!num) return -EINVAL; - if (num >= s->position_count || !s->positions[num]) + if (num >= s->position_count || !s->positions[num]) { + /* allow switching to unused VTs to trigger auto-activate */ + if (seat_has_vts(s) && num < 64) + return chvt(num); + return -EINVAL; + } return session_activate(s->positions[num]); } -- 1.7.9.2 ++++++ 0001-logind-ignore-lid-switch-if-more-than-1-display-is-c.patch ++++++
From 6a79c58603ea816a1b4fa1520397b4e138bc1ca0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 3 Mar 2014 19:30:16 +0100 Subject: [PATCH] logind: ignore lid switch if more than 1 display is connected
Previously we expected the desktop environment to take an inhibitor lock, but this opened a race on boot-up where logind might already be running but no DE is active. Hence, let's move checking for additional displays into logind. This also opens up this logic for other DEs, given that only GNOME implemented the inhibitor logic so far. --- man/logind.conf.xml | 14 +++++++----- src/login/logind-action.c | 8 +++++++ src/login/logind-core.c | 55 +++++++++++++++++++++++++++++++++++++++++++-- src/login/logind.h | 1 + 4 files changed, 71 insertions(+), 7 deletions(-) diff --git man/logind.conf.xml man/logind.conf.xml index 54cc379..7673201 100644 --- man/logind.conf.xml +++ man/logind.conf.xml @@ -242,10 +242,10 @@ <literal>ignore</literal>, logind will never handle these keys. If <literal>lock</literal>, all running - sessions will be screen-locked; otherwise, - the specified action - will be taken in the respective - event. Only input devices with the + sessions will be screen-locked; + otherwise, the specified action will + be taken in the respective event. Only + input devices with the <literal>power-switch</literal> udev tag will be watched for key/lid switch events. <varname>HandlePowerKey=</varname> @@ -257,7 +257,11 @@ default to <literal>suspend</literal>. <varname>HandleHibernateKey=</varname> defaults to - <literal>hibernate</literal>.</para></listitem> + <literal>hibernate</literal>. Note + that the lid switch is ignored if the + system is inserted in a docking + station, or if more than one display + is connected.</para></listitem> </varlistentry> <varlistentry> diff --git src/login/logind-action.c src/login/logind-action.c index c04f210..da5a830 100644 --- src/login/logind-action.c +++ src/login/logind-action.c @@ -72,10 +72,18 @@ int manager_handle_action( /* If we are docked don't react to lid closing */ if (inhibit_key == INHIBIT_HANDLE_LID_SWITCH) { + int n; + if (manager_is_docked(m)) { log_debug("Ignoring lid switch request, system is docked."); return 0; } + + n = manager_count_displays(m); + if (n != 1) { + log_debug("Ignoring lid switch request, %s displays connected."); + return 0; + } } /* If the key handling is inhibited, don't do anything */ diff --git src/login/logind-core.c src/login/logind-core.c index e4e593f..b8d03c3 100644 --- src/login/logind-core.c +++ src/login/logind-core.c @@ -32,6 +32,7 @@ #include "audit.h" #include "bus-util.h" #include "bus-error.h" +#include "udev-util.h" #include "logind.h" int manager_add_device(Manager *m, const char *sysfs, bool master, Device **_device) { @@ -276,9 +277,11 @@ int manager_process_seat_device(Manager *m, struct udev_device *d) { return 0; } - /* ignore non-master devices for unknown seats */ + seat = hashmap_get(m->seats, sn); master = udev_device_has_tag(d, "master-of-seat"); - if (!master && !(seat = hashmap_get(m->seats, sn))) + + /* Ignore non-master devices for unknown seats */ + if (!master && !seat) return 0; r = manager_add_device(m, udev_device_get_syspath(d), master, &device); @@ -514,3 +517,51 @@ bool manager_is_docked(Manager *m) { return false; } + +int manager_count_displays(Manager *m) { + _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; + struct udev_list_entry *item = NULL, *first = NULL; + int r; + int n = 0; + + e = udev_enumerate_new(m->udev); + if (!e) + return -ENOMEM; + + r = udev_enumerate_add_match_subsystem(e, "drm"); + if (r < 0) + return r; + + r = udev_enumerate_scan_devices(e); + if (r < 0) + return r; + + first = udev_enumerate_get_list_entry(e); + udev_list_entry_foreach(item, first) { + _cleanup_udev_device_unref_ struct udev_device *d = NULL; + struct udev_device *p; + const char *status; + + d = udev_device_new_from_syspath(m->udev, udev_list_entry_get_name(item)); + if (!d) + return -ENOMEM; + + p = udev_device_get_parent(d); + if (!p) + return -ENOMEM; + + /* If the parent shares the same subsystem as the + * device we are looking at then it is a connector, + * which is what we are interested in. */ + if (!streq_ptr(udev_device_get_subsystem(p), "drm")) + continue; + + /* We count any connector which is not explicitly + * "disconnected" as connected. */ + status = udev_device_get_sysattr_value(d, "status"); + if (!streq_ptr(status, "disconnected")) + n++; + } + + return n; +} diff --git src/login/logind.h src/login/logind.h index 0344acc..74d6641 100644 --- src/login/logind.h +++ src/login/logind.h @@ -149,6 +149,7 @@ int manager_get_user_by_pid(Manager *m, pid_t pid, User **user); int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session); bool manager_is_docked(Manager *m); +int manager_count_displays(Manager *m); extern const sd_bus_vtable manager_vtable[]; -- 1.7.9.2 ++++++ 0001-machine-don-t-return-uninitialized-variable.patch ++++++
From f14aa1f1b2e4e99ee20393871b5f64f1378ed6c3 Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Sun, 6 Jul 2014 14:12:28 +0200 Subject: [PATCH] machine: don't return uninitialized variable
Repotred by Ronny Chevalier --- src/machine/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/machine/machine.c src/machine/machine.c index c0fa1b2..cf38e3f 100644 --- src/machine/machine.c +++ src/machine/machine.c @@ -371,7 +371,7 @@ static int machine_stop_scope(Machine *m) { free(m->scope_job); m->scope_job = job; - return r; + return 0; } int machine_stop(Machine *m) { -- 1.7.9.2 ++++++ 0001-main-uid_to_name-might-fail-due-to-OOM-protect-again.patch ++++++ Based on 1f97091d3cb0887c264176b47b0a86c269acf0b5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 27 Jun 2014 18:34:37 +0200 Subject: [PATCH] main: uid_to_name() might fail due to OOM, protect against that --- src/core/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- src/core/main.c +++ src/core/main.c 2014-07-01 12:25:17.906235000 +0000 @@ -1525,9 +1525,10 @@ int main(int argc, char *argv[]) { log_info("Running in initial RAM disk."); } else { - _cleanup_free_ char *t = uid_to_name(getuid()); - log_debug(PACKAGE_STRING " running in user mode for user "UID_FMT"/%s. (" SYSTEMD_FEATURES ")", - getuid(), t); + _cleanup_free_ char *t; + + t = uid_to_name(getuid()); + log_debug(PACKAGE_STRING " running in user mode for user "UID_FMT"/%s. (" SYSTEMD_FEATURES ")", getuid(), strna(t)); } if (arg_running_as == SYSTEMD_SYSTEM && !skip_setup) { ++++++ 0001-make-209-working-on-older-dist.patch ++++++ --- systemd-209/units/kmod-static-nodes.service.in +++ systemd-209/units/kmod-static-nodes.service.in 2014-02-27 15:04:30.378236539 +0000 @@ -15,4 +15,5 @@ ConditionPathExists=/lib/modules/%v/modu [Service] Type=oneshot RemainAfterExit=yes +ExecStartPre=@MKDIR_P@ /run/tmpfiles.d ExecStart=@KMOD@ static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf --- systemd-209/configure.ac +++ systemd-209/configure.ac 2014-02-28 17:14:14.866235643 +0000 @@ -300,9 +300,9 @@ AC_ARG_ENABLE(kmod, AS_HELP_STRING([--di if test "x$enable_kmod" != "xno"; then PKG_CHECK_EXISTS([ libkmod ], have_kmod=yes, have_kmod=no) if test "x$have_kmod" = "xyes"; then - PKG_CHECK_MODULES(KMOD, [ libkmod >= 15 ], + PKG_CHECK_MODULES(KMOD, [ libkmod >= 14 ], [AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])], - AC_MSG_ERROR([*** kmod version >= 15 not found])) + AC_MSG_ERROR([*** kmod version >= 14 not found])) fi if test "x$have_kmod" = xno -a "x$enable_kmod" = xyes; then AC_MSG_ERROR([*** kmod support requested, but libraries not found]) --- systemd-209/configure +++ systemd-209/configure 2014-02-28 17:13:50.770735397 +0000 @@ -15999,12 +15999,12 @@ if test -n "$KMOD_CFLAGS"; then pkg_cv_KMOD_CFLAGS="$KMOD_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 15 \""; } >&5 - ($PKG_CONFIG --exists --print-errors " libkmod >= 15 ") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 14 \""; } >&5 + ($PKG_CONFIG --exists --print-errors " libkmod >= 14 ") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_KMOD_CFLAGS=`$PKG_CONFIG --cflags " libkmod >= 15 " 2>/dev/null` + pkg_cv_KMOD_CFLAGS=`$PKG_CONFIG --cflags " libkmod >= 14 " 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -16016,12 +16016,12 @@ if test -n "$KMOD_LIBS"; then pkg_cv_KMOD_LIBS="$KMOD_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 15 \""; } >&5 - ($PKG_CONFIG --exists --print-errors " libkmod >= 15 ") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 14 \""; } >&5 + ($PKG_CONFIG --exists --print-errors " libkmod >= 14 ") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_KMOD_LIBS=`$PKG_CONFIG --libs " libkmod >= 15 " 2>/dev/null` + pkg_cv_KMOD_LIBS=`$PKG_CONFIG --libs " libkmod >= 14 " 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -16042,18 +16042,18 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - KMOD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " libkmod >= 15 " 2>&1` + KMOD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " libkmod >= 14 " 2>&1` else - KMOD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " libkmod >= 15 " 2>&1` + KMOD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " libkmod >= 14 " 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$KMOD_PKG_ERRORS" >&5 - as_fn_error $? "*** kmod version >= 15 not found" "$LINENO" 5 + as_fn_error $? "*** kmod version >= 14 not found" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? "*** kmod version >= 15 not found" "$LINENO" 5 + as_fn_error $? "*** kmod version >= 14 not found" "$LINENO" 5 else KMOD_CFLAGS=$pkg_cv_KMOD_CFLAGS KMOD_LIBS=$pkg_cv_KMOD_LIBS ++++++ 0001-make-fortify-happy-with-ppoll.patch ++++++ --- systemd-209/src/libsystemd/sd-bus/sd-bus.c +++ systemd-209/src/libsystemd/sd-bus/sd-bus.c 2014-02-28 11:08:21.354235373 +0000 @@ -2548,7 +2548,7 @@ static int bus_poll(sd_bus *bus, bool ne n = 2; } - r = ppoll(p, n, m == (uint64_t) -1 ? NULL : timespec_store(&ts, m), NULL); + r = __ppoll_alias(p, n, m == (uint64_t) -1 ? NULL : timespec_store(&ts, m), NULL); if (r < 0) return -errno; --- systemd-209/src/core/hostname-setup.c +++ systemd-209/src/core/hostname-setup.c 2014-02-28 11:14:51.594832792 +0000 @@ -50,8 +50,8 @@ static int read_and_strip_hostname(const } /* strip any leftover of a domain name */ - if (domain = strchr(s, '.')) { - *domain = NULL; + if ((domain = strchr(s, '.'))) { + *domain = '\0'; } *hn = s; --- systemd-209/src/tty-ask-password-agent/tty-ask-password-agent.c +++ systemd-209/src/tty-ask-password-agent/tty-ask-password-agent.c 2014-02-28 11:41:42.254735820 +0000 @@ -142,7 +142,7 @@ static int ask_password_plymouth( goto finish; } - if ((j = poll(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) { + if ((j = __poll_alias(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) { if (errno == EINTR) continue; @@ -595,7 +595,7 @@ static int watch_passwords(void) { if ((r = show_passwords()) < 0) log_error("Failed to show password: %s", strerror(-r)); - if (poll(pollfd, _FD_MAX, -1) < 0) { + if (__poll_alias(pollfd, _FD_MAX, -1) < 0) { if (errno == EINTR) continue; --- systemd-209/src/shared/ask-password-api.c +++ systemd-209/src/shared/ask-password-api.c 2014-02-28 11:47:21.754234675 +0000 @@ -138,7 +138,7 @@ int ask_password_tty( goto finish; } - if ((k = poll(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) { + if ((k = __poll_alias(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) { if (errno == EINTR) continue; ++++++ 0001-manager-Linux-on-hppa-has-fewer-rtsigs-hence-avoid-u.patch ++++++ Based on 4dffec1459f50ac9f8f67ccfcb79836b4ed5a50e Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 24 Oct 2014 13:44:45 +0200 Subject: [PATCH] manager: Linux on hppa has fewer rtsigs, hence avoid using the higher ones there https://bugs.freedesktop.org/show_bug.cgi?id=84931 --- src/core/manager.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) --- src/core/manager.c +++ src/core/manager.c 2014-10-29 14:02:28.635837997 +0000 @@ -340,11 +340,14 @@ static int manager_setup_signals(Manager assert(m); - /* We are not interested in SIGSTOP and friends. */ assert_se(sigaction(SIGCHLD, &sa, NULL) == 0); - assert_se(sigemptyset(&mask) == 0); + /* We make liberal use of realtime signals here. On + * Linux/glibc we have 30 of them (with the exception of Linux + * on hppa, see below), between SIGRTMIN+0 ... SIGRTMIN+30 + * (aka SIGRTMAX). */ + assert_se(sigemptyset(&mask) == 0); sigset_add_many(&mask, SIGCHLD, /* Child died */ SIGTERM, /* Reexecute daemon */ @@ -354,6 +357,7 @@ static int manager_setup_signals(Manager SIGINT, /* Kernel sends us this on control-alt-del */ SIGWINCH, /* Kernel sends us this on kbrequest (alt-arrowup) */ SIGPWR, /* Some kernel drivers and upsd send us this on power failure */ + SIGRTMIN+0, /* systemd: start default.target */ SIGRTMIN+1, /* systemd: isolate rescue.target */ SIGRTMIN+2, /* systemd: isolate emergency.target */ @@ -361,19 +365,40 @@ static int manager_setup_signals(Manager SIGRTMIN+4, /* systemd: start poweroff.target */ SIGRTMIN+5, /* systemd: start reboot.target */ SIGRTMIN+6, /* systemd: start kexec.target */ + + /* ... space for more special targets ... */ + SIGRTMIN+13, /* systemd: Immediate halt */ SIGRTMIN+14, /* systemd: Immediate poweroff */ SIGRTMIN+15, /* systemd: Immediate reboot */ SIGRTMIN+16, /* systemd: Immediate kexec */ + + /* ... space for more immediate system state changes ... */ + SIGRTMIN+20, /* systemd: enable status messages */ SIGRTMIN+21, /* systemd: disable status messages */ SIGRTMIN+22, /* systemd: set log level to LOG_DEBUG */ SIGRTMIN+23, /* systemd: set log level to LOG_INFO */ SIGRTMIN+24, /* systemd: Immediate exit (--user only) */ + + /* .. one free signal here ... */ + +#if !defined(__hppa64__) && !defined(__hppa__) + /* Apparently Linux on hppa has fewer RT + * signals (SIGRTMAX is SIGRTMIN+25 there), + * hence let's not try to make use of them + * here. Since these commands are accessible + * by different means and only really a safety + * net, the missing functionality on hppa + * shouldn't matter. */ + SIGRTMIN+26, /* systemd: set log target to journal-or-kmsg */ SIGRTMIN+27, /* systemd: set log target to console */ SIGRTMIN+28, /* systemd: set log target to kmsg */ SIGRTMIN+29, /* systemd: set log target to syslog-or-kmsg */ + + /* ... one free signal here SIGRTMIN+30 ... */ +#endif -1); assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); ++++++ 0001-nspawn-allow-to-bind-mount-journal-on-top-of-a-non-e.patch ++++++
From e6a4a517befe559adf6d1dbbadf425c3538849c9 Mon Sep 17 00:00:00 2001 From: Djalal Harouni <tixxdz@opendz.org> Date: Fri, 11 Apr 2014 01:45:52 +0100 Subject: [PATCH] nspawn: allow to bind mount journal on top of a non empty container journal dentry
Currently if nspawn was called with --link-journal=host or --link-journal=auto and the right /var/log/journal/machine-id/ exists then the bind mount the subdirectory into the container might fail due to the ~/mycontainer/var/log/journal/machine-id/ of the container not being empty. There is no reason to check if the container journal subdir is empty since there will be a bind mount on top of it. The user asked for a bind mount so give it. Note: a next call with --link-journal=guest may fail due to the /var/log/journal/machine-id/ on the host not being empty. https://bugs.freedesktop.org/show_bug.cgi?id=76193 Reported-by: Tobias Hunger <tobias.hunger@gmail.com> --- src/nspawn/nspawn.c | 5 ----- 1 file changed, 5 deletions(-) diff --git src/nspawn/nspawn.c src/nspawn/nspawn.c index 9d9238f..ef84664 100644 --- src/nspawn/nspawn.c +++ src/nspawn/nspawn.c @@ -1143,11 +1143,6 @@ static int setup_journal(const char *directory) { } else if (access(p, F_OK) < 0) return 0; - if (dir_is_empty(q) == 0) { - log_error("%s not empty.", q); - return -ENOTEMPTY; - } - r = mkdir_p(q, 0755); if (r < 0) { log_error("Failed to create %s: %m", q); -- 1.7.9.2 ++++++ 0001-nspawn-don-t-try-to-create-veth-link-with-too-long-i.patch ++++++ Based on c00524c9cc7fb498c7244350e25823b8352f078c Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Fri, 19 Sep 2014 23:02:00 +0200 Subject: [PATCH] nspawn: don't try to create veth link with too long ifname Reported by: James Lott <james@lottspot.com> --- src/nspawn/nspawn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- src/nspawn/nspawn.c +++ src/nspawn/nspawn.c 2014-09-23 15:33:06.766236272 +0000 @@ -1383,7 +1383,7 @@ static int setup_veth(pid_t pid, char if /* Use two different interface name prefixes depending whether * we are in bridge mode or not. */ - snprintf(iface_name, IFNAMSIZ, "%s-%s", + snprintf(iface_name, IFNAMSIZ - 1, "%s-%s", arg_network_bridge ? "vb" : "ve", arg_machine); r = sd_rtnl_open(&rtnl, 0); ++++++ 0001-nspawn-fix-network-interface.patch ++++++ Based on 3125b3ef5db70d45882c7d6f617705802c5f939e Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 28 Aug 2014 12:15:51 +0200 Subject: [PATCH] nspawn: fix --network-interface Use SETLINK when modifying an existing link. --- src/nspawn/nspawn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- src/nspawn/nspawn.c +++ src/nspawn/nspawn.c 2014-08-29 14:11:25.866235309 +0000 @@ -1568,7 +1568,7 @@ static int move_network_interfaces(pid_t return -EBUSY; } - r = sd_rtnl_message_new_link(rtnl, &m, RTM_NEWLINK, ifi); + r = sd_rtnl_message_new_link(rtnl, &m, RTM_SETLINK, ifi); if (r < 0) { log_error("Failed to allocate netlink message: %s", strerror(-r)); return r; ++++++ 0001-nspawn-fix-truncation-of-machine-names-in-interface-.patch ++++++ Based on 4212a3375e03fd12cb407b34cab59dbe4ed9f4eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sun, 3 Aug 2014 01:28:21 -0400 Subject: [PATCH] nspawn: fix truncation of machine names in interface names Based on patch by Michael Marineau <michael.marineau@coreos.com>: When deriving the network interface name from machine name strncpy was not properly null terminating the string and the maximum string size as returned by strlen() is actually IFNAMSIZ-1, not IFNAMSIZ. --- src/nspawn/nspawn.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- src/nspawn/nspawn.c +++ src/nspawn/nspawn.c 2014-08-22 10:18:20.390235611 +0000 @@ -1383,12 +1383,8 @@ static int setup_veth(pid_t pid, char if /* Use two different interface name prefixes depending whether * we are in bridge mode or not. */ - if (arg_network_bridge) - memcpy(iface_name, "vb-", 3); - else - memcpy(iface_name, "ve-", 3); - - strncpy(iface_name+3, arg_machine, IFNAMSIZ - 3); + snprintf(iface_name, IFNAMSIZ, "%s-%s", + arg_network_bridge ? "vb" : "ve", arg_machine); r = sd_rtnl_open(&rtnl, 0); if (r < 0) { ++++++ 0001-pam_systemd_do_override_XDG_RUNTIME_DIR_of_the_original_user.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:00.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:00.000000000 +0100 @@ -8,11 +8,11 @@ This belongs to BNC#852015 and also to BNC#855160 --- - pam_systemd.c | 19 +++++++++++++++++++ + pam-module.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) ---- systemd-209/src/login/pam_systemd.c -+++ systemd-209/src/login/pam_systemd.c 2014-02-26 14:31:30.158235525 +0000 +--- systemd-209/src/login/pam-module.c ++++ systemd-209/src/login/pam-module.c 2014-02-26 14:31:30.158235525 +0000 @@ -447,6 +447,25 @@ _public_ PAM_EXTERN int pam_sm_open_sess r = export_legacy_dbus_address(handle, pw->pw_uid, runtime_path); if (r != PAM_SUCCESS) ++++++ 0001-parse_uid-return-ENXIO-for-1-uids.patch ++++++
From f841a154efbb3162d2a732936f031ac7a6b0d4cf Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Tue, 1 Jul 2014 16:00:05 +0200 Subject: [PATCH] parse_uid: return -ENXIO for -1 uids
--- src/shared/audit.c | 3 --- src/shared/util.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git src/shared/audit.c src/shared/audit.c index 5466447..f101050 100644 --- src/shared/audit.c +++ src/shared/audit.c @@ -77,9 +77,6 @@ int audit_loginuid_from_pid(pid_t pid, uid_t *uid) { if (r < 0) return r; - if (u == (uid_t) -1) - return -ENXIO; - *uid = (uid_t) u; return 0; } diff --git src/shared/util.c src/shared/util.c index e75f6c9..9b5a47a 100644 --- src/shared/util.c +++ src/shared/util.c @@ -282,11 +282,11 @@ int parse_uid(const char *s, uid_t* ret_uid) { /* Some libc APIs use (uid_t) -1 as special placeholder */ if (uid == (uid_t) 0xFFFFFFFF) - return -EINVAL; + return -ENXIO; /* A long time ago UIDs where 16bit, hence explicitly avoid the 16bit -1 too */ if (uid == (uid_t) 0xFFFF) - return -EINVAL; + return -ENXIO; *ret_uid = uid; return 0; -- 1.7.9.2 ++++++ 0001-po-add-Ukrainian-translation.patch ++++++
From 260b6323cc2aebe722d5b8e43fa63a502f906774 Mon Sep 17 00:00:00 2001 From: Daniel Korostil <ted.korostiled@gmail.com> Date: Thu, 17 Jul 2014 02:07:29 +0300 Subject: [PATCH] po: add Ukrainian translation
--- po/LINGUAS | 1 + po/uk.po | 377 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 378 insertions(+) create mode 100644 po/uk.po diff --git po/LINGUAS po/LINGUAS index 2cb0f30..f214ece 100644 --- po/LINGUAS +++ po/LINGUAS @@ -4,3 +4,4 @@ fr it pl ru +uk diff --git po/uk.po po/uk.po new file mode 100644 index 0000000..7a5212a --- /dev/null +++ po/uk.po @@ -0,0 +1,377 @@ +# Ukrainian translation for systemd. +# Copyright (C) 2014 systemd's COPYRIGHT HOLDER +# This file is distributed under the same license as the systemd package. +# Eugene Melnik <jeka7js@gmail.com>, 2014. +# Daniel Korostil <ted.korostiled@gmail.com>, 2014. +msgid "" +msgstr "" +"Project-Id-Version: systemd master\n" +"Report-Msgid-Bugs-To: https://bugs.freedesktop.org/enter_bug.cgi?product=sys" +"temd&keywords=I18N+L10N&component=general\n" +"POT-Creation-Date: 2014-06-06 22:16+0000\n" +"PO-Revision-Date: 2014-07-16 19:13+0300\n" +"Last-Translator: Daniel Korostil <ted.korostiled@gmail.com>\n" +"Language-Team: linux.org.ua\n" +"Language: uk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" +"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Virtaal 0.7.1\n" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1 +msgid "Set host name" +msgstr "Встановити назву вузла" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2 +msgid "Authentication is required to set the local host name." +msgstr "Засвідчення потрібне, щоб встановити назву локального вузла." + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3 +msgid "Set static host name" +msgstr "Встановити статичну назву вузла" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4 +msgid "" +"Authentication is required to set the statically configured local host name, " +"as well as the pretty host name." +msgstr "" +"Засвідчення потрібне, щоб вказати статично налаштовану назву локального " +"вузла, так само й форматовану." + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5 +msgid "Set machine information" +msgstr "Встановити інформацію про машину" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6 +msgid "Authentication is required to set local machine information." +msgstr "Засвідчення потрібно, щоб вказати локальну інформацію про машини." + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:1 +msgid "Set system locale" +msgstr "Вказати системну локаль" + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:2 +msgid "Authentication is required to set the system locale." +msgstr "Засвідчення потрібно, щоб встановити системну локаль." + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:3 +msgid "Set system keyboard settings" +msgstr "Вказати налаштування системної клавіатури" + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:4 +msgid "Authentication is required to set the system keyboard settings." +msgstr "Засвідчення потрібно, щоб вказати налаштування системної клавіатури." + +#: ../src/login/org.freedesktop.login1.policy.in.h:1 +msgid "Allow applications to inhibit system shutdown" +msgstr "Дозволити програмам перешкоджати вимкненню системи" + +#: ../src/login/org.freedesktop.login1.policy.in.h:2 +msgid "" +"Authentication is required to allow an application to inhibit system " +"shutdown." +msgstr "" +"Засвідчення потрібно, щоб дозволити програмам перешкоджати вимкненню системи." + +#: ../src/login/org.freedesktop.login1.policy.in.h:3 +msgid "Allow applications to delay system shutdown" +msgstr "Дозволити програмам затримувати вимкнення системи" + +#: ../src/login/org.freedesktop.login1.policy.in.h:4 +msgid "" +"Authentication is required to allow an application to delay system shutdown." +msgstr "" +"Засвідчення потрібно, щоб дозволити програмам затримувати вимкнення системи." + +#: ../src/login/org.freedesktop.login1.policy.in.h:5 +msgid "Allow applications to inhibit system sleep" +msgstr "Дозволити програмам перешкоджати засинанню системи" + +#: ../src/login/org.freedesktop.login1.policy.in.h:6 +msgid "" +"Authentication is required to allow an application to inhibit system sleep." +msgstr "" +"Засвідчення потрібно, щоб дозволити програмам перешкоджати засинанню системи." + +#: ../src/login/org.freedesktop.login1.policy.in.h:7 +msgid "Allow applications to delay system sleep" +msgstr "Дозволити програмами затримувати засинання системи" + +#: ../src/login/org.freedesktop.login1.policy.in.h:8 +msgid "" +"Authentication is required to allow an application to delay system sleep." +msgstr "" +"Засвідчення потрібно, щоб дозволити програмам затримувати засинання системи." + +#: ../src/login/org.freedesktop.login1.policy.in.h:9 +msgid "Allow applications to inhibit automatic system suspend" +msgstr "Дозволити програмам перешкоджати автоматичному призупиненню системи" + +#: ../src/login/org.freedesktop.login1.policy.in.h:10 +msgid "" +"Authentication is required to allow an application to inhibit automatic " +"system suspend." +msgstr "" +"Засвідчення потрібно, щоб дозволити програмам перешкоджати автоматичному " +"призупиненню системи." + +#: ../src/login/org.freedesktop.login1.policy.in.h:11 +msgid "Allow applications to inhibit system handling of the power key" +msgstr "Дозволити програмам перешкоджати обробленню системою клавіші живлення" + +#: ../src/login/org.freedesktop.login1.policy.in.h:12 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the power key." +msgstr "" +"Засвідчення потрібно, щоб дозволити програмам перешкоджати обробленню " +"системою клавіші живлення." + +#: ../src/login/org.freedesktop.login1.policy.in.h:13 +msgid "Allow applications to inhibit system handling of the suspend key" +msgstr "" +"Дозволити програмам перешкоджати обробленню системою клавіші призупинення" + +#: ../src/login/org.freedesktop.login1.policy.in.h:14 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the suspend key." +msgstr "" +"Засвідчення потрібно, щоб дозволити програмам перешкоджати обробленню " +"системою клавіші призупинення." + +#: ../src/login/org.freedesktop.login1.policy.in.h:15 +msgid "Allow applications to inhibit system handling of the hibernate key" +msgstr "Дозволити програмам перешкоджати обробленню системою клавіші присипання" + +#: ../src/login/org.freedesktop.login1.policy.in.h:16 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the hibernate key." +msgstr "" +"Засвідчення потрібно, щоб дозволити програмам перешкоджати обробленню " +"системою клавіші присипання." + +#: ../src/login/org.freedesktop.login1.policy.in.h:17 +msgid "Allow applications to inhibit system handling of the lid switch" +msgstr "" +"Дозволити програмам перешкоджати обробленню системою клавіші перемикання " +"кришки" + +#: ../src/login/org.freedesktop.login1.policy.in.h:18 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the lid switch." +msgstr "" +"Засвідчення потрібно, щоб дозволити програмам перешкоджати обробленню " +"системою клавіші перемикання кришки." + +#: ../src/login/org.freedesktop.login1.policy.in.h:19 +msgid "Allow non-logged-in users to run programs" +msgstr "Дозволити незареєстрованим користувачам запускати програми" + +#: ../src/login/org.freedesktop.login1.policy.in.h:20 +msgid "" +"Authentication is required to allow a non-logged-in user to run programs." +msgstr "" +"Засвідчення потрібно, щоб дозволити незареєстрованим користувачам запускати " +"програми." + +#: ../src/login/org.freedesktop.login1.policy.in.h:21 +msgid "Allow attaching devices to seats" +msgstr "Дозволити під'єднання пристроїв до місць" + +#: ../src/login/org.freedesktop.login1.policy.in.h:22 +msgid "Authentication is required for attaching a device to a seat." +msgstr "Засвідчення потрібно, щоб під'єднувати пристрої до місць." + +#: ../src/login/org.freedesktop.login1.policy.in.h:23 +msgid "Flush device to seat attachments" +msgstr "Очисний пристрій для під'єднань до місця" + +#: ../src/login/org.freedesktop.login1.policy.in.h:24 +msgid "" +"Authentication is required for resetting how devices are attached to seats." +msgstr "Засвідчення потрібно, щоб перезапустити спосіб під'єднання до місць." + +#: ../src/login/org.freedesktop.login1.policy.in.h:25 +msgid "Power off the system" +msgstr "Вимкнути систему" + +#: ../src/login/org.freedesktop.login1.policy.in.h:26 +msgid "Authentication is required for powering off the system." +msgstr "Засвідчення потрібно, щоб вимкнути систему." + +#: ../src/login/org.freedesktop.login1.policy.in.h:27 +msgid "Power off the system while other users are logged in" +msgstr "Вимикнути систему, коли інші користувачі ще в ній" + +#: ../src/login/org.freedesktop.login1.policy.in.h:28 +msgid "" +"Authentication is required for powering off the system while other users are " +"logged in." +msgstr "" +"Засвідчення потрібно, щоб вимкнути систему, коли інші користувачі в ній." + +#: ../src/login/org.freedesktop.login1.policy.in.h:29 +msgid "Power off the system while an application asked to inhibit it" +msgstr "Вимкнути систему, коли програми намагаються першкодити цьому" + +#: ../src/login/org.freedesktop.login1.policy.in.h:30 +msgid "" +"Authentication is required for powering off the system while an application " +"asked to inhibit it." +msgstr "" +"Засвідчення потрібно, щоб вимкнути систему, коли програми намагаються " +"першкодити цьому." + +#: ../src/login/org.freedesktop.login1.policy.in.h:31 +msgid "Reboot the system" +msgstr "Перезавантажити систему" + +#: ../src/login/org.freedesktop.login1.policy.in.h:32 +msgid "Authentication is required for rebooting the system." +msgstr "Для перезавантаження системи необхідна ідентифікація." + +#: ../src/login/org.freedesktop.login1.policy.in.h:33 +msgid "Reboot the system while other users are logged in" +msgstr "Перезавантажити, якщо інщі користувачі в системі" + +#: ../src/login/org.freedesktop.login1.policy.in.h:34 +msgid "" +"Authentication is required for rebooting the system while other users are " +"logged in." +msgstr "" +"Засвідчення потрібно, щоб перезапустити систему, коли інші користувачі в " +"ній." + +#: ../src/login/org.freedesktop.login1.policy.in.h:35 +msgid "Reboot the system while an application asked to inhibit it" +msgstr "Перезапустити систему, коли програми намагаються першкодити цьому" + +#: ../src/login/org.freedesktop.login1.policy.in.h:36 +msgid "" +"Authentication is required for rebooting the system while an application " +"asked to inhibit it." +msgstr "" +"Засвідчення потрібно, щоб перезапустити систему, коли програми намагаються " +"першкодити цьому." + +#: ../src/login/org.freedesktop.login1.policy.in.h:37 +msgid "Suspend the system" +msgstr "Призупинити систему" + +#: ../src/login/org.freedesktop.login1.policy.in.h:38 +msgid "Authentication is required for suspending the system." +msgstr "Засвідчення потрібно, щоб призупинити систему." + +#: ../src/login/org.freedesktop.login1.policy.in.h:39 +msgid "Suspend the system while other users are logged in" +msgstr "Призупинити систему, коли інші користувачі в ній" + +#: ../src/login/org.freedesktop.login1.policy.in.h:40 +msgid "" +"Authentication is required for suspending the system while other users are " +"logged in." +msgstr "" +"Засвідчення потрібно, щоб призупинити систему, коли інші користувачі в ній." + +#: ../src/login/org.freedesktop.login1.policy.in.h:41 +msgid "Suspend the system while an application asked to inhibit it" +msgstr "Призупинити систему, коли програми намагаються першкодити цьому" + +#: ../src/login/org.freedesktop.login1.policy.in.h:42 +msgid "" +"Authentication is required for suspending the system while an application " +"asked to inhibit it." +msgstr "" +"Засвідчення потрібно, щоб призупнити систему, коли програми намагаються " +"першкодити цьому." + +#: ../src/login/org.freedesktop.login1.policy.in.h:43 +msgid "Hibernate the system" +msgstr "Приспати систему" + +#: ../src/login/org.freedesktop.login1.policy.in.h:44 +msgid "Authentication is required for hibernating the system." +msgstr "Засвідчення потрібно, щоб приспати систему." + +#: ../src/login/org.freedesktop.login1.policy.in.h:45 +msgid "Hibernate the system while other users are logged in" +msgstr "Приспати систему, коли інші користувачі в ній" + +#: ../src/login/org.freedesktop.login1.policy.in.h:46 +msgid "" +"Authentication is required for hibernating the system while other users are " +"logged in." +msgstr "" +"Засвідчення потрібно, щоб присипання систему, коли інші користувачі в ній." + +#: ../src/login/org.freedesktop.login1.policy.in.h:47 +msgid "Hibernate the system while an application asked to inhibit it" +msgstr "Приспати систему, коли програми намагаються першкодити цьому" + +#: ../src/login/org.freedesktop.login1.policy.in.h:48 +msgid "" +"Authentication is required for hibernating the system while an application " +"asked to inhibit it." +msgstr "" +"Засвідчення потрібно, щоб приспати систему, коли програми намагаються " +"першкодити цьому." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1 +msgid "Set system time" +msgstr "Вказати системний час" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:2 +msgid "Authentication is required to set the system time." +msgstr "Засвідчення потрібно, щоб вказати системний час." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:3 +msgid "Set system timezone" +msgstr "Вказати системний часовий пояс" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:4 +msgid "Authentication is required to set the system timezone." +msgstr "Засвідчення потрібно, щоб вказати системний часовий пояс." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:5 +msgid "Set RTC to local timezone or UTC" +msgstr "Вкажіть RTC для локального часового поясу або UTC" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:6 +msgid "" +"Authentication is required to control whether the RTC stores the local or " +"UTC time." +msgstr "Засвідчення потрібно, щоб контролювати, чи RTC зберігає час, чи UTC." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:7 +msgid "Turn network time synchronization on or off" +msgstr "Увімкнути або вимкнути синхронізування через мережу" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:8 +msgid "" +"Authentication is required to control whether network time synchronization " +"shall be enabled." +msgstr "" +"Засвідчення потрібно, щоб контролювати, чи синхронізування часу через мережу " +"запущено." + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1 +msgid "Send passphrase back to system" +msgstr "Надіслати пароль назад у систему" + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:2 +msgid "" +"Authentication is required to send the entered passphrase back to the system." +msgstr "Засвідчення потрібно, щоб надіслати введений пароль назад у систему." + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3 +msgid "Privileged system and service manager access" +msgstr "Привілейований доступ до менеджера системи і служб" + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4 +msgid "Authentication is required to access the system and service manager." +msgstr "Засвідчення потрібно, щоб доступитись до менеджера системи і служб." -- 1.7.9.2 ++++++ 0001-reduce-the-amount-of-messages-logged-to-dev-kmsg-whe.patch ++++++ Based on b2103dccb354de3f38c49c14ccb637bdf665e40f Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Sat, 5 Apr 2014 13:59:01 -0400 Subject: [PATCH] reduce the amount of messages logged to /dev/kmsg when "debug" is specified --- src/core/main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- src/core/main.c +++ src/core/main.c 2014-04-14 13:50:48.490814738 +0000 @@ -412,12 +412,8 @@ static int parse_proc_cmdline_word(const if (arg_show_status == _SHOW_STATUS_UNSET) arg_show_status = SHOW_STATUS_AUTO; } else if (streq(word, "debug")) { - /* Log to kmsg, the journal socket will fill up before the - * journal is started and tools running during that time - * will block with every log message for for 60 seconds, - * before they give up. */ - log_set_max_level(LOG_DEBUG); - log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_KMSG); + if (detect_container(NULL) > 0) + log_set_target(LOG_TARGET_CONSOLE); } else if (!in_initrd()) { unsigned i; ++++++ 0001-replace-more-dup-by-F_DUPFD_CLOEXEC.patch ++++++
From ead349509e325aad720bb0349521a9e56e2ac7c0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 13 May 2014 16:40:53 +0200 Subject: [PATCH] replace more dup() by F_DUPFD_CLOEXEC
--- src/login/inhibit.c | 2 +- src/shared/install.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git src/login/inhibit.c src/login/inhibit.c index 48c2ec4..ae3afdf 100644 --- src/login/inhibit.c +++ src/login/inhibit.c @@ -64,7 +64,7 @@ static int inhibit(sd_bus *bus, sd_bus_error *error) { if (r < 0) return r; - r = dup(fd); + r = fcntl(fd, F_DUPFD_CLOEXEC, 3); if (r < 0) return -errno; diff --git src/shared/install.c src/shared/install.c index acfba25..9ce9403 100644 --- src/shared/install.c +++ src/shared/install.c @@ -332,7 +332,7 @@ static int remove_marked_symlinks( int q, cfd; deleted = false; - cfd = dup(fd); + cfd = fcntl(fd, F_DUPFD_CLOEXEC, 3); if (cfd < 0) { r = -errno; break; -- 1.7.9.2 ++++++ 0001-sd-bus-don-t-look-for-a-64bit-value-when-we-only-hav.patch ++++++
From 42c4ebcbd4cbd7b27667eb8081ee4dc46f9ece17 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 13 Mar 2014 20:33:22 +0100 Subject: [PATCH] sd-bus: don't look for a 64bit value when we only have 32bit value on reply cookie hash table access
This broke hashtable lookups for the message cookies on s390x, which is a 64bit BE machine where accessing 32bit values as 64bit and vice versa will explode. Also, while we are at it, be a bit more careful when dealing with the 64bit cookies we expose and the 32bit serial numbers dbus uses in its payload. Problem identified by Fridrich Strba. --- src/libsystemd/sd-bus/bus-dump.c | 4 ++-- src/libsystemd/sd-bus/bus-kernel.c | 2 +- src/libsystemd/sd-bus/bus-message.c | 15 ++++++++++----- src/libsystemd/sd-bus/bus-message.h | 5 +++-- src/libsystemd/sd-bus/sd-bus.c | 12 ++++++------ 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c index 0e41549..ea81644 100644 --- a/src/libsystemd/sd-bus/bus-dump.c +++ b/src/libsystemd/sd-bus/bus-dump.c @@ -69,10 +69,10 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) { if (BUS_MESSAGE_COOKIE(m) == 0xFFFFFFFFULL) fprintf(f, " Cookie=-1"); else - fprintf(f, " Cookie=%lu", (unsigned long) BUS_MESSAGE_COOKIE(m)); + fprintf(f, " Cookie=%" PRIu64, BUS_MESSAGE_COOKIE(m)); if (m->reply_cookie != 0) - fprintf(f, " ReplyCookie=%lu", (unsigned long) m->reply_cookie); + fprintf(f, " ReplyCookie=%" PRIu64, m->reply_cookie); fputs("\n", f); diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index 8a2ca02..80ef15b 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -266,7 +266,7 @@ static int bus_message_setup_kmsg(sd_bus *b, sd_bus_message *m) { well_known ? 0 : m->destination ? unique : KDBUS_DST_ID_BROADCAST; m->kdbus->payload_type = KDBUS_PAYLOAD_DBUS; - m->kdbus->cookie = m->header->serial; + m->kdbus->cookie = (uint64_t) m->header->serial; m->kdbus->priority = m->priority; if (m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index fb894ef..97ab0e3 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -617,7 +617,7 @@ static int message_new_reply( t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED; t->reply_cookie = BUS_MESSAGE_COOKIE(call); - r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, t->reply_cookie); + r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, (uint32_t) t->reply_cookie); if (r < 0) goto fail; @@ -752,7 +752,7 @@ int bus_message_new_synthetic_error( t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED; t->reply_cookie = cookie; - r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, t->reply_cookie); + r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, (uint32_t) t->reply_cookie); if (r < 0) goto fail; @@ -5075,21 +5075,26 @@ int bus_message_parse_fields(sd_bus_message *m) { break; } - case BUS_MESSAGE_HEADER_REPLY_SERIAL: + case BUS_MESSAGE_HEADER_REPLY_SERIAL: { + uint32_t serial; + if (m->reply_cookie != 0) return -EBADMSG; if (!streq(signature, "u")) return -EBADMSG; - r = message_peek_field_uint32(m, &ri, item_size, &m->reply_cookie); + r = message_peek_field_uint32(m, &ri, item_size, &serial); if (r < 0) return r; + m->reply_cookie = serial; + if (m->reply_cookie == 0) return -EBADMSG; break; + } case BUS_MESSAGE_HEADER_UNIX_FDS: if (unix_fds != 0) @@ -5489,7 +5494,7 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) { return -ENOMEM; n->reply_cookie = (*m)->reply_cookie; - r = message_append_field_uint32(n, BUS_MESSAGE_HEADER_REPLY_SERIAL, n->reply_cookie); + r = message_append_field_uint32(n, BUS_MESSAGE_HEADER_REPLY_SERIAL, (uint32_t) n->reply_cookie); if (r < 0) return r; diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h index 5fbe3e6..df79294 100644 --- a/src/libsystemd/sd-bus/bus-message.h +++ b/src/libsystemd/sd-bus/bus-message.h @@ -84,7 +84,7 @@ struct sd_bus_message { sd_bus *bus; - uint32_t reply_cookie; + uint64_t reply_cookie; const char *path; const char *interface; @@ -162,7 +162,8 @@ static inline uint64_t BUS_MESSAGE_BSWAP64(sd_bus_message *m, uint64_t u) { return BUS_MESSAGE_NEED_BSWAP(m) ? bswap_64(u) : u; } -static inline uint32_t BUS_MESSAGE_COOKIE(sd_bus_message *m) { +static inline uint64_t BUS_MESSAGE_COOKIE(sd_bus_message *m) { + /* Note that we return the serial converted to a 64bit value here */ return BUS_MESSAGE_BSWAP32(m, m->header->serial); } diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index ca7c428..8e44e50 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -1486,15 +1486,15 @@ static int bus_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call return r; if (bus->is_kernel || *idx >= BUS_MESSAGE_SIZE(m)) - log_debug("Sent message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%lu reply_cookie=%lu error=%s", + log_debug("Sent message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%" PRIu64 " reply_cookie=%" PRIu64 " error=%s", bus_message_type_to_string(m->header->type), strna(sd_bus_message_get_sender(m)), strna(sd_bus_message_get_destination(m)), strna(sd_bus_message_get_path(m)), strna(sd_bus_message_get_interface(m)), strna(sd_bus_message_get_member(m)), - (unsigned long) BUS_MESSAGE_COOKIE(m), - (unsigned long) m->reply_cookie, + BUS_MESSAGE_COOKIE(m), + m->reply_cookie, strna(m->error.message)); return r; @@ -2253,15 +2253,15 @@ static int process_message(sd_bus *bus, sd_bus_message *m) { bus->current = m; bus->iteration_counter++; - log_debug("Got message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%lu reply_cookie=%lu error=%s", + log_debug("Got message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%" PRIu64 " reply_cookie=%" PRIu64 " error=%s", bus_message_type_to_string(m->header->type), strna(sd_bus_message_get_sender(m)), strna(sd_bus_message_get_destination(m)), strna(sd_bus_message_get_path(m)), strna(sd_bus_message_get_interface(m)), strna(sd_bus_message_get_member(m)), - (unsigned long) BUS_MESSAGE_COOKIE(m), - (unsigned long) m->reply_cookie, + BUS_MESSAGE_COOKIE(m), + m->reply_cookie, strna(m->error.message)); r = process_hello(bus, m); -- 1.9.0 ++++++ 0001-sd-bus-properly-handle-removals-of-non-existing-matc.patch ++++++
From ef7b6c0190fefaacf6d8f8e1a6dda4ba8b98091b Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 29 Oct 2014 17:58:43 +0100 Subject: [PATCH] sd-bus: properly handle removals of non-existing matches
--- src/libsystemd/sd-bus/bus-match.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/libsystemd/sd-bus/bus-match.c src/libsystemd/sd-bus/bus-match.c index 18afe0f..5658c61 100644 --- src/libsystemd/sd-bus/bus-match.c +++ src/libsystemd/sd-bus/bus-match.c @@ -537,7 +537,7 @@ static int bus_match_find_compare_value( else if (BUS_MATCH_CAN_HASH(t)) n = hashmap_get(c->compare.children, value_str); else { - for (n = c->child; !value_node_same(n, t, value_u8, value_str); n = n->next) + for (n = c->child; n && !value_node_same(n, t, value_u8, value_str); n = n->next) ; } -- 1.7.9.2 ++++++ 0001-sd-event-don-t-require-a-signal-event-source-to-be-e.patch ++++++
From 92daebc0d0268c35f416c1665e0da3d4be5dd69f Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 11 Jul 2014 16:48:35 +0200 Subject: [PATCH] sd-event: don't require a signal event source to be enabled for the child event source to work
--- src/libsystemd/sd-event/sd-event.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git src/libsystemd/sd-event/sd-event.c src/libsystemd/sd-event/sd-event.c index a21f7db..9a9664c 100644 --- src/libsystemd/sd-event/sd-event.c +++ src/libsystemd/sd-event/sd-event.c @@ -1919,14 +1919,13 @@ static int process_signal(sd_event *e, uint32_t events) { int r; assert(e); - assert(e->signal_sources); assert_return(events == EPOLLIN, -EIO); for (;;) { struct signalfd_siginfo si; ssize_t ss; - sd_event_source *s; + sd_event_source *s = NULL; ss = read(e->signal_fd, &si, sizeof(si)); if (ss < 0) { @@ -1941,16 +1940,19 @@ static int process_signal(sd_event *e, uint32_t events) { read_one = true; - s = e->signal_sources[si.ssi_signo]; if (si.ssi_signo == SIGCHLD) { r = process_child(e); if (r < 0) return r; - if (r > 0 || !s) + if (r > 0) continue; - } else - if (!s) - return -EIO; + } + + if (e->signal_sources) + s = e->signal_sources[si.ssi_signo]; + + if (!s) + continue; s->signal.siginfo = si; r = source_set_pending(s, true); -- 1.7.9.2 ++++++ 0001-sd-event-restore-correct-timeout-behaviour.patch ++++++ Based on eec6022cf039e62233139000b9e95db943959e48 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 5 Jun 2014 13:43:30 +0200 Subject: [PATCH] sd-event: restore correct timeout behaviour --- src/libsystemd/sd-event/sd-event.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- src/libsystemd/sd-event/sd-event.c +++ src/libsystemd/sd-event/sd-event.c 2014-06-06 10:26:51.422235695 +0000 @@ -2047,6 +2047,7 @@ _public_ int sd_event_run(sd_event *e, u unsigned ev_queue_max; sd_event_source *p; int r, i, m; + bool timedout; assert_return(e, -EINVAL); assert_return(!event_pid_changed(e), -ECHILD); @@ -2084,6 +2085,8 @@ _public_ int sd_event_run(sd_event *e, u goto finish; } + timedout = m == 0; + dual_timestamp_get(&e->timestamp); for (i = 0; i < m; i++) { @@ -2123,7 +2126,7 @@ _public_ int sd_event_run(sd_event *e, u p = event_next_pending(e); if (!p) { - r = 1; + r = !timedout; goto finish; } ++++++ 0001-sd-rtnl-message-append-fix-uninitialized-memory.patch ++++++ Backport of 7ca1d31964a2553f7bd011bc10ac42e0ebc1f975 Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Fri, 2 May 2014 22:29:18 +0200 Subject: [PATCH] sd-rtnl-message: append - fix uninitialized memory We were not properly clearing the padding at the front of some containers. --- src/libsystemd/sd-rtnl/rtnl-message.c | 42 +++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 15 deletions(-) --- src/libsystemd/sd-rtnl/rtnl-message.c +++ src/libsystemd/sd-rtnl/rtnl-message.c 2014-05-05 13:33:01.998235340 +0000 @@ -314,24 +314,28 @@ int sd_rtnl_message_link_get_flags(sd_rt /* If successful the updated message will be correctly aligned, if unsuccessful the old message is untouched. */ static int add_rtattr(sd_rtnl_message *m, unsigned short type, const void *data, size_t data_length) { - uint32_t rta_length, message_length; + uint32_t rta_length; + size_t message_length, padding_length; struct nlmsghdr *new_hdr; struct rtattr *rta; char *padding; unsigned i; + int offset; assert(m); assert(m->hdr); assert(!m->sealed); assert(NLMSG_ALIGN(m->hdr->nlmsg_len) == m->hdr->nlmsg_len); - assert(!data || data_length > 0); - assert(data || m->n_containers < RTNL_CONTAINER_DEPTH); + assert(!data || data_length); + + /* get offset of the new attribute */ + offset = m->hdr->nlmsg_len; /* get the size of the new rta attribute (with padding at the end) */ rta_length = RTA_LENGTH(data_length); /* get the new message size (with padding at the end) */ - message_length = m->hdr->nlmsg_len + RTA_ALIGN(rta_length); + message_length = offset + RTA_ALIGN(rta_length); /* realloc to fit the new attribute */ new_hdr = realloc(m->hdr, message_length); @@ -340,32 +344,35 @@ static int add_rtattr(sd_rtnl_message *m m->hdr = new_hdr; /* get pointer to the attribute we are about to add */ - rta = (struct rtattr *) ((uint8_t *) m->hdr + m->hdr->nlmsg_len); + rta = (struct rtattr *) ((uint8_t *) m->hdr + offset); /* if we are inside containers, extend them */ for (i = 0; i < m->n_containers; i++) - GET_CONTAINER(m, i)->rta_len += message_length - m->hdr->nlmsg_len; + GET_CONTAINER(m, i)->rta_len += message_length - offset; /* fill in the attribute */ rta->rta_type = type; rta->rta_len = rta_length; - if (!data) { - /* this is the start of a new container */ - m->container_offsets[m->n_containers ++] = m->hdr->nlmsg_len; - } else { + if (data) /* we don't deal with the case where the user lies about the type * and gives us too little data (so don't do that) - */ + */ padding = mempcpy(RTA_DATA(rta), data, data_length); - /* make sure also the padding at the end of the message is initialized */ - memzero(padding, - (uint8_t *) m->hdr + message_length - (uint8_t *) padding); + else { + /* if no data was passed, make sure we still initialize the padding + note that we can have data_length > 0 (used by some containers) */ + padding = RTA_DATA(rta); + data_length = 0; } + /* make sure also the padding at the end of the message is initialized */ + padding_length = (uint8_t*)m->hdr + message_length - (uint8_t*)padding; + memzero(padding, padding_length); + /* update message size */ m->hdr->nlmsg_len = message_length; - return 0; + return offset; } int sd_rtnl_message_append_string(sd_rtnl_message *m, unsigned short type, const char *data) { @@ -498,6 +505,7 @@ int sd_rtnl_message_append_u32(sd_rtnl_m assert_return(m, -EINVAL); assert_return(!m->sealed, -EPERM); + assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -ERANGE); r = sd_rtnl_message_get_type(m, &rtm_type); if (r < 0) @@ -548,6 +556,10 @@ int sd_rtnl_message_append_u32(sd_rtnl_m if (r < 0) return r; + m->container_offsets[m->n_containers ++] = r; + + m->container_offsets[m->n_containers ++] = r; + return 0; } ++++++ 0001-selinux-access-fix-broken-ternary-operator.patch ++++++ Based on 1e648011b20c8126412d3cf2699d575d9ba9e0fe Mon Sep 17 00:00:00 2001 From: Lukas Nykryn <lnykryn@redhat.com> Date: Fri, 21 Nov 2014 17:02:15 +0100 Subject: [PATCH] selinux-access: fix broken ternary operator it seems to be a typo introduced by ebcf1f97de4f6b1580ae55eb56b1a3939fe6b602 - _r = selinux_access_check(_b, _m, _u->source_path ?:_u->fragment_path, (permission), &_error); \ + ({ Unit *_unit = (unit); selinux_generic_access_check(bus,message, _unit->fragment_path ?: _unit->fragment_path, permission,error); }) --- src/core/selinux-access.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- src/core/selinux-access.h +++ src/core/selinux-access.h 2014-12-15 11:49:54.521518349 +0000 @@ -34,7 +34,7 @@ int selinux_generic_access_check(sd_bus #define selinux_access_check(bus, message, permission, error) \ selinux_generic_access_check(bus, message, NULL, permission, error) #define selinux_unit_access_check(unit, bus, message, permission, error) \ - ({ Unit *_unit = (unit); selinux_generic_access_check(bus, message, _unit->fragment_path ?: _unit->fragment_path, permission, error); }) + ({ Unit *_unit = (unit); selinux_generic_access_check(bus, message, _unit->source_path ?: _unit->fragment_path, permission, error); }) #else ++++++ 0001-shell-completion-fix-completion-of-inactive-units.patch ++++++ Based on f29c77bc0179b0fa57407dbe30b495be9f5ad2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 14 Oct 2014 20:20:07 -0400 Subject: [PATCH] shell-completion: fix completion of inactive units Units which not loaded were not proposed properly. OTOH, we should filter units from get-unit-files by their state if they are currently loaded. Bring zsh completions in line with bash completion, the same logic should be used in both implementations. https://bugzilla.redhat.com/show_bug.cgi?id=1024379 https://bugzilla.redhat.com/show_bug.cgi?id=790768 https://bugs.freedesktop.org/show_bug.cgi?id=84720 --- shell-completion/bash/systemctl | 17 +++++++++-------- shell-completion/zsh/_systemctl | 16 +++++++++------- 2 files changed, 18 insertions(+), 15 deletions(-) --- shell-completion/bash/systemctl +++ shell-completion/bash/systemctl @@ -55,10 +55,14 @@ __get_all_units () { { __systemctl $1 list-unit-files; __systemctl $1 list- | { while read -r a b; do echo " $a"; done; }; } __get_active_units () { __systemctl $1 list-units \ | { while read -r a b; do echo " $a"; done; }; } -__get_startable_units () { { - __systemctl $1 list-units --all -t service,timer,socket,mount,automount,path,snapshot,swap - __systemctl $1 list-unit-files -t service,timer,socket,mount,automount,path,snapshot,swap; } \ - | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }; } +__get_startable_units () { + # find inactive or failed units, filter out masked and not-found + __systemctl $1 list-units --state inactive,failed -- $( __get_all_units ) | \ + { while read -r a b c d; do [[ $b == "loaded" ]] && echo " $a"; done; }; } +__get_restartable_units () { + # find !masked, filter out masked and not-found + __systemctl $1 list-units --state active,inactive,failed -- $( __get_all_units ) | \ + { while read -r a b c d; do [[ $b == "loaded" ]] && echo " $a"; done; }; } __get_failed_units () { __systemctl $1 list-units \ | { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; } __get_enabled_units () { __systemctl $1 list-unit-files \ @@ -180,10 +184,7 @@ _systemctl () { elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then comps=$( __filter_units_by_property $mode CanStart yes \ - $( __get_all_units $mode \ - | while read -r line; do \ - [[ "$line" =~ @\.|\.(device|snapshot|socket|timer)$ ]] || echo " $line"; \ - done )) + $( __get_restartable_units $mode)) compopt -o filenames elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then --- shell-completion/zsh/_systemctl +++ shell-completion/zsh/_systemctl @@ -138,8 +138,11 @@ _filter_units_by_property() { done } +_systemctl_all_units() { { __systemctl list-unit-files; __systemctl list-units --all; } | { while read -r a b; do echo -E - " $a"; done; } } + _systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read -r a b; do echo -E - " $a"; done; }) )} -_systemctl_inactive_units(){_sys_inactive_units=($(__systemctl list-units --all | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo -E - " $a"; done; }) )} +_systemctl_startable_units(){_sys_startable_units=($(__systemctl list-units --state inactive,failed -- $(_systemctl_all_units) | { while read -r a b c d; do [[ $b == "loaded" ]] && echo -E - " $a"; done; }) )} +_systemctl_restartable_units(){_sys_restartable_units=($(__systemctl list-units --state inactive,failed,active -- $(_systemctl_all_units) | { while read -r a b c d; do [[ $b == "loaded" ]] && echo -E - " $a"; done; }) )} _systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read -r a b; do echo -E - " $a"; done; }) )} _systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files | { while read -r a b; do [[ $b == "enabled" ]] && echo -E - " $a"; done; }) )} _systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read -r a b; do [[ $b == "disabled" ]] && echo -E - " $a"; done; }) )} @@ -181,8 +184,9 @@ done # Completion functions for STARTABLE_UNITS (( $+functions[_systemctl_start] )) || _systemctl_start() { - _systemctl_inactive_units - compadd "$@" -a - _sys_inactive_units + _systemctl_startable_units + compadd "$@" - $( _filter_units_by_property CanStart yes \ + ${_sys_startable_units[*]} ) } # Completion functions for STOPPABLE_UNITS @@ -217,11 +221,9 @@ done for fun in restart reload-or-restart ; do (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() { - _systemctl_all_units + _systemctl_restartable_units compadd "$@" - $( _filter_units_by_property CanStart yes \ - ${_sys_all_units[*]} | while read -r line; do \ - [[ "$line" =~ \.device$ ]] || echo -E - " $line"; \ - done ) + ${_sys_restartable_units[*]} ) } done -- 1.7.9.2 ++++++ 0001-shutdownd-clean-up-initialization-of-struct.patch ++++++
From b748c7596f79945be5263a0d1c88de64eb0c5146 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Sat, 27 Sep 2014 00:25:09 +0200 Subject: [PATCH] shutdownd: clean up initialization of struct
No functional change. We just don't assign the value twice. Found by coverity. Fixes: CID#1237616 and #1237617 --- src/shutdownd/shutdownd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git src/shutdownd/shutdownd.c src/shutdownd/shutdownd.c index 99aa4b3..0f008a6 100644 --- src/shutdownd/shutdownd.c +++ src/shutdownd/shutdownd.c @@ -52,8 +52,8 @@ static int read_packet(int fd, union shutdown_buffer *_b) { union shutdown_buffer b; /* We maintain our own copy here, in * order not to corrupt the last message */ struct iovec iovec = { - iovec.iov_base = &b, - iovec.iov_len = sizeof(b) - 1, + .iov_base = &b, + .iov_len = sizeof(b) - 1, }; union { struct cmsghdr cmsghdr; -- 1.7.9.2 ++++++ 0001-socket-introduce-SELinuxContextFromNet-option.patch ++++++ Based on 16115b0a7b7cdf08fb38084d857d572d8a9088dc Mon Sep 17 00:00:00 2001 From: Michal Sekletar <msekleta@redhat.com> Date: Thu, 24 Jul 2014 10:40:28 +0200 Subject: [PATCH] socket: introduce SELinuxContextFromNet option This makes possible to spawn service instances triggered by socket with MLS/MCS SELinux labels which are created based on information provided by connected peer. Implementation of label_get_child_mls_label derived from xinetd. Reviewed-by: Paul Moore <pmoore@redhat.com> --- man/systemd.socket.xml | 26 +++++++ src/core/execute.c | 30 +++++++-- src/core/execute.h | 1 src/core/load-fragment-gperf.gperf.m4 | 3 src/core/mount.c | 1 src/core/service.c | 4 - src/core/service.h | 3 src/core/socket.c | 16 +++- src/core/socket.h | 2 src/core/swap.c | 1 src/shared/label.c | 113 ++++++++++++++++++++++++++++++++++ src/shared/label.h | 2 12 files changed, 191 insertions(+), 11 deletions(-) --- man/systemd.socket.xml +++ man/systemd.socket.xml 2014-09-23 15:36:49.000000000 +0000 @@ -570,6 +570,32 @@ </varlistentry> <varlistentry> + <term><varname>SELinuxContextFromNet=</varname></term> + <listitem><para>Takes a boolean + argument. When true systemd will attempt + to figure out the SELinux label used + for the instantiated service from the + information handed by the peer over the + network. Note that only the security + level is used from the information + provided by the peer. Other parts of + the resulting SELinux context originate + from either the target binary that is + effectively triggered by socket unit + are taken from the value of the + <varname>SELinuxContext=</varname> + option.This configuration option only + affects sockets with + <varname>Accept=</varname> mode set to + <literal>true</literal>. Also note that + this option is useful only when + MLS/MCS SELinux policy is + deployed. Defaults to + <literal>false</literal>. + </para></listitem> + </varlistentry> + + <varlistentry> <term><varname>PipeSize=</varname></term> <listitem><para>Takes an size in bytes. Controls the pipe buffer size --- src/core/execute.c +++ src/core/execute.c 2014-09-24 09:22:08.882735864 +0000 @@ -82,6 +82,7 @@ #include "selinux-util.h" #include "errno-list.h" #include "apparmor-util.h" +#include "label.h" #ifdef HAVE_SECCOMP #include "seccomp-util.h" @@ -1123,6 +1124,7 @@ int exec_spawn(ExecCommand *command, bool apply_chroot, bool apply_tty_stdin, bool confirm_spawn, + bool selinux_context_net, CGroupControllerMask cgroup_supported, const char *cgroup_path, const char *unit_id, @@ -1594,11 +1596,29 @@ int exec_spawn(ExecCommand *command, #endif #ifdef HAVE_SELINUX - if (context->selinux_context && use_selinux()) { - err = setexeccon(context->selinux_context); - if (err < 0 && !context->selinux_context_ignore) { - r = EXIT_SELINUX_CONTEXT; - goto fail_child; + if (use_selinux()) { + if (context->selinux_context) { + err = setexeccon(context->selinux_context); + if (err < 0 && !context->selinux_context_ignore) { + r = EXIT_SELINUX_CONTEXT; + goto fail_child; + } + } + + if (selinux_context_net && socket_fd >= 0) { + _cleanup_free_ char *label = NULL; + + err = label_get_child_mls_label(socket_fd, command->path, &label); + if (err < 0) { + r = EXIT_SELINUX_CONTEXT; + goto fail_child; + } + + err = setexeccon(label); + if (err < 0) { + r = EXIT_SELINUX_CONTEXT; + goto fail_child; + } } } #endif --- src/core/execute.h +++ src/core/execute.h 2014-09-23 15:46:26.000000000 +0000 @@ -195,6 +195,7 @@ int exec_spawn(ExecCommand *command, bool apply_chroot, bool apply_tty_stdin, bool confirm_spawn, + bool selinux_context_net, CGroupControllerMask cgroup_mask, const char *cgroup_path, const char *unit_id, --- src/core/load-fragment-gperf.gperf.m4 +++ src/core/load-fragment-gperf.gperf.m4 2014-09-23 00:00:00.000000000 +0000 @@ -242,6 +242,9 @@ Socket.SmackLabelIPOut, config_ `Socket.SmackLabel, config_parse_warn_compat, 0, 0 Socket.SmackLabelIPIn, config_parse_warn_compat, 0, 0 Socket.SmackLabelIPOut, config_parse_warn_compat, 0, 0') +m4_ifdef(`HAVE_SELINUX', +`Socket.SELinuxContextFromNet, config_parse_bool, 0, offsetof(Socket, selinux_context_from_net)', +`Socket.SELinuxContextFromNet, config_parse_warn_compat, 0, 0') EXEC_CONTEXT_CONFIG_ITEMS(Socket)m4_dnl CGROUP_CONTEXT_CONFIG_ITEMS(Socket)m4_dnl KILL_CONTEXT_CONFIG_ITEMS(Socket)m4_dnl --- src/core/mount.c +++ src/core/mount.c 2014-09-24 09:16:26.234235379 +0000 @@ -785,6 +785,7 @@ static int mount_spawn(Mount *m, ExecCom true, true, UNIT(m)->manager->confirm_spawn, + false, UNIT(m)->manager->cgroup_supported, UNIT(m)->cgroup_path, UNIT(m)->id, --- src/core/service.c +++ src/core/service.c 2014-09-23 15:49:24.000000000 +0000 @@ -1856,6 +1856,7 @@ static int service_spawn( apply_chroot, apply_tty_stdin, UNIT(s)->manager->confirm_spawn, + s->socket_fd_selinux_context_net, UNIT(s)->manager->cgroup_supported, path, UNIT(s)->id, @@ -3787,7 +3788,7 @@ static void service_bus_name_owner_chang } } -int service_set_socket_fd(Service *s, int fd, Socket *sock) { +int service_set_socket_fd(Service *s, int fd, Socket *sock, bool selinux_context_net) { _cleanup_free_ char *peer = NULL; int r; @@ -3825,6 +3826,7 @@ int service_set_socket_fd(Service *s, in } s->socket_fd = fd; + s->socket_fd_selinux_context_net = selinux_context_net; unit_ref_set(&s->accept_socket, UNIT(sock)); --- src/core/service.h +++ src/core/service.h 2014-09-23 15:51:13.000000000 +0000 @@ -159,6 +159,7 @@ struct Service { pid_t main_pid, control_pid; int socket_fd; + bool socket_fd_selinux_context_net; bool permissions_start_only; bool root_directory_start_only; bool remain_after_exit; @@ -204,7 +205,7 @@ extern const UnitVTable service_vtable; struct Socket; -int service_set_socket_fd(Service *s, int fd, struct Socket *socket); +int service_set_socket_fd(Service *s, int fd, struct Socket *socket, bool selinux_context_net); const char* service_state_to_string(ServiceState i) _const_; ServiceState service_state_from_string(const char *s) _pure_; --- src/core/socket.c +++ src/core/socket.c 2014-09-24 09:13:29.698735735 +0000 @@ -453,7 +453,8 @@ static void socket_dump(Unit *u, FILE *f "%sBroadcast: %s\n" "%sPassCredentials: %s\n" "%sPassSecurity: %s\n" - "%sTCPCongestion: %s\n", + "%sTCPCongestion: %s\n" + "%sSELinuxContextFromNet: %s\n", prefix, socket_state_to_string(s->state), prefix, socket_result_to_string(s->result), prefix, socket_address_bind_ipv6_only_to_string(s->bind_ipv6_only), @@ -466,7 +467,8 @@ static void socket_dump(Unit *u, FILE *f prefix, yes_no(s->broadcast), prefix, yes_no(s->pass_cred), prefix, yes_no(s->pass_sec), - prefix, strna(s->tcp_congestion)); + prefix, strna(s->tcp_congestion), + prefix, yes_no(s->selinux_context_from_net)); if (s->control_pid > 0) fprintf(f, @@ -1000,7 +1002,12 @@ static int socket_open_fds(Socket *s) { if (p->type == SOCKET_SOCKET) { - if (!know_label) { + if (!know_label && s->selinux_context_from_net) { + r = label_get_our_label(&label); + if (r < 0) + return r; + know_label = true; + } else if (!know_label) { if ((r = socket_instantiate_service(s)) < 0) return r; @@ -1247,6 +1254,7 @@ static int socket_spawn(Socket *s, ExecC true, true, UNIT(s)->manager->confirm_spawn, + s->selinux_context_from_net, UNIT(s)->manager->cgroup_supported, UNIT(s)->cgroup_path, UNIT(s)->id, @@ -1568,7 +1576,7 @@ static void socket_enter_running(Socket unit_choose_id(UNIT(service), name); - r = service_set_socket_fd(service, cfd, s); + r = service_set_socket_fd(service, cfd, s, s->selinux_context_from_net); if (r < 0) goto fail; --- src/core/socket.h +++ src/core/socket.h 2014-09-23 15:55:17.000000000 +0000 @@ -154,6 +154,8 @@ struct Socket { char *smack; char *smack_ip_in; char *smack_ip_out; + + bool selinux_context_from_net; }; /* Called from the service code when collecting fds */ --- src/core/swap.c +++ src/core/swap.c 2014-09-24 09:17:18.438735618 +0000 @@ -642,6 +642,7 @@ static int swap_spawn(Swap *s, ExecComma true, true, UNIT(s)->manager->confirm_spawn, + false, UNIT(s)->manager->cgroup_supported, UNIT(s)->cgroup_path, UNIT(s)->id, --- src/shared/label.c +++ src/shared/label.c 2014-09-23 00:00:00.000000000 +0000 @@ -31,6 +31,7 @@ #ifdef HAVE_SELINUX #include <selinux/selinux.h> #include <selinux/label.h> +#include <selinux/context.h> #endif #include "label.h" @@ -41,6 +42,12 @@ #include "smack-util.h" #ifdef HAVE_SELINUX +DEFINE_TRIVIAL_CLEANUP_FUNC(security_context_t, freecon); +DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free); + +#define _cleanup_security_context_free_ _cleanup_(freeconp) +#define _cleanup_context_free_ _cleanup_(context_freep) + static struct selabel_handle *label_hnd = NULL; #endif @@ -243,6 +250,112 @@ fail: return r; } +int label_get_our_label(char **label) { + int r = -EOPNOTSUPP; + char *l = NULL; + +#ifdef HAVE_SELINUX + r = getcon(&l); + if (r < 0) + return r; + + *label = l; +#endif + + return r; +} + +int label_get_child_mls_label(int socket_fd, const char *exe, char **label) { + int r = -EOPNOTSUPP; + +#ifdef HAVE_SELINUX + + _cleanup_security_context_free_ security_context_t mycon = NULL, peercon = NULL, fcon = NULL, ret = NULL; + _cleanup_context_free_ context_t pcon = NULL, bcon = NULL; + security_class_t sclass; + + const char *range = NULL; + + assert(socket_fd >= 0); + assert(exe); + assert(label); + + r = getcon(&mycon); + if (r < 0) { + r = -EINVAL; + goto out; + } + + r = getpeercon(socket_fd, &peercon); + if (r < 0) { + r = -EINVAL; + goto out; + } + + r = getexeccon(&fcon); + if (r < 0) { + r = -EINVAL; + goto out; + } + + if (!fcon) { + /* If there is no context set for next exec let's use context + of target executable */ + r = getfilecon(exe, &fcon); + if (r < 0) { + r = -errno; + goto out; + } + } + + bcon = context_new(mycon); + if (!bcon) { + r = -ENOMEM; + goto out; + } + + pcon = context_new(peercon); + if (!pcon) { + r = -ENOMEM; + goto out; + } + + range = context_range_get(pcon); + if (!range) { + r = -errno; + goto out; + } + + r = context_range_set(bcon, range); + if (r) { + r = -errno; + goto out; + } + + freecon(mycon); + mycon = context_str(bcon); + if (!mycon) { + r = -errno; + goto out; + } + + sclass = string_to_security_class("process"); + r = security_compute_create(mycon, fcon, sclass, &ret); + if (r < 0) { + r = -EINVAL; + goto out; + } + + *label = ret; + r = 0; + +out: + if (r < 0 && security_getenforce() == 1) + return r; +#endif + return r; +} + int label_context_set(const char *path, mode_t mode) { int r = 0; --- src/shared/label.h +++ src/shared/label.h 2014-09-23 00:00:00.000000000 +0000 @@ -40,6 +40,8 @@ void label_context_clear(void); void label_free(const char *label); int label_get_create_label_from_exe(const char *exe, char **label); +int label_get_our_label(char **label); +int label_get_child_mls_label(int socket_fd, const char *exec, char **label); int label_mkdir(const char *path, mode_t mode); ++++++ 0001-strv-add-an-additional-overflow-check-when-enlarging.patch ++++++ Based on 97569e154b80541cbad39d78231b7f360d4ff058 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 21 Oct 2014 14:01:28 +0200 Subject: [PATCH] strv: add an additional overflow check when enlarging strv()s https://bugs.freedesktop.org/show_bug.cgi?id=76745 --- src/shared/strv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- src/shared/strv.c +++ src/shared/strv.c 2014-10-23 00:00:00.000000000 +0000 @@ -361,13 +361,19 @@ char *strv_join_quoted(char **l) { int strv_push(char ***l, char *value) { char **c; - unsigned n; + unsigned n, m; if (!value) return 0; n = strv_length(*l); - c = realloc(*l, sizeof(char*) * (n + 2)); + + /* increase and check for overflow */ + m = n + 2; + if (m < n) + return -ENOMEM; + + c = realloc(*l, sizeof(char*) * (size_t) m); if (!c) return -ENOMEM; ++++++ 0001-systemctl-Correct-error-message-printed-when-bus_pro.patch ++++++
From 498cfc230af8f83675be2e92057956f1792969e4 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Date: Sat, 23 Aug 2014 21:11:44 +0200 Subject: [PATCH] systemctl: Correct error message printed when bus_process_wait fails
Actually use the variable containing the return code of bus_process_wait when printing the error message as a result of it failing. --- src/systemctl/systemctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c index d9b8bee..6534819 100644 --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c @@ -2382,7 +2382,7 @@ static int wait_for_jobs(sd_bus *bus, Set *s) { while (!set_isempty(s)) { q = bus_process_wait(bus); if (q < 0) { - log_error("Failed to wait for response: %s", strerror(-r)); + log_error("Failed to wait for response: %s", strerror(-q)); return q; } -- 1.7.9.2 ++++++ 0001-systemctl-allow-to-change-the-default-target-without.patch ++++++
From a1484a216e79da1fa7e2323095fb1b7203fb7a17 Mon Sep 17 00:00:00 2001 From: Djalal Harouni <tixxdz@opendz.org> Date: Mon, 14 Apr 2014 01:07:52 +0100 Subject: [PATCH] systemctl: allow to change the default target without the --force switch
Currently "systemctl set-default" will fail to change the default target due to the 'default.target' being a symlink which is always the case. To work around this, the user must specify the "--force" switch to be able to overwrite the existing symlink. This is clearly a regression that was introduced by commit 718db96199e since it worked before without the "--force" switch and the man pages do not mention that you need to specify it. It is expected that this is a symlink. So just explicity set the force flag to make it work again. https://bugs.freedesktop.org/show_bug.cgi?id=76623 Reported-by: <code@progandy.de> --- src/systemctl/systemctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c index ee0938f..1b381f7 100644 --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c @@ -1968,7 +1968,7 @@ static int set_default(sd_bus *bus, char **args) { return log_oom(); if (!bus || avoid_bus()) { - r = unit_file_set_default(arg_scope, arg_root, unit, arg_force, &changes, &n_changes); + r = unit_file_set_default(arg_scope, arg_root, unit, true, &changes, &n_changes); if (r < 0) { log_error("Failed to set default target: %s", strerror(-r)); return r; @@ -1990,7 +1990,7 @@ static int set_default(sd_bus *bus, char **args) { "SetDefaultTarget", &error, &reply, - "sb", unit, arg_force); + "sb", unit, true); if (r < 0) { log_error("Failed to set default target: %s", bus_error_message(&error, -r)); return r; -- 1.7.9.2 ++++++ 0001-systemctl-let-list-units-unit-files-honour-type.patch ++++++ Based on 6c71341aeecc3d092ed90f66e1b2c481b8e260ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Wed, 29 Oct 2014 22:46:30 -0400 Subject: [PATCH] systemctl: let list-{units,unit-files } honour --type The docs don't clarify what is expected, but I don't see any reason why --type should be ignored. Also restucture the compund conditions into separate clauses for easier reading. --- src/systemctl/systemctl.c | 48 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c 2014-11-18 00:00:00.000000000 +0000 @@ -305,21 +305,37 @@ static int compare_unit_info(const void } static bool output_show_unit(const UnitInfo *u, char **patterns) { - const char *dot; - if (!strv_isempty(patterns)) { char **pattern; STRV_FOREACH(pattern, patterns) if (fnmatch(*pattern, u->id, FNM_NOESCAPE) == 0) - return true; + goto next; return false; } - return (!arg_types || ((dot = strrchr(u->id, '.')) && - strv_find(arg_types, dot+1))) && - (arg_all || !(streq(u->active_state, "inactive") - || u->following[0]) || u->job_id > 0); +next: + if (arg_types) { + const char *dot; + + dot = strrchr(u->id, '.'); + if (!dot) + return false; + + if (!strv_find(arg_types, dot+1)) + return false; + } + + if (arg_all) + return true; + + if (u->job_id > 0) + return true; + + if (streq(u->active_state, "inactive") || u->following[0]) + return false; + + return true; } static void output_units_list(const UnitInfo *unit_infos, unsigned c) { @@ -1019,18 +1035,28 @@ static int compare_unit_file_list(const } static bool output_show_unit_file(const UnitFileList *u, char **patterns) { - const char *dot; - if (!strv_isempty(patterns)) { char **pattern; STRV_FOREACH(pattern, patterns) if (fnmatch(*pattern, basename(u->path), FNM_NOESCAPE) == 0) - return true; + goto next; return false; } - return !arg_types || ((dot = strrchr(u->path, '.')) && strv_find(arg_types, dot+1)); +next: + if (!strv_isempty(arg_types)) { + const char *dot; + + dot = strrchr(u->path, '.'); + if (!dot) + return false; + + if (!strv_find(arg_types, dot+1)) + return false; + } + + return true; } static void output_unit_file_list(const UnitFileList *units, unsigned c) { ++++++ 0001-systemctl-when-mangle-unit-names-for-the-isolate-suf.patch ++++++
From 08073121d8171f8e6be27b0c80e2ec283064760e Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 13 Oct 2014 15:43:09 +0200 Subject: [PATCH] systemctl: when mangle unit names for the "isolate", suffix with ".target" rather than ".service" by default
After all, we set AllowIsolate exclusively for target units so far, and this is more or less the only thing tht makes sense, hence also use ".target" as completion suffix by default. --- src/systemctl/systemctl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c index 842ca6c..af3cc97 100644 --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c @@ -2704,7 +2704,7 @@ static enum action verb_to_action(const char *verb) { static int start_unit(sd_bus *bus, char **args) { _cleanup_set_free_free_ Set *s = NULL; _cleanup_strv_free_ char **names = NULL; - const char *method, *mode, *one_name; + const char *method, *mode, *one_name, *suffix = NULL; char **name; int r = 0; @@ -2717,8 +2717,11 @@ static int start_unit(sd_bus *bus, char **args) { method = verb_to_method(args[0]); action = verb_to_action(args[0]); - mode = streq(args[0], "isolate") ? "isolate" : - action_table[action].mode ?: arg_job_mode; + if (streq(args[0], "isolate")) { + mode = "isolate"; + suffix = ".target"; + } else + mode = action_table[action].mode ?: arg_job_mode; one_name = action_table[action].target; } else { @@ -2734,7 +2737,7 @@ static int start_unit(sd_bus *bus, char **args) { if (one_name) names = strv_new(one_name, NULL); else { - r = expand_names(bus, args + 1, NULL, &names); + r = expand_names(bus, args + 1, suffix, &names); if (r < 0) log_error("Failed to expand names: %s", strerror(-r)); } -- 1.7.9.2 ++++++ 0001-systemd-continue-switch-root-even-if-umount-fails.patch ++++++ Based on d677d4df80e0ea1c66c691f50867fedd63c6770a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Thu, 16 Oct 2014 19:12:55 -0500 Subject: [PATCH] systemd: continue switch-root even if umount fails Leaving the old root around seems better than aborting the switch. --- src/core/main.c | 2 +- src/core/switch-root.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) --- src/core/main.c +++ src/core/main.c 2014-10-20 13:35:35.915837828 +0000 @@ -1848,7 +1848,7 @@ finish: /* And switch root */ r = switch_root(switch_root_dir); if (r < 0) - log_error("Failed to switch root, ignoring: %s", strerror(-r)); + log_error("Failed to switch root, trying to continue: %s", strerror(-r)); } args_size = MAX(6, argc+1); --- src/core/switch-root.c +++ src/core/switch-root.c 2014-10-20 13:39:58.167121460 +0000 @@ -68,10 +68,9 @@ int switch_root(const char *new_root) { goto fail; } - /* Work-around for a kernel bug: for some reason the kernel - * refuses switching root if any file systems are mounted - * MS_SHARED. Hence remount them MS_PRIVATE here as a - * work-around. + /* Work-around for kernel design: the kernel refuses switching + * root if any file systems are mounted MS_SHARED. Hence + * remount them MS_PRIVATE here as a work-around. * * https://bugzilla.redhat.com/show_bug.cgi?id=847418 */ if (mount(NULL, "/", NULL, MS_REC|MS_PRIVATE, NULL) < 0) @@ -124,8 +123,8 @@ int switch_root(const char *new_root) { * running off it we need to do this lazily. */ if (umount2("/mnt", MNT_DETACH) < 0) { r = -errno; - log_error("Failed to umount old root dir /mnt: %m"); - goto fail; + log_error("Failed to lazily umount old root dir /mnt, %s: %m", + errno == ENOENT ? "ignoring" : "leaving it around"); } } else if (mount(new_root, "/", NULL, MS_MOVE, NULL) < 0) { ++++++ 0001-systemd-detect-virt-detect-s390-virtualization.patch ++++++
From f41925b4e442a34c93ad120ef1426c974a047ed1 Mon Sep 17 00:00:00 2001 From: Thomas Blume <Thomas.Blume@suse.com> Date: Fri, 18 Jul 2014 09:13:36 -0400 Subject: [PATCH] systemd-detect-virt: detect s390 virtualization
A system that is running on a logical partition (LPAR) provided by PR/SM has access to physical hardware (except CPU). It is true that PR/SM abstracts the hardware, but only for sharing purposes. Details are statet at: http://publib.boulder.ibm.com/infocenter/eserver/v1r2/topic/eicaz/eicazzlpar... -->-- In other words, PR/SM transforms physical resources into virtual resources so that many logical partitions can share the same physical resources. --<-- Still, from the OS point of view, the shared virtual resource is real hardware. ConditionVirtualization must be set to false if the OS runs directly on PR/SM (e.g. in an LPAR). [zj: reorder code so that variables are not allocated when #if-def is false. Add commit message.] --- man/systemd.unit.xml | 1 + src/shared/virt.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git man/systemd.unit.xml man/systemd.unit.xml index 6447584..86a8cbb 100644 --- man/systemd.unit.xml +++ man/systemd.unit.xml @@ -996,6 +996,7 @@ virtualization solution, or one of <varname>qemu</varname>, <varname>kvm</varname>, + <varname>zvm</varname>, <varname>vmware</varname>, <varname>microsoft</varname>, <varname>oracle</varname>, diff --git src/shared/virt.c src/shared/virt.c index 20a8d7c..b436895 100644 --- src/shared/virt.c +++ src/shared/virt.c @@ -220,6 +220,23 @@ int detect_vm(const char **id) { goto finish; } +#if defined(__s390__) + { + _cleanup_free_ char *t = NULL; + + r = get_status_field("/proc/sysinfo", "VM00 Control Program:", &t); + if (r >= 0) { + if (streq(t, "z/VM")) + _id = "zvm"; + else + _id = "kvm"; + r = 1; + + goto finish; + } + } +#endif + r = 0; finish: -- 1.7.9.2 ++++++ 0001-systemd-tmpfiles-Fix-IGNORE_DIRECTORY_PATH-age-handl.patch ++++++
From 9ed2a35e93f4a9e82585f860f54cdcbbdf3e1f86 Mon Sep 17 00:00:00 2001 From: Richard Weinberger <richard@nod.at> Date: Tue, 9 Sep 2014 11:09:37 +0200 Subject: [PATCH] systemd-tmpfiles: Fix IGNORE_DIRECTORY_PATH age handling
If one has a config like: d /tmp 1777 root root - X /tmp/important_mount All files below /tmp/important_mount will be deleted as the /tmp/important_mount item will spuriously inherit a max age of 0 from /tmp. /tmp has a max age of 0 but age_set is (of course) false. This affects also the PrivateTmp feature of systemd. All tmp files of such services will be deleted unconditionally and can cause service failures and data loss. Fix this by checking ->age_set in the IGNORE_DIRECTORY_PATH logic. --- src/tmpfiles/tmpfiles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/tmpfiles/tmpfiles.c src/tmpfiles/tmpfiles.c index f9830c4..7eafd6b 100644 --- src/tmpfiles/tmpfiles.c +++ src/tmpfiles/tmpfiles.c @@ -1576,7 +1576,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) { candidate_item = j; } - if (candidate_item) { + if (candidate_item && candidate_item->age_set) { i->age = candidate_item->age; i->age_set = true; } -- 1.7.9.2 ++++++ 0001-sysv-order-initscripts-which-provide-network-before-.patch ++++++ Based on 805b573fad06b845502e76f3db3a0efa7583149d Mon Sep 17 00:00:00 2001 From: Lukas Nykryn <lnykryn@redhat.com> Date: Wed, 23 Jul 2014 12:49:14 +0200 Subject: [PATCH] sysv: order initscripts which provide $network before network.target Due to recent changes where $network "maps" to network-online.target it is not guaranteed that initscript which provides networking will be terminated after network.target during shutdown which is against LSB. --- src/core/service.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- src/core/service.c +++ src/core/service.c 2014-07-30 11:27:16.074235995 +0000 @@ -820,7 +820,7 @@ static int service_load_sysv_path(Servic if (unit_name_to_type(m) == UNIT_SERVICE) r = unit_merge_by_name(u, m); - else + else { /* NB: SysV targets * which are provided * by a service are @@ -835,6 +835,9 @@ static int service_load_sysv_path(Servic * in the SysV * services! */ r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, UNIT_WANTS, m, NULL, true); + if (r >= 0 && streq(m, SPECIAL_NETWORK_ONLINE_TARGET)) + r = unit_add_dependency_by_name(u, UNIT_BEFORE, SPECIAL_NETWORK_TARGET, NULL, true); + } if (r < 0) log_error_unit(u->id, ++++++ 0001-tmpfiles-compare-return-against-correct-errno.patch ++++++
From e7aab5412829ed6b50d109f670bd0b1b365838a7 Mon Sep 17 00:00:00 2001 From: Dave Reisner <dreisner@archlinux.org> Date: Sat, 11 Oct 2014 20:35:06 -0400 Subject: [PATCH] tmpfiles: compare return against correct errno
name_to_handle_at returns -EOPNOTSUPP, not -ENOTSUP. --- src/tmpfiles/tmpfiles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/tmpfiles/tmpfiles.c src/tmpfiles/tmpfiles.c index dafb9ae..8108b43 100644 --- src/tmpfiles/tmpfiles.c +++ src/tmpfiles/tmpfiles.c @@ -259,7 +259,7 @@ static int dir_is_mount_point(DIR *d, const char *subdir) { /* got only one handle; assume different mount points if one * of both queries was not supported by the filesystem */ - if (r_p == -ENOSYS || r_p == -ENOTSUP || r == -ENOSYS || r == -ENOTSUP) + if (r_p == -ENOSYS || r_p == -EOPNOTSUPP || r == -ENOSYS || r == -EOPNOTSUPP) return true; /* return error */ -- 1.7.9.2 ++++++ 0001-tmpfiles-fix-permissions-on-new-journal-files.patch ++++++
From a606871da508995f5ede113a8fc6538afd98966c Mon Sep 17 00:00:00 2001 From: Greg KH <gregkh@linuxfoundation.org> Date: Tue, 15 Apr 2014 14:12:01 -0700 Subject: [PATCH] tmpfiles: fix permissions on new journal files
When starting up journald on a new system, set the proper permissions on the system.journal files, not only on the journal directory. --- tmpfiles.d/systemd.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git tmpfiles.d/systemd.conf tmpfiles.d/systemd.conf index 7c6d6b9..c470045 100644 --- tmpfiles.d/systemd.conf +++ tmpfiles.d/systemd.conf @@ -23,6 +23,6 @@ d /run/systemd/machines 0755 root root - d /run/systemd/shutdown 0755 root root - m /var/log/journal 2755 root systemd-journal - - -m /var/log/journal/%m 2755 root systemd-journal - - +Z /var/log/journal/%m 2755 root systemd-journal - - m /run/log/journal 2755 root systemd-journal - - -m /run/log/journal/%m 2755 root systemd-journal - - +Z /run/log/journal/%m 2755 root systemd-journal - - -- 1.7.9.2 ++++++ 0001-umount-modernizations.patch ++++++
From c3544e8d2c2d870a2aff0944aff4ab7824b9ae6b Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 5 Jun 2014 21:35:15 +0200 Subject: [PATCH] umount: modernizations
--- src/core/umount.c | 65 ++++++++++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git src/core/umount.c src/core/umount.c index d1258f0..a30f674 100644 --- src/core/umount.c +++ src/core/umount.c @@ -61,52 +61,46 @@ static void mount_points_list_free(MountPoint **head) { } static int mount_points_list_get(MountPoint **head) { - FILE *proc_self_mountinfo; - char *path, *p; + _cleanup_fclose_ FILE *proc_self_mountinfo = NULL; unsigned int i; - int r; assert(head); - if (!(proc_self_mountinfo = fopen("/proc/self/mountinfo", "re"))) + proc_self_mountinfo = fopen("/proc/self/mountinfo", "re"); + if (!proc_self_mountinfo) return -errno; for (i = 1;; i++) { - int k; + _cleanup_free_ char *path = NULL; + char *p = NULL; MountPoint *m; + int k; - path = p = NULL; - - if ((k = fscanf(proc_self_mountinfo, - "%*s " /* (1) mount id */ - "%*s " /* (2) parent id */ - "%*s " /* (3) major:minor */ - "%*s " /* (4) root */ - "%ms " /* (5) mount point */ - "%*s" /* (6) mount options */ - "%*[^-]" /* (7) optional fields */ - "- " /* (8) separator */ - "%*s " /* (9) file system type */ - "%*s" /* (10) mount source */ - "%*s" /* (11) mount options 2 */ - "%*[^\n]", /* some rubbish at the end */ - &path)) != 1) { + k = fscanf(proc_self_mountinfo, + "%*s " /* (1) mount id */ + "%*s " /* (2) parent id */ + "%*s " /* (3) major:minor */ + "%*s " /* (4) root */ + "%ms " /* (5) mount point */ + "%*s" /* (6) mount options */ + "%*[^-]" /* (7) optional fields */ + "- " /* (8) separator */ + "%*s " /* (9) file system type */ + "%*s" /* (10) mount source */ + "%*s" /* (11) mount options 2 */ + "%*[^\n]", /* some rubbish at the end */ + &path); + if (k != 1) { if (k == EOF) break; log_warning("Failed to parse /proc/self/mountinfo:%u.", i); - - free(path); continue; } p = cunescape(path); - free(path); - - if (!p) { - r = -ENOMEM; - goto finish; - } + if (!p) + return -ENOMEM; /* Ignore mount points we can't unmount because they * are API or because we are keeping them open (like @@ -118,22 +112,17 @@ static int mount_points_list_get(MountPoint **head) { continue; } - if (!(m = new0(MountPoint, 1))) { + m = new0(MountPoint, 1); + if (!m) { free(p); - r = -ENOMEM; - goto finish; + return -ENOMEM; } m->path = p; LIST_PREPEND(mount_point, *head, m); } - r = 0; - -finish: - fclose(proc_self_mountinfo); - - return r; + return 0; } static int swap_list_get(MountPoint **head) { -- 1.7.9.2 ++++++ 0001-units-introduce-network-pre.target-as-place-to-hook-.patch ++++++
From a4a878d04045b46fa9783664e3643a890b356790 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 11 Jun 2014 11:33:02 +0200 Subject: [PATCH] units: introduce network-pre.target as place to hook in firewalls
network-pre.target is a passive target that should be pulled in by services that want to be executed before any network is configured (for example: firewall scrips). network-pre.target should be ordered before all network managemet services (but not be pulled in by them). network-pre.target should be order after all services that want to be executed before any network is configured (and be pulled in by them). --- Makefile.am | 1 + man/systemd.special.xml | 15 +++++++++++++++ units/local-fs.target | 2 -- units/network-pre.target | 12 ++++++++++++ units/network.target | 2 ++ units/systemd-networkd.service.in | 2 +- 6 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 units/network-pre.target diff --git Makefile.am Makefile.am index 3ea95e9..8514ec9 100644 --- Makefile.am +++ Makefile.am @@ -413,6 +413,7 @@ dist_systemunit_DATA = \ units/remote-fs.target \ units/remote-fs-pre.target \ units/network.target \ + units/network-pre.target \ units/network-online.target \ units/nss-lookup.target \ units/nss-user-lookup.target \ diff --git man/systemd.special.xml man/systemd.special.xml index 38b94a7..cda6edd 100644 --- man/systemd.special.xml +++ man/systemd.special.xml @@ -72,6 +72,7 @@ <filename>multi-user.target</filename>, <filename>network.target</filename>, <filename>network-online.target</filename>, + <filename>network-pre.target</filename>, <filename>nss-lookup.target</filename>, <filename>nss-user-lookup.target</filename>, <filename>paths.target</filename>, @@ -891,6 +892,20 @@ </listitem> </varlistentry> <varlistentry> + <term><filename>network-pre.target</filename></term> + <listitem> + <para>This passive target unit + may be pulled in by services + that want to run before any + network is set up, for example + for the purpose of setting up a + firewall. All network + management software orders + itself after this target, but + does not pull it in.</para> + </listitem> + </varlistentry> + <varlistentry> <term><filename>nss-lookup.target</filename></term> <listitem> <para>A target that should be diff --git units/local-fs.target units/local-fs.target index ae3cedc..70cb13f 100644 --- units/local-fs.target +++ units/local-fs.target @@ -9,7 +9,5 @@ Description=Local File Systems Documentation=man:systemd.special(7) After=local-fs-pre.target -DefaultDependencies=no -Conflicts=shutdown.target OnFailure=emergency.target OnFailureJobMode=replace-irreversibly diff --git units/network-pre.target units/network-pre.target new file mode 100644 index 0000000..0ea4bc7 --- /dev/null +++ units/network-pre.target @@ -0,0 +1,12 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Network (Pre) +Documentation=man:systemd.special(7) +Documentation=http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget +RefuseManualStart=yes diff --git units/network.target units/network.target index 65fc64b..61ebdca 100644 --- units/network.target +++ units/network.target @@ -9,3 +9,5 @@ Description=Network Documentation=man:systemd.special(7) Documentation=http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget +After=network-pre.target +RefuseManualStart=yes diff --git units/systemd-networkd.service.in units/systemd-networkd.service.in index 373ac4e..48f4d63 100644 --- units/systemd-networkd.service.in +++ units/systemd-networkd.service.in @@ -9,7 +9,7 @@ Description=Network Service Documentation=man:systemd-networkd.service(8) DefaultDependencies=no -After=dbus.service +After=dbus.service network-pre.target Before=network.target Wants=network.target ConditionCapability=CAP_NET_ADMIN -- 1.7.9.2 ++++++ 0001-units-make-ExecStopPost-action-part-of-ExecStart.patch ++++++ Based on d3381512282f2ca1c7669f77fb736a90fdce6982 Mon Sep 17 00:00:00 2001 From: Michal Sekletar <msekleta@redhat.com> Date: Tue, 8 Jul 2014 17:42:23 +0200 Subject: [PATCH] units: make ExecStopPost action part of ExecStart Currently after exiting rescue shell we isolate default target. User might want to isolate to some other target than default one. However issuing systemctl isolate command to desired target would bring system to default target as a consequence of running ExecStopPost action. Having common ancestor for rescue shell and possible followup systemctl default command should fix this. If user exits rescue shell we will proceed with isolating default target, otherwise, on manual isolate, parent shell process is terminated and we don't isolate default target, but target chosen by user. Suggested-by: Michal Schmidt <mschmidt@redhat.com> --- units/emergency.service.in | 3 +-- units/rescue.service.m4.in | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) --- units/emergency.service.in +++ units/emergency.service.in 2014-07-10 13:31:50.662235825 +0000 @@ -18,8 +18,7 @@ WorkingDirectory=/root ExecStartPre=-/usr/bin/plymouth quit ExecStartPre=-/usr/bin/plymouth --wait ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" to try again\\nto boot into default mode.' -ExecStart=-/usr/sbin/sulogin -ExecStopPost=@SYSTEMCTL@ --fail --no-block default +ExecStart=-/bin/sh -c "/usr/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default" Type=idle StandardInput=tty-force StandardOutput=inherit --- units/rescue.service.m4.in +++ units/rescue.service.m4.in 2014-07-10 13:32:15.678235509 +0000 @@ -19,8 +19,7 @@ WorkingDirectory=/root ExecStartPre=-/usr/bin/plymouth quit ExecStartPre=-/usr/bin/plymouth --wait ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.' -ExecStart=-/usr/sbin/sulogin -ExecStopPost=-@SYSTEMCTL@ --fail --no-block default +ExecStart=-/bin/sh -c "/usr/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default" Type=idle StandardInput=tty-force StandardOutput=inherit ++++++ 0001-units-make-sure-rfkill-service-is-bount-to-the-actua.patch ++++++ Based on 812bd1e6ab4c463507557f2bdbb8875fedd92ade Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 21 Nov 2014 01:20:57 +0100 Subject: [PATCH] units: make sure rfkill service is bount to the actual hardware --- rules/99-systemd.rules.in | 2 +- units/systemd-rfkill@.service.in | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) --- rules/99-systemd.rules.in +++ rules/99-systemd.rules.in @@ -62,7 +62,7 @@ SUBSYSTEM=="leds", KERNEL=="*kbd_backlight", TAG+="systemd", IMPORT{builtin}="pa # Pull in rfkill save/restore for all rfkill devices -SUBSYSTEM=="rfkill", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="systemd-rfkill@$name.service" +SUBSYSTEM=="rfkill", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_ALIAS}+="/sys/subsystem/rfkill/devices/%k", ENV{SYSTEMD_WANTS}+="systemd-rfkill@$name.service" # Asynchronously mount file systems implemented by these modules as # soon as they are loaded. --- units/systemd-rfkill@.service.in +++ units/systemd-rfkill@.service.in 2014-12-05 11:52:59.433518948 +0000 @@ -9,6 +9,7 @@ Description=Load/Save RF Kill Switch Status of %I Documentation=man:systemd-rfkill@.service(8) DefaultDependencies=no +BindsTo=sys-subsystem-rfkill-devices-%i.device RequiresMountsFor=/var/lib/systemd/rfkill Conflicts=shutdown.target After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service ++++++ 0001-units-order-network-online.target-after-network.targ.patch ++++++ Based on 58e027023b47b32e42cf93dd4a629b869ee1ef25 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 11 Jun 2014 14:58:32 +0200 Subject: [PATCH] units: order network-online.target after network.target There might be implementations around where the network-online logic might not talk to any network configuration service (and thus not have to wait for it), hence let's explicitly order network-online.target after network.target to avoid any ambiguities. --- units/network-online.target | 1 + 1 file changed, 1 insertion(+) --- units/network-online.target +++ units/network-online.target 2014-06-26 00:00:00.000000000 +0000 @@ -9,3 +9,4 @@ Description=Network is Online Documentation=man:systemd.special(7) Documentation=http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget +After=network.target ++++++ 0001-units-systemd-sysctl.service.in-run-after-load-modul.patch ++++++ Based on 0b73eab7a2185ae0377650e3fdb8208347a8a575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org> Date: Sat, 23 Mar 2013 03:54:16 +0100 Subject: [PATCH] units/systemd-sysctl.service.in: run after load-modules Modules might or will register new sysctl options. [zj: This mechanism of adding modules just to reliably set sysctl attributes is not ideal. Nevertheless, sysctl for dynamically created attributes is simply broken, and this is the easiest workaround.] https://bugzilla.redhat.com/show_bug.cgi?id=1022977 https://bugzilla.novell.com/show_bug.cgi?id=725412 --- units/systemd-sysctl.service.in | 1 + 1 file changed, 1 insertion(+) diff --git units/systemd-sysctl.service.in units/systemd-sysctl.service.in index 5c7c5d7..ade9dc3 100644 --- units/systemd-sysctl.service.in +++ units/systemd-sysctl.service.in @@ -11,6 +11,7 @@ Documentation=man:systemd-sysctl.service DefaultDependencies=no Conflicts=shutdown.target After=systemd-readahead-collect.service systemd-readahead-replay.service +After=systemd-modules-load.service Before=sysinit.target shutdown.target ConditionPathIsReadWrite=/proc/sys/ ConditionDirectoryNotEmpty=|/lib/sysctl.d ++++++ 0001-units-tmpfiles-setup-dev-allow-unsafe-file-creation-.patch ++++++
From 8c94052ee543c3598a3c7b0c46688150aa2c6168 Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Mon, 27 Oct 2014 17:15:42 +0100 Subject: [PATCH 1/2] units: tmpfiles-setup-dev - allow unsafe file creation to happen in /dev at boot
This will allow us to mark static device nodes with '!' to indicate that they should only be created at early boot. --- units/systemd-tmpfiles-setup-dev.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/units/systemd-tmpfiles-setup-dev.service.in b/units/systemd-tmpfiles-setup-dev.service.in index f3833fd..0123a03 100644 --- a/units/systemd-tmpfiles-setup-dev.service.in +++ b/units/systemd-tmpfiles-setup-dev.service.in @@ -17,4 +17,4 @@ ConditionCapability=CAP_SYS_MODULE [Service] Type=oneshot RemainAfterExit=yes -ExecStart=@rootbindir@/systemd-tmpfiles --prefix=/dev --create +ExecStart=@rootbindir@/systemd-tmpfiles --prefix=/dev --create --boot -- 2.1.2 ++++++ 0001-util-consider-0x7F-a-control-chracter-which-it-is-DE.patch ++++++
From 3a8a916338d8446b938f3cf40f6aae0c611892e3 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 7 Jul 2014 11:47:10 +0200 Subject: [PATCH] util: consider 0x7F a control chracter (which it is: DEL)
Let's better be safe than sorry. --- src/shared/util.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git src/shared/util.c src/shared/util.c index 3d875c7..d25ee66 100644 --- src/shared/util.c +++ src/shared/util.c @@ -1608,8 +1608,9 @@ int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) { return -ETIMEDOUT; } + errno = 0; if (!fgets(line, sizeof(line), f)) - return -EIO; + return errno ? -errno : -EIO; truncate_nl(line); @@ -5355,6 +5356,9 @@ bool string_is_safe(const char *p) { if (*t > 0 && *t < ' ') return false; + if (*t == 127) + return false; + if (strchr("\\\"\'", *t)) return false; } @@ -5371,10 +5375,14 @@ bool string_has_cc(const char *p) { assert(p); - for (t = p; *t; t++) + for (t = p; *t; t++) { if (*t > 0 && *t < ' ' && *t != '\t') return true; + if (*t == 127) + return true; + } + return false; } -- 1.7.9.2 ++++++ 0001-vconsole-also-copy-character-maps-not-just-fonts-fro.patch ++++++
From ff452e76e2c0f89a32542b7179bb2fd538335933 Mon Sep 17 00:00:00 2001 From: Carl Schaefer <schaefer@trilug.org> Date: Mon, 23 Jun 2014 18:23:48 +0200 Subject: [PATCH] vconsole: also copy character maps (not just fonts) from vt1 to vt2, vt3, ...
https://bugs.freedesktop.org/show_bug.cgi?id=78796 --- src/vconsole/vconsole-setup.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git src/vconsole/vconsole-setup.c src/vconsole/vconsole-setup.c index 0f2b706..e0c4050 100644 --- src/vconsole/vconsole-setup.c +++ src/vconsole/vconsole-setup.c @@ -180,6 +180,10 @@ static int font_load(const char *vc, const char *font, const char *map, const ch */ static void font_copy_to_all_vcs(int fd) { struct vt_stat vcs = {}; + unsigned char map8[E_TABSZ]; + unsigned short map16[E_TABSZ]; + struct unimapdesc unimapd; + struct unipair unipairs[USHRT_MAX]; int i, r; /* get active, and 16 bit mask of used VT numbers */ @@ -209,6 +213,26 @@ static void font_copy_to_all_vcs(int fd) { cfo.op = KD_FONT_OP_COPY; cfo.height = vcs.v_active-1; /* tty1 == index 0 */ ioctl(vcfd, KDFONTOP, &cfo); + + /* copy map of 8bit chars */ + if (ioctl(fd, GIO_SCRNMAP, map8) >= 0) + ioctl(vcfd, PIO_SCRNMAP, map8); + + /* copy map of 8bit chars -> 16bit Unicode values */ + if (ioctl(fd, GIO_UNISCRNMAP, map16) >= 0) + ioctl(vcfd, PIO_UNISCRNMAP, map16); + + /* copy unicode translation table */ + /* unimapd is a ushort count and a pointer to an + array of struct unipair { ushort, ushort } */ + unimapd.entries = unipairs; + unimapd.entry_ct = USHRT_MAX; + if (ioctl(fd, GIO_UNIMAP, &unimapd) >= 0) { + struct unimapinit adv = { 0, 0, 0 }; + + ioctl(vcfd, PIO_UNIMAPCLR, &adv); + ioctl(vcfd, PIO_UNIMAP, &unimapd); + } } } -- 1.7.9.2 ++++++ 0001-virt-detect-that-we-are-running-inside-the-docker-co.patch ++++++
From 893e72da6b27c21b102e1589276e651e9e4f591c Mon Sep 17 00:00:00 2001 From: Michal Sekletar <msekleta@redhat.com> Date: Tue, 9 Sep 2014 18:14:25 +0200 Subject: [PATCH] virt: detect that we are running inside the docker container
--- src/shared/virt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git src/shared/virt.c src/shared/virt.c index b436895..f9c4e67 100644 --- src/shared/virt.c +++ src/shared/virt.c @@ -310,6 +310,8 @@ int detect_container(const char **id) { _id = "lxc-libvirt"; else if (streq(e, "systemd-nspawn")) _id = "systemd-nspawn"; + else if (streq(e, "docker")) + _id = "docker"; else _id = "other"; -- 1.7.9.2 ++++++ 0001-virt-rework-container-detection-logic.patch ++++++ Based on fdd25311706bd32580ec4d43211cdf4665d2f9de Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 28 May 2014 18:37:11 +0800 Subject: [PATCH] virt: rework container detection logic Instead of accessing /proc/1/environ directly, trying to read the $container variable from it, let's make PID 1 save the contents of that variable to /run/systemd/container. This allows us to detect containers without the need for CAP_SYS_PTRACE, which allows us to drop it from a number of daemons and from the file capabilities of systemd-detect-virt. Also, don't consider chroot a container technology anymore. After all, we don't consider file system namespaces container technology anymore, and hence chroot() should be considered a container even less. --- Makefile.am | 3 --- configure.ac | 2 -- src/core/main.c | 12 ++++++++++++ src/shared/virt.c | 48 ++++++++++++++++++++++++++++++------------------ 4 files changed, 42 insertions(+), 23 deletions(-) diff --git Makefile.am Makefile.am index 5b26bc3..f66ef42 100644 --- Makefile.am +++ Makefile.am @@ -1798,9 +1798,6 @@ systemd_detect_virt_SOURCES = \ systemd_detect_virt_LDADD = \ libsystemd-shared.la -systemd-detect-virt-install-hook: - -$(SETCAP) cap_dac_override,cap_sys_ptrace=ep $(DESTDIR)$(bindir)/systemd-detect-virt - INSTALL_EXEC_HOOKS += \ systemd-detect-virt-install-hook --- configure.ac +++ configure.ac 2014-06-03 14:16:45.046237826 +0000 @@ -68,8 +68,6 @@ AC_PATH_PROG([XSLTPROC], [xsltproc]) AC_PATH_PROG([QUOTAON], [quotaon], [/usr/sbin/quotaon]) AC_PATH_PROG([QUOTACHECK], [quotacheck], [/usr/sbin/quotacheck]) -AC_PATH_PROG([SETCAP], [setcap], [/usr/sbin/setcap]) - AC_PATH_PROG([KILL], [kill], [/usr/bin/kill]) AC_PATH_PROG([KMOD], [kmod], [/usr/bin/kmod]) diff --git src/core/main.c src/core/main.c index 77cc2fb..d5d1ee2 100644 --- src/core/main.c +++ src/core/main.c @@ -1261,6 +1261,16 @@ static int status_welcome(void) { isempty(pretty_name) ? "Linux" : pretty_name); } +static int write_container_id(void) { + const char *c; + + c = getenv("container"); + if (isempty(c)) + return 0; + + return write_string_file("/run/systemd/container", c); +} + int main(int argc, char *argv[]) { Manager *m = NULL; int r, retval = EXIT_FAILURE; @@ -1544,6 +1554,8 @@ int main(int argc, char *argv[]) { if (virtualization) log_info("Detected virtualization '%s'.", virtualization); + write_container_id(); + log_info("Detected architecture '%s'.", architecture_to_string(uname_architecture())); if (in_initrd()) diff --git src/shared/virt.c src/shared/virt.c index 0db0514..1e227c5 100644 --- src/shared/virt.c +++ src/shared/virt.c @@ -217,8 +217,8 @@ int detect_container(const char **id) { static thread_local int cached_found = -1; static thread_local const char *cached_id = NULL; - _cleanup_free_ char *e = NULL; - const char *_id = NULL; + _cleanup_free_ char *m = NULL; + const char *_id = NULL, *e = NULL; int r; if (_likely_(cached_found >= 0)) { @@ -229,17 +229,6 @@ int detect_container(const char **id) { return cached_found; } - /* Unfortunately many of these operations require root access - * in one way or another */ - - r = running_in_chroot(); - if (r < 0) - return r; - if (r > 0) { - _id = "chroot"; - goto finish; - } - /* /proc/vz exists in container and outside of the container, * /proc/bc only outside of the container. */ if (access("/proc/vz", F_OK) >= 0 && @@ -249,11 +238,32 @@ int detect_container(const char **id) { goto finish; } - r = getenv_for_pid(1, "container", &e); - if (r < 0) - return r; - if (r == 0) - goto finish; + if (getpid() == 1) { + /* If we are PID 1 we can just check our own + * environment variable */ + + e = getenv("container"); + if (isempty(e)) { + r = 0; + goto finish; + } + } else { + + /* Otherwise, PID 1 dropped this information into a + * file in /run. This is better than accessing + * /proc/1/environ, since we don't need CAP_SYS_PTRACE + * for that. */ + + r = read_one_line_file("/run/systemd/container", &m); + if (r == -ENOENT) { + r = 0; + goto finish; + } + if (r < 0) + return r; + + e = m; + } /* We only recognize a selected few here, since we want to * enforce a redacted namespace */ @@ -266,6 +276,8 @@ int detect_container(const char **id) { else _id = "other"; + r = 1; + finish: cached_found = r; -- 1.7.9.2 ++++++ 0002-Add-hwdb-entry-for-Samsung-Series-7-Ultra.patch ++++++
From 15f392394e75ffb7f318920008fd1bbe4e82b488 Mon Sep 17 00:00:00 2001 From: Scott Thrasher <scott.thrasher@gmail.com> Date: Wed, 26 Mar 2014 18:48:13 -0700 Subject: [PATCH] Add hwdb entry for Samsung Series 7 Ultra
--- hwdb/60-keyboard.hwdb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index bd8fd10..832c686 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -924,6 +924,14 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*90X3A*:pvr* KEYBOARD_KEY_96=!kbdillumup # Fn+F8 keyboard backlight up KEYBOARD_KEY_d5=!wlan # Fn+F12 Wi-Fi toggle +# Series 7 Ultra +keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*7[34]0U3E*:pvr* + KEYBOARD_KEY_ce=!prog1 # Fn+F1 launch settings + KEYBOARD_KEY_97=!kbdillumdown # Fn+F9 keyboard backlight down + KEYBOARD_KEY_96=!kbdillumup # Fn+F10 keyboard backlight up + KEYBOARD_KEY_b3=!prog3 # Fn+F11 fan/cooling mode changer + KEYBOARD_KEY_d5=!wlan # Fn+F12 wlan/airplane switch + # SQ1US keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pnSQ1US:pvr* KEYBOARD_KEY_d4=menu -- 1.7.9.2 ++++++ 0002-Be-more-verbose-when-bind-or-listen-fails.patch ++++++ Based on 6b9732b2bf0499c5e4ea8a9d4f6051d98033f680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Mon, 3 Mar 2014 19:49:40 -0500 Subject: [PATCH] Be more verbose when bind or listen fails Also be more verbose in devnode_acl_all(). --- src/core/manager.c | 2 +- src/journal/journald-native.c | 2 +- src/journal/journald-stream.c | 4 ++-- src/journal/journald-syslog.c | 2 +- src/login/logind-acl.c | 5 ++++- src/shared/ask-password-api.c | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) --- src/core/manager.c +++ src/core/manager.c 2014-07-21 10:57:20.286367050 +0000 @@ -571,7 +571,7 @@ static int manager_setup_notify(Manager r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1)); if (r < 0) { - log_error("bind() failed: %m"); + log_error("bind(@%s) failed: %m", sa.un.sun_path+1); return -errno; } --- src/journal/journald-native.c +++ src/journal/journald-native.c 2014-07-21 00:00:00.000000000 +0000 @@ -405,7 +405,7 @@ int server_open_native_socket(Server*s) r = bind(s->native_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path)); if (r < 0) { - log_error("bind() failed: %m"); + log_error("bind(%s) failed: %m", sa.un.sun_path); return -errno; } --- src/journal/journald-stream.c +++ src/journal/journald-stream.c 2014-07-21 00:00:00.000000000 +0000 @@ -447,14 +447,14 @@ int server_open_stdout_socket(Server *s) r = bind(s->stdout_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path)); if (r < 0) { - log_error("bind() failed: %m"); + log_error("bind(%s) failed: %m", sa.un.sun_path); return -errno; } chmod(sa.un.sun_path, 0666); if (listen(s->stdout_fd, SOMAXCONN) < 0) { - log_error("listen() failed: %m"); + log_error("listen(%s) failed: %m", sa.un.sun_path); return -errno; } } else --- src/journal/journald-syslog.c +++ src/journal/journald-syslog.c 2014-07-21 00:00:00.000000000 +0000 @@ -437,7 +437,7 @@ int server_open_syslog_socket(Server *s) r = bind(s->syslog_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path)); if (r < 0) { - log_error("bind() failed: %m"); + log_error("bind(%s) failed: %m", sa.un.sun_path); return -errno; } --- src/login/logind-acl.c +++ src/login/logind-acl.c 2014-07-21 10:59:04.986235573 +0000 @@ -277,7 +277,10 @@ int devnode_acl_all(struct udev *udev, SET_FOREACH(n, nodes, i) { int k; - log_debug("Fixing up ACLs at %s for seat %s", n, seat); + log_debug("Changing ACLs at %s for seat %s (uid "UID_FMT"→"UID_FMT"%s%s)", + n, seat, old_uid, new_uid, + del ? " del" : "", add ? " add" : ""); + k = devnode_acl(n, flush, del, old_uid, add, new_uid); if (k < 0) r = k; --- src/shared/ask-password-api.c +++ src/shared/ask-password-api.c 2014-07-21 00:00:00.000000000 +0000 @@ -275,7 +275,7 @@ static int create_socket(char **name) { if (r < 0) { r = -errno; - log_error("bind() failed: %m"); + log_error("bind(%s) failed: %m", sa.un.sun_path); goto fail; } ++++++ 0002-analyze-avoid-a-null-dereference.patch ++++++
From d725a138c5c311ba06567d6841933aa5b7b6a435 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Thu, 11 Sep 2014 23:41:44 +0200 Subject: [PATCH] analyze: avoid a null dereference
If we have an error in the early sd_bus_* calls then unit_times will still be null. Found with coverity. Fixes: CID#996464 --- src/analyze/analyze.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git src/analyze/analyze.c src/analyze/analyze.c index d860a02..1281d6b 100644 --- src/analyze/analyze.c +++ src/analyze/analyze.c @@ -277,7 +277,8 @@ static int acquire_time_data(sd_bus *bus, struct unit_times **out) { return c; fail: - free_unit_times(unit_times, (unsigned) c); + if (unit_times) + free_unit_times(unit_times, (unsigned) c); return r; } -- 1.7.9.2 ++++++ 0002-analyze-run-use-bus_open_transport_systemd-instead-o.patch ++++++
From 1f89214e6e990a0b552f6854f87f8514ca384956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= <thomas@archlinux.org> Date: Fri, 21 Feb 2014 11:55:24 +0100 Subject: [PATCH] analyze/run: use bus_open_transport_systemd instead of bus_open_transport
Both systemd-analyze and systemd-run only access org.freedesktop.systemd1 on the bus. This patch allows using systemd-run --user and systemd-analyze --user even if the user session's bus is not properly integrated with the systemd user unit. https://bugs.freedesktop.org/show_bug.cgi?id=79252 and other reports... --- src/analyze/analyze.c | 2 +- src/run/run.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git src/analyze/analyze.c src/analyze/analyze.c index 4c5fcfe..0a4190c 100644 --- src/analyze/analyze.c +++ src/analyze/analyze.c @@ -1335,7 +1335,7 @@ int main(int argc, char *argv[]) { if (r <= 0) goto finish; - r = bus_open_transport(arg_transport, arg_host, arg_user, &bus); + r = bus_open_transport_systemd(arg_transport, arg_host, arg_user, &bus); if (r < 0) { log_error("Failed to create bus connection: %s", strerror(-r)); goto finish; diff --git src/run/run.c src/run/run.c index e4c695c..9d5527b 100644 --- src/run/run.c +++ src/run/run.c @@ -593,7 +593,7 @@ int main(int argc, char* argv[]) { arg_description = description; } - r = bus_open_transport(arg_transport, arg_host, arg_user, &bus); + r = bus_open_transport_systemd(arg_transport, arg_host, arg_user, &bus); if (r < 0) { log_error("Failed to create bus connection: %s", strerror(-r)); goto finish; -- 1.7.9.2 ++++++ 0002-architecture-Add-cris.patch ++++++
From 86bafac9540ba9e111ccba2fdf4161fe3a67cd3b Mon Sep 17 00:00:00 2001 From: Umut Tezduyar Lindskog <umut.tezduyar@axis.com> Date: Tue, 4 Mar 2014 13:58:35 +0100 Subject: [PATCH] architecture: Add cris
--- src/shared/architecture.c | 3 +++ src/shared/architecture.h | 3 +++ 2 files changed, 6 insertions(+) diff --git src/shared/architecture.c src/shared/architecture.c index fcdb3d5..9e0c3ef 100644 --- src/shared/architecture.c +++ src/shared/architecture.c @@ -114,6 +114,8 @@ Architecture uname_architecture(void) { { "m68k", ARCHITECTURE_M68K }, #elif defined(__tilegx__) { "tilegx", ARCHITECTURE_TILEGX }, +#elif defined(__cris__) + { "cris", ARCHITECTURE_CRIS }, #else #error "Please register your architecture here!" #endif @@ -161,6 +163,7 @@ static const char *const architecture_table[_ARCHITECTURE_MAX] = { [ARCHITECTURE_SH64] = "sh64", [ARCHITECTURE_M68K] = "m68k", [ARCHITECTURE_TILEGX] = "tilegx", + [ARCHITECTURE_CRIS] = "cris", }; DEFINE_STRING_TABLE_LOOKUP(architecture, Architecture); diff --git src/shared/architecture.h src/shared/architecture.h index e589a91..20e848b 100644 --- src/shared/architecture.h +++ src/shared/architecture.h @@ -48,6 +48,7 @@ typedef enum Architecture { ARCHITECTURE_SH64, ARCHITECTURE_M68K, ARCHITECTURE_TILEGX, + ARCHITECTURE_CRIS, _ARCHITECTURE_MAX, _ARCHITECTURE_INVALID = -1 } Architecture; @@ -110,6 +111,8 @@ Architecture uname_architecture(void); # define native_architecture() ARCHITECTURE_M68K #elif defined(__tilegx__) # define native_architecture() ARCHITECTURE_TILEGX +#elif defined(__cris__) +# define native_architecture() ARCHITECTURE_CRIS #else #error "Please register your architecture here!" #endif -- 1.7.9.2 ++++++ 0002-backlight-do-nothing-if-max_brightness-is-0.patch ++++++
From 3cadce7d33e263ec7a6a83c00c11144930258b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= <thomas@archlinux.org> Date: Thu, 27 Mar 2014 23:41:59 +0100 Subject: [PATCH] backlight: do nothing if max_brightness is 0
On virtually any newer Asus mainboard, the eeepc-wmi driver is loaded. It exposes a backlight device despite the lack of any physical backlight devices. This fake backlight device has max_brightness set to 0. Since the introduction of the clamp_brightness function, systemd-backlight tries to write '1' to brightness and fails. This patch changes systemd-backlight to exit gracefully when max_brightness is 0 before performing any action. This affects both the load and save actions. --- src/backlight/backlight.c | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git src/backlight/backlight.c src/backlight/backlight.c index abf8bcf..ce0385b 100644 --- src/backlight/backlight.c +++ src/backlight/backlight.c @@ -192,30 +192,37 @@ static bool validate_device(struct udev *udev, struct udev_device *device) { return true; } -/* Some systems turn the backlight all the way off at the lowest levels. - * clamp_brightness clamps the saved brightness to at least 1 or 5% of - * max_brightness. This avoids preserving an unreadably dim screen, which - * would otherwise force the user to disable state restoration. */ -static void clamp_brightness(struct udev_device *device, char **value) { +static unsigned get_max_brightness(struct udev_device *device) { int r; const char *max_brightness_str; - unsigned brightness, max_brightness, new_brightness; + unsigned max_brightness; max_brightness_str = udev_device_get_sysattr_value(device, "max_brightness"); if (!max_brightness_str) { - log_warning("Failed to read max_brightness attribute; not checking saved brightness"); - return; + log_warning("Failed to read max_brightness attribute"); + return 0; } - r = safe_atou(*value, &brightness); + r = safe_atou(max_brightness_str, &max_brightness); if (r < 0) { - log_warning("Failed to parse brightness \"%s\": %s", *value, strerror(-r)); - return; + log_warning("Failed to parse max_brightness \"%s\": %s", max_brightness_str, strerror(-r)); + return 0; } - r = safe_atou(max_brightness_str, &max_brightness); + return max_brightness; +} + +/* Some systems turn the backlight all the way off at the lowest levels. + * clamp_brightness clamps the saved brightness to at least 1 or 5% of + * max_brightness. This avoids preserving an unreadably dim screen, which + * would otherwise force the user to disable state restoration. */ +static void clamp_brightness(struct udev_device *device, char **value, unsigned max_brightness) { + int r; + unsigned brightness, new_brightness; + + r = safe_atou(*value, &brightness); if (r < 0) { - log_warning("Failed to parse max_brightness \"%s\": %s", max_brightness_str, strerror(-r)); + log_warning("Failed to parse brightness \"%s\": %s", *value, strerror(-r)); return; } @@ -239,6 +246,7 @@ int main(int argc, char *argv[]) { _cleanup_udev_device_unref_ struct udev_device *device = NULL; _cleanup_free_ char *saved = NULL, *ss = NULL, *escaped_ss = NULL, *escaped_sysname = NULL, *escaped_path_id = NULL; const char *sysname, *path_id; + unsigned max_brightness; int r; if (argc != 3) { @@ -294,6 +302,14 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } + /* If max_brightness is 0, then there is no actual backlight + * device. This happens on desktops with Asus mainboards + * that load the eeepc-wmi module. + */ + max_brightness = get_max_brightness(device); + if (max_brightness == 0) + return EXIT_SUCCESS; + escaped_ss = cescape(ss); if (!escaped_ss) { log_oom(); @@ -348,7 +364,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - clamp_brightness(device, &value); + clamp_brightness(device, &value, max_brightness); r = udev_device_set_sysattr_value(device, "brightness", value); if (r < 0) { -- 1.7.9.2 ++++++ 0002-bootchart-use-n-a-if-PRETTY_NAME-is-not-found.patch ++++++
From 1c92ff85b786c423f4436ec26007e79369c9ac05 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Fri, 26 Sep 2014 22:01:32 +0200 Subject: [PATCH] bootchart: use 'n/a' if PRETTY_NAME is not found
Spotted with coverity. If parsing both /etc/os-release and /usr/lib/os-release fails then null would be passed on. The calls to parse the two files are allowed to fail. A empty /etc may not have had the /etc/os-release symlink restored yet and we just try again in the loop. If for whatever reason that does not happen then we now pass on 'n/a' instead of null. --- src/bootchart/bootchart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/bootchart/bootchart.c src/bootchart/bootchart.c index 366a5ab..813e38d 100644 --- src/bootchart/bootchart.c +++ src/bootchart/bootchart.c @@ -471,7 +471,7 @@ int main(int argc, char *argv[]) { exit (EXIT_FAILURE); } - svg_do(build); + svg_do(strna(build)); fprintf(stderr, "systemd-bootchart wrote %s\n", output_file); -- 1.7.9.2 ++++++ 0002-bus-fix-memory-leak-when-kdbus-is-not-enabled.patch ++++++
From 82923adfe5c4fa09cc91fd2a2e374c936cd4a186 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 13 Mar 2014 20:00:50 +0100 Subject: [PATCH] bus: fix memory leak when kdbus is not enabled
--- src/libsystemd/sd-bus/sd-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git src/libsystemd/sd-bus/sd-bus.c src/libsystemd/sd-bus/sd-bus.c index ffa3369..ca7c428 100644 --- src/libsystemd/sd-bus/sd-bus.c +++ src/libsystemd/sd-bus/sd-bus.c @@ -1189,7 +1189,8 @@ _public_ int sd_bus_open_user(sd_bus **ret) { #ifdef ENABLE_KDBUS asprintf(&b->address, KERNEL_USER_BUS_FMT, (unsigned long) getuid()); #else - return -ECONNREFUSED; + r = -ECONNREFUSED; + goto fail; #endif } -- 1.7.9.2 ++++++ 0002-bus-make-use-of-sd_bus_try_close-in-exit-on-idle-ser.patch ++++++
From b27adf354a83ad25f4a209c0a6f7989ecab7b4e2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 5 Jun 2014 13:31:25 +0200 Subject: [PATCH] bus: make use of sd_bus_try_close() in exit-on-idle services
--- src/libsystemd/sd-bus/bus-util.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git src/libsystemd/sd-bus/bus-util.c src/libsystemd/sd-bus/bus-util.c index 6bd21cc..6441c5b 100644 --- src/libsystemd/sd-bus/bus-util.c +++ src/libsystemd/sd-bus/bus-util.c @@ -43,7 +43,9 @@ static int name_owner_change_callback(sd_bus *bus, sd_bus_message *m, void *user assert(m); assert(e); + sd_bus_close(bus); sd_event_exit(e, 0); + return 1; } @@ -121,11 +123,30 @@ int bus_event_loop_with_idle( return r; if (r == 0 && !exiting) { - r = bus_async_unregister_and_exit(e, bus, name); + + r = sd_bus_try_close(bus); + if (r == -EBUSY) + continue; + + if (r == -ENOTSUP) { + /* Fallback for dbus1 connections: we + * unregister the name and wait for + * the response to come through for + * it */ + + r = bus_async_unregister_and_exit(e, bus, name); + if (r < 0) + return r; + + exiting = true; + continue; + } + if (r < 0) return r; - exiting = true; + sd_event_exit(e, 0); + break; } } -- 1.7.9.2 ++++++ 0002-bus-remove-unused-check.patch ++++++
From 04c553e322680b6fcdf5b271e84b0b4b0ad8d5f9 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Tue, 23 Sep 2014 21:34:21 +0200 Subject: [PATCH] bus: remove unused check
strerror_r does not return null here and even if it did we would have problems already at the preceding strlen call. Found by coverity. Fixes: CID#1237770 --- src/libsystemd/sd-bus/bus-error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/libsystemd/sd-bus/bus-error.c src/libsystemd/sd-bus/bus-error.c index c2e41fb..abdfd73 100644 --- src/libsystemd/sd-bus/bus-error.c +++ src/libsystemd/sd-bus/bus-error.c @@ -312,7 +312,7 @@ static void bus_error_strerror(sd_bus_error *e, int error) { continue; } - if (!x || errno) { + if (errno) { free(m); return; } -- 1.7.9.2 ++++++ 0002-core-make-sure-Environment-fields-passed-in-for-tran.patch ++++++
From cdd7b7dfd44649b204c43e907f03d4294de4f28a Mon Sep 17 00:00:00 2001 From: Hristo Venev <mustrumr97@gmail.com> Date: Mon, 23 Jun 2014 18:53:04 +0200 Subject: [PATCH] core: make sure Environment fields passed in for transient units are properly written to unit files
From 375ae4aa4d2f89ae8afdd27e9f2b8336fcc2a046 Mon Sep 17 00:00:00 2001 From: Uoti Urpala <uoti.urpala@pp1.inet.fi> Date: Mon, 23 Jun 2014 16:50:03 +0300 Subject: [PATCH] core/transaction: fix cycle break attempts outside
https://bugs.freedesktop.org/show_bug.cgi?id=76744 --- src/core/dbus-execute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/core/dbus-execute.c src/core/dbus-execute.c index cb9a077..ecbadd7 100644 --- src/core/dbus-execute.c +++ src/core/dbus-execute.c @@ -848,7 +848,7 @@ int bus_exec_context_set_transient_property( strv_free(c->environment); c->environment = e; - joined = strv_join(c->environment, " "); + joined = strv_join_quoted(c->environment); if (!joined) return -ENOMEM; -- 1.7.9.2 ++++++ 0002-core-transaction-fix-cycle-break-attempts-outside-tr.patch ++++++ transaction Patch fixes some incorrect-looking code in transaction.c. It could fix cases where Debian users with bad package configurations had systemd go into an infinite loop printing messages about breaking an ordering cycle, though I have not reproduced that problem myself. transaction_verify_order_one() considers jobs/units outside current transaction when checking whether ordering dependencies cause cycles. It would also incorrectly try to break cycles at these jobs; this cannot work, as the break action is to remove the job from the transaction, which is a no-op if the job isn't part of the transaction to begin with. The unit_matters_to_anchor() test also looks like it would not work correctly for non-transaction jobs. Add a check to verify that the unit is part of the transaction before considering a job a candidate for deletion. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=752259 --- src/core/transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/core/transaction.c src/core/transaction.c index d23a45c..805d40a 100644 --- src/core/transaction.c +++ src/core/transaction.c @@ -381,7 +381,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi "Found dependency on %s/%s", k->unit->id, job_type_to_string(k->type)); - if (!delete && + if (!delete && hashmap_get(tr->jobs, k->unit) && !unit_matters_to_anchor(k->unit, k)) { /* Ok, we can drop this one, so let's * do so. */ -- 1.7.9.2 ++++++ 0002-core-watchdog-bus-properties-cannot-be-both-writable.patch ++++++ Based on 4c3f1641f13b7687a0dc234d3ae387b7c40494ff Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 19 Nov 2014 20:52:23 +0100 Subject: [PATCH] core: watchdog bus properties cannot be both writable and constant --- src/core/dbus-manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- src/core/dbus-manager.c +++ src/core/dbus-manager.c 2014-11-20 13:43:06.781518488 +0000 @@ -1599,8 +1599,8 @@ const sd_bus_vtable bus_manager_vtable[] SD_BUS_PROPERTY("UnitPath", "as", NULL, offsetof(Manager, lookup_paths.unit_path), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("DefaultStandardOutput", "s", bus_property_get_exec_output, offsetof(Manager, default_std_output), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("DefaultStandardError", "s", bus_property_get_exec_output, offsetof(Manager, default_std_output), SD_BUS_VTABLE_PROPERTY_CONST), - SD_BUS_WRITABLE_PROPERTY("RuntimeWatchdogUSec", "t", bus_property_get_usec, property_set_runtime_watchdog, offsetof(Manager, runtime_watchdog), SD_BUS_VTABLE_PROPERTY_CONST), - SD_BUS_WRITABLE_PROPERTY("ShutdownWatchdogUSec", "t", bus_property_get_usec, bus_property_set_usec, offsetof(Manager, shutdown_watchdog), SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_WRITABLE_PROPERTY("RuntimeWatchdogUSec", "t", bus_property_get_usec, property_set_runtime_watchdog, offsetof(Manager, runtime_watchdog), 0), + SD_BUS_WRITABLE_PROPERTY("ShutdownWatchdogUSec", "t", bus_property_get_usec, bus_property_set_usec, offsetof(Manager, shutdown_watchdog), 0), SD_BUS_PROPERTY("ControlGroup", "s", NULL, offsetof(Manager, cgroup_root), 0), SD_BUS_METHOD("GetUnit", "s", "o", method_get_unit, SD_BUS_VTABLE_UNPRIVILEGED), ++++++ 0002-execute-free-directory-path-if-we-fail-to-remove-it-.patch ++++++
From 98b47d54ce946ad3524f84eb38d2413498a333dc Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 3 Mar 2014 17:11:39 +0100 Subject: [PATCH] execute: free directory path if we fail to remove it because we cannot allocate a thread
--- src/core/execute.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git src/core/execute.c src/core/execute.c index 9de6e87..3312885 100644 --- src/core/execute.c +++ src/core/execute.c @@ -2713,6 +2713,8 @@ static void *remove_tmpdir_thread(void *p) { } void exec_runtime_destroy(ExecRuntime *rt) { + int r; + if (!rt) return; @@ -2722,13 +2724,25 @@ void exec_runtime_destroy(ExecRuntime *rt) { if (rt->tmp_dir) { log_debug("Spawning thread to nuke %s", rt->tmp_dir); - asynchronous_job(remove_tmpdir_thread, rt->tmp_dir); + + r = asynchronous_job(remove_tmpdir_thread, rt->tmp_dir); + if (r < 0) { + log_warning("Failed to nuke %s: %s", rt->tmp_dir, strerror(-r)); + free(rt->tmp_dir); + } + rt->tmp_dir = NULL; } if (rt->var_tmp_dir) { log_debug("Spawning thread to nuke %s", rt->var_tmp_dir); - asynchronous_job(remove_tmpdir_thread, rt->var_tmp_dir); + + r = asynchronous_job(remove_tmpdir_thread, rt->var_tmp_dir); + if (r < 0) { + log_warning("Failed to nuke %s: %s", rt->var_tmp_dir, strerror(-r)); + free(rt->var_tmp_dir); + } + rt->var_tmp_dir = NULL; } -- 1.7.9.2 ++++++ 0002-fsck-include-device-name-in-the-message-about-missin.patch ++++++ Based on 8d2a6145334257c8a9ceabc9dd52dff06cca818e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Mon, 26 May 2014 23:03:11 -0400 Subject: [PATCH] fsck: include device name in the message about missing fsck --- src/fsck/fsck.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- src/fsck/fsck.c +++ src/fsck/fsck.c 2014-06-03 14:15:15.746235301 +0000 @@ -284,10 +284,12 @@ int main(int argc, char *argv[]) { r = access(checker, X_OK); if (r < 0) { if (errno == ENOENT) { - log_info("%s doesn't exist, not checking file system.", checker); + log_info("%s doesn't exist, not checking file system on %s", + checker, device); return EXIT_SUCCESS; } else - log_warning("%s cannot be used: %m", checker); + log_warning("%s cannot be used for %s: %m", + checker, device); } } ++++++ 0002-hostnamed-add-a-new-chassis-type-for-watches.patch ++++++
From c49e59c1831f20fe02276d7bc6ba7d23d24c4ab3 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 9 Jul 2014 13:20:05 +0200 Subject: [PATCH] hostnamed: add a new chassis type for watches
--- src/hostname/hostnamed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git src/hostname/hostnamed.c src/hostname/hostnamed.c index 514554d..eaae113 100644 --- src/hostname/hostnamed.c +++ src/hostname/hostnamed.c @@ -144,7 +144,8 @@ static bool valid_chassis(const char *chassis) { "laptop\0" "server\0" "tablet\0" - "handset\0", + "handset\0" + "watch\0", chassis); } -- 1.7.9.2 ++++++ 0002-hwdb-Add-mapping-for-special-keys-on-compaq-ku-0133-.patch ++++++
From fc1ae82cae69d8dbbd9e7a31938810a486fac782 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@redhat.com> Date: Wed, 22 Oct 2014 14:09:21 +0200 Subject: [PATCH] hwdb: Add mapping for special keys on compaq ku 0133 keyboards
The compaq ku 0133 keyboard has 8 special keys at the top: http://lackof.org/taggart/hacking/keyboard/cpqwireless.jpg 3 of these use standard HID usage codes from the consumer page, the 5 others use part of the reserved 0x07 - 0x1f range. This commit adds mapping for this keyboard for these reserved codes, making the other 5 keys work. Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- hwdb/60-keyboard.hwdb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index 59f467b..06caba9 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -181,6 +181,13 @@ keyboard:dmi:bvn*:bvr*:bd*:svnCompaq*:pn*Evo*N*:pvr* KEYBOARD_KEY_9e=email KEYBOARD_KEY_9f=homepage +keyboard:usb:v049Fp0051d*dc*dsc*dp*ic*isc*ip*in01* + KEYBOARD_KEY_0c0011=presentation + KEYBOARD_KEY_0c0012=addressbook + KEYBOARD_KEY_0c0013=info + KEYBOARD_KEY_0c0014=prog1 + KEYBOARD_KEY_0c0015=messenger + ########################################################### # Dell ########################################################### -- 1.7.9.2 ++++++ 0002-hwdb-Update-database-of-Bluetooth-company-identifier.patch ++++++
From f401e2b24ba17452f9655993a6dedefdffe06d23 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann <marcel@holtmann.org> Date: Tue, 11 Mar 2014 09:33:31 -0700 Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
--- hwdb/20-bluetooth-vendor-product.hwdb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git hwdb/20-bluetooth-vendor-product.hwdb hwdb/20-bluetooth-vendor-product.hwdb index 0335a71..7d86f10 100644 --- hwdb/20-bluetooth-vendor-product.hwdb +++ hwdb/20-bluetooth-vendor-product.hwdb @@ -911,3 +911,15 @@ bluetooth:v012C* bluetooth:v012D* ID_VENDOR_FROM_DATABASE=Sony Corporation + +bluetooth:v012E* + ID_VENDOR_FROM_DATABASE=ASSA ABLOY + +bluetooth:v012F* + ID_VENDOR_FROM_DATABASE=Clarion Co., Ltd. + +bluetooth:v0130* + ID_VENDOR_FROM_DATABASE=Warehouse Innovations + +bluetooth:v0131* + ID_VENDOR_FROM_DATABASE=Cypress Semiconductor Corporation -- 1.7.9.2 ++++++ 0002-hwdb-update.patch ++++++ ++++ 2058 lines (skipped) ++++++ 0002-include-fcntl.h-rather-than-sys-fcntl.h.patch ++++++
From fdb8bd0fe7244b72ddc1c08e401ebddefdaf4f46 Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing <systemd@esmil.dk> Date: Thu, 18 Sep 2014 15:24:38 +0200 Subject: [PATCH] include fcntl.h rather than sys/fcntl.h
--- src/socket-proxy/socket-proxyd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/socket-proxy/socket-proxyd.c src/socket-proxy/socket-proxyd.c index 81d8457..ff2b24f 100644 --- src/socket-proxy/socket-proxyd.c +++ src/socket-proxy/socket-proxyd.c @@ -26,7 +26,7 @@ #include <stdlib.h> #include <string.h> #include <netdb.h> -#include <sys/fcntl.h> +#include <fcntl.h> #include <sys/socket.h> #include <sys/un.h> #include <unistd.h> -- 1.7.9.2 ++++++ 0002-journal-compress-improve-xz-compression-performance.patch ++++++ Based on 1930eed2a7855d2df06ccf51f9e394428bf547e2 Mon Sep 17 00:00:00 2001 From: Jon Severinsson <jon@severinsson.net> Date: Tue, 8 Jul 2014 18:29:46 +0200 Subject: [PATCH] journal/compress: improve xz compression performance The new lzma2 compression options at the top of compress_blob_xz are equivalent to using preset "0", exept for using a 1 MiB dictionary (the same as preset "1"). This makes the memory usage at most 7.5 MiB in the compressor, and 1 MiB in the decompressor, instead of the previous 92 MiB in the compressor and 8 MiB in the decompressor. According to test-compress-benchmark this commit makes XZ compression 20 times faster, with no increase in compressed data size. Using more realistic test data (an ELF binary rather than repeating ASCII letters 'a' through 'z' in order) it only provides a factor 10 speedup, and at a cost if a 10% increase in compressed data size. But that is still a worthwhile trade-off. According to test-compress-benchmark XZ compression is still 25 times slower than LZ4, but the compressed data is one eighth the size. Using more realistic test data XZ compression is only 18 times slower than LZ4, and the compressed data is only one quarter the size. --- src/journal/compress.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) --- src/journal/compress.c +++ src/journal/compress.c 2014-07-09 12:09:45.814235274 +0000 @@ -28,8 +28,15 @@ #include "compress.h" bool compress_blob(const void *src, uint64_t src_size, void *dst, uint64_t *dst_size) { - lzma_stream s = LZMA_STREAM_INIT; + static const lzma_options_lzma opt = { + 1u << 20u, NULL, 0, LZMA_LC_DEFAULT, LZMA_LP_DEFAULT, + LZMA_PB_DEFAULT, LZMA_MODE_FAST, 128, LZMA_MF_HC3, 4}; + static const lzma_filter filters[2] = { + {LZMA_FILTER_LZMA2, (lzma_options_lzma*) &opt}, + {LZMA_VLI_UNKNOWN, NULL} + }; lzma_ret ret; + size_t out_pos = 0; bool b = false; assert(src); @@ -40,29 +47,17 @@ bool compress_blob(const void *src, uint /* Returns false if we couldn't compress the data or the * compressed result is longer than the original */ - ret = lzma_easy_encoder(&s, LZMA_PRESET_DEFAULT, LZMA_CHECK_NONE); - if (ret != LZMA_OK) + if (src_size < 80) return false; - s.next_in = src; - s.avail_in = src_size; - s.next_out = dst; - s.avail_out = src_size; - - /* Does it fit? */ - if (lzma_code(&s, LZMA_FINISH) != LZMA_STREAM_END) - goto fail; - - /* Is it actually shorter? */ - if (s.avail_out == 0) - goto fail; + ret = lzma_stream_buffer_encode((lzma_filter*) filters, LZMA_CHECK_NONE, NULL, + src, src_size, dst, &out_pos, src_size - 1); + if (ret != LZMA_OK) + return false; - *dst_size = src_size - s.avail_out; + *dst_size = out_pos; b = true; -fail: - lzma_end(&s); - return b; } ++++++ 0002-journal-properly-detect-language-specified-in-line.patch ++++++
From baf167ee0a2953f98e4e7d4c35752ef737832674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 11 Apr 2014 20:57:27 -0400 Subject: [PATCH] journal: properly detect language specified in line
... it turns out that the duplicates in our own catalog were not real duplicates, but translations. --- TODO | 2 ++ src/journal/catalog.c | 53 +++++++++++++++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 19 deletions(-) diff --git TODO TODO index 0343b94..a7307f7 100644 --- TODO +++ TODO @@ -709,6 +709,8 @@ External: * fedora: update policy to declare access mode and ownership of unit files to root:root 0644, and add an rpmlint check for it +* register catalog database signature as file magic + Regularly: * look for close() vs. close_nointr() vs. close_nointr_nofail() diff --git src/journal/catalog.c src/journal/catalog.c index 02dedc4..f03357d 100644 --- src/journal/catalog.c +++ src/journal/catalog.c @@ -159,6 +159,37 @@ int catalog_file_lang(const char* filename, char **lang) { return 1; } +static int catalog_entry_lang(const char* filename, int line, + const char* t, const char* deflang, char **lang) { + size_t c; + + c = strlen(t); + if (c == 0) { + log_error("[%s:%u] Language too short.", filename, line); + return -EINVAL; + } + if (c > 31) { + log_error("[%s:%u] language too long.", filename, line); + return -EINVAL; + } + + if (deflang) { + if (streq(t, deflang)) { + log_warning("[%s:%u] language specified unnecessarily", + filename, line); + return 0; + } else + log_warning("[%s:%u] language differs from default for file", + filename, line); + } + + *lang = strdup(t); + if (!*lang) + return -ENOMEM; + + return 0; +} + int catalog_import_file(Hashmap *h, struct strbuf *sb, const char *path) { _cleanup_fclose_ FILE *f = NULL; _cleanup_free_ char *payload = NULL; @@ -238,25 +269,9 @@ int catalog_import_file(Hashmap *h, struct strbuf *sb, const char *path) { if (with_language) { t = strstrip(line + 2 + 1 + 32 + 1); - c = strlen(t); - if (c <= 0) { - log_error("[%s:%u] Language too short.", path, n); - return -EINVAL; - } - if (c > 31) { - log_error("[%s:%u] language too long.", path, n); - return -EINVAL; - } - - if (deflang) { - log_warning("[%s:%u] language %s", path, n, - streq(t, deflang) ? - "specified unnecessarily" : - "differs from default for file"); - lang = strdup(t); - if (!lang) - return -ENOMEM; - } + r = catalog_entry_lang(path, n, t, deflang, &lang); + if (r < 0) + return r; } got_id = true; -- 1.7.9.2 ++++++ 0002-journalctl-man-allow-only-between-terms.patch ++++++
From 4e6029435111adcad71489aca2dd68bc65aeffd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 19 Jul 2014 21:05:07 -0400 Subject: [PATCH] journalctl,man: allow + only between terms
https://bugzilla.redhat.com/show_bug.cgi?id=1110712 --- man/journalctl.xml | 19 +++++++++++++++---- src/journal/journalctl.c | 20 +++++++++++++++++--- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git man/journalctl.xml man/journalctl.xml index 47b5a05..df9c794 100644 --- man/journalctl.xml +++ man/journalctl.xml @@ -84,10 +84,11 @@ field, then they are automatically matched as alternatives, i.e. the resulting output will show entries matching any of the specified matches for the - same field. Finally, if the character - <literal>+</literal> appears as a separate word on the - command line, all matches before and after are combined - in a disjunction (i.e. logical OR).</para> + same field. Finally, the character + <literal>+</literal> may appears as a separate word + between other terms on the command line. This causes + all matches before and after to be combined in a + disjunction (i.e. logical OR).</para> <para>As shortcuts for a few types of field/value matches, file paths may be specified. If a file path @@ -98,11 +99,21 @@ <literal>_KERNEL_DEVICE=</literal> match for the device.</para> + <para>Additional contraints may be added using options + <option>--boot</option>, <option>--unit=</option>, + etc, to futher limit what entries will be shown + (logical AND).</para> + <para>Output is interleaved from all accessible journal files, whether they are rotated or currently being written, and regardless of whether they belong to the system itself or are accessible user journals.</para> + <para>The set of journal files which will be used + can be modified using the <option>--user</option>, + <option>--system</option>, <option>--directory</option>, + and <option>--file</option> options, see below.</para> + <para>All users are granted access to their private per-user journals. However, by default, only root and users who are members of the <literal>systemd-journal</literal> diff --git src/journal/journalctl.c src/journal/journalctl.c index 92e8286..7aedbf0 100644 --- src/journal/journalctl.c +++ src/journal/journalctl.c @@ -699,15 +699,20 @@ static int generate_new_id128(void) { static int add_matches(sd_journal *j, char **args) { char **i; + bool have_term = false; assert(j); STRV_FOREACH(i, args) { int r; - if (streq(*i, "+")) + if (streq(*i, "+")) { + if (!have_term) + break; r = sd_journal_add_disjunction(j); - else if (path_is_absolute(*i)) { + have_term = false; + + } else if (path_is_absolute(*i)) { _cleanup_free_ char *p, *t = NULL, *t2 = NULL; const char *path; _cleanup_free_ char *interpreter = NULL; @@ -756,8 +761,12 @@ static int add_matches(sd_journal *j, char **args) { r = sd_journal_add_match(j, t, 0); if (t2) r = sd_journal_add_match(j, t2, 0); - } else + have_term = true; + + } else { r = sd_journal_add_match(j, *i, 0); + have_term = true; + } if (r < 0) { log_error("Failed to add match '%s': %s", *i, strerror(-r)); @@ -765,6 +774,11 @@ static int add_matches(sd_journal *j, char **args) { } } + if (!strv_isempty(args) && !have_term) { + log_error("\"+\" can only be used between terms"); + return -EINVAL; + } + return 0; } -- 1.7.9.2 ++++++ 0002-journald-make-MaxFileSec-really-default-to-1month.patch ++++++ Based on e150e82097211f09b911c7784a89ef9efed713ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bartoszkiewicz?= <mbartoszkiewicz@gmail.com> Date: Thu, 26 Jun 2014 22:11:35 +0200 Subject: [PATCH] journald: make MaxFileSec really default to 1month journald.conf(5) states that the default for MaxFileSec is one month, but the code didn't respect that. --- src/journal/journald-server.c | 3 +++ 1 file changed, 3 insertions(+) --- src/journal/journald-server.c +++ src/journal/journald-server.c 2014-07-01 12:28:25.506735287 +0000 @@ -68,6 +68,7 @@ #define DEFAULT_SYNC_INTERVAL_USEC (5*USEC_PER_MINUTE) #define DEFAULT_RATE_LIMIT_INTERVAL (30*USEC_PER_SEC) #define DEFAULT_RATE_LIMIT_BURST 1000 +#define DEFAULT_MAX_FILE_USEC USEC_PER_MONTH #define RECHECK_AVAILABLE_SPACE_USEC (30*USEC_PER_SEC) @@ -1496,6 +1497,8 @@ int server_init(Server *s) { s->forward_to_syslog = true; + s->max_file_usec = DEFAULT_MAX_FILE_USEC; + s->max_level_store = LOG_DEBUG; s->max_level_syslog = LOG_DEBUG; s->max_level_kmsg = LOG_NOTICE; ++++++ 0002-keymap-Add-microphone-mute-keymap-for-Dell-Latitude.patch ++++++
From 1f6d36f267186c0e3184bab4c7eca48481c6faab Mon Sep 17 00:00:00 2001 From: Hui Wang <hui.wang@canonical.com> Date: Wed, 30 Jul 2014 16:09:08 +0800 Subject: [PATCH] keymap: Add microphone mute keymap for Dell Latitude
On the Dell Latitude, the mic mute key event is generated by wmi driver, the keycode assigned to this hotkey from kernel is KEY_MICMUTE (248), this keycode is too big for xorg to handle, in the xorg, the XF86AudioMicMute is assigned to F20. Please refer to 4e648ea0 of xkeyboard-config. BugLink: https://bugs.launchpad.net/bugs/1326684 BugLink: https://bugs.launchpad.net/bugs/1339998 Signed-off-by: Hui Wang <hui.wang@canonical.com> Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com> --- hwdb/60-keyboard.hwdb | 4 ++++ 1 file changed, 4 insertions(+) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index c7ff4e4..70e372b 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -229,6 +229,10 @@ keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnPrecision*:pvr* keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnXPS*:pvr* KEYBOARD_KEY_8c=!unknown +# Dell Latitude microphone mute +keyboard:name:Dell WMI hotkeys:dmi:bvn*:bvr*:bd*:svnDell*:pnLatitude* + KEYBOARD_KEY_150=f20 # Mic mute toggle + ########################################################### # Everex ########################################################### -- 1.7.9.2 ++++++ 0002-keymap-Asus-EeePC-touchpad-toggle-key.patch ++++++
From e55edb22a71e67f01534d28f91c6aa27bba48fc1 Mon Sep 17 00:00:00 2001 From: Martin Pitt <martin.pitt@ubuntu.com> Date: Sun, 25 May 2014 12:16:35 +0200 Subject: [PATCH] keymap: Asus EeePC touchpad toggle key
Originally is KEY_TOUCHPAD_TOGGLE, but X.org can't handle the big key events, so use the F21 convention. https://bugs.freedesktop.org/show_bug.cgi?id=72807 --- hwdb/60-keyboard.hwdb | 1 + 1 file changed, 1 insertion(+) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index fe5b3ee..05e6a04 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -138,6 +138,7 @@ keyboard:dmi:bvn*:bvr*:bd*:svnASUS:pn* KEYBOARD_KEY_ef=mute keyboard:name:Asus WMI hotkeys:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:pvr* +keyboard:name:Eee PC WMI hotkeys:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:pvr* KEYBOARD_KEY_6b=f21 # Touchpad Toggle ########################################################### -- 1.7.9.2 ++++++ 0002-keymap-Fix-special-keys-on-ThinkPad-X60-X61-Tablet.patch ++++++
From b4c72e52d2109fe7f0ac3440c81ae3e1ce64a143 Mon Sep 17 00:00:00 2001 From: Bastien Nocera <hadess@hadess.net> Date: Wed, 12 Nov 2014 23:31:08 +0100 Subject: [PATCH] keymap: Fix special keys on ThinkPad X60/X61 Tablet
KEY_DIRECTION is mapped to XF86RotateWindows, to rotate the display: http://cgit.freedesktop.org/xkeyboard-config/commit/symbols/inet?id=ec875f6f... And F13 is mapped to XF86Tools, which is closest to the original toolbox usage: http://cgit.freedesktop.org/xkeyboard-config/tree/symbols/inet?id=7a2c4bed21... --- hwdb/60-keyboard.hwdb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index 56a4009..533ad5b 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -585,8 +585,8 @@ keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:pvrThinkPad*X2*Tablet* # ThinkPad X6 Tablet keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pnThinkPad*X6*:pvr* - KEYBOARD_KEY_6c=f21 # rotate - KEYBOARD_KEY_68=screenlock # screenlock + KEYBOARD_KEY_6c=direction # rotate + KEYBOARD_KEY_68=f13 # toolbox KEYBOARD_KEY_6b=esc # escape KEYBOARD_KEY_6d=right # right on d-pad KEYBOARD_KEY_6e=left # left on d-pad -- 1.7.9.2 ++++++ 0002-keymap-Fix-touchpad-toggle-key-on-Asus-laptops.patch ++++++
From 4e3deeedc15b03197d591850061316289245c9a9 Mon Sep 17 00:00:00 2001 From: Martin Pitt <martin.pitt@ubuntu.com> Date: Tue, 7 Oct 2014 11:22:31 +0200 Subject: [PATCH] keymap: Fix touchpad toggle key on Asus laptops
https://launchpad.net/bugs/1377352 --- hwdb/60-keyboard.hwdb | 1 + 1 file changed, 1 insertion(+) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index 1fea32a..59f467b 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -153,6 +153,7 @@ keyboard:dmi:bvn*:bvr*:bd*:svnASUS:pn* keyboard:name:Asus WMI hotkeys:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:pvr* keyboard:name:Eee PC WMI hotkeys:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:pvr* +keyboard:name:Asus Laptop extra buttons:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:pvr* KEYBOARD_KEY_6b=f21 # Touchpad Toggle ########################################################### -- 1.7.9.2 ++++++ 0002-keymap-Ignore-brightness-keys-on-Dell-Inspiron-1520-.patch ++++++
From aba248ee6b1eb10baf3d89eca2ad7569459af6ab Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@redhat.com> Date: Thu, 30 Oct 2014 10:15:54 +0100 Subject: [PATCH] keymap: Ignore brightness keys on Dell Inspiron 1520 to avoid double events
On the Dell Inspiron 1520 both the atkbd and acpi-video input devices report an event for pressing the brightness up / down key-combos, resulting in user space seeing double events and increasing / decreasing the brightness 2 steps for each keypress. This hwdb snippet suppresses the atkbd events, making the Inspiron 1520 work like most modern laptops which emit brightness up / down events through acpi-video only. Reported by Pavel Malyshev <p.malishev@gmail.com> https://bugzilla.redhat.com/show_bug.cgi?id=1141525 --- hwdb/60-keyboard.hwdb | 5 +++++ 1 file changed, 5 insertions(+) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index 06caba9..d2ca965 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -230,6 +230,11 @@ keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnInspiron*1110:pvr* keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnInspiron*1210:pvr* KEYBOARD_KEY_84=wlan +# Dell Inspiron 1520 +keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnInspiron*1520:pvr* + KEYBOARD_KEY_85=unknown # Brightness Down, also emitted by acpi-video, ignore + KEYBOARD_KEY_86=unknown # Brightness Up, also emitted by acpi-video, ignore + # Latitude XT2 keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnLatitude*XT2:pvr* KEYBOARD_KEY_9b=up # tablet rocker up -- 1.7.9.2 ++++++ 0002-login-set-pos-slot-to-fallback-on-pos-eviction.patch ++++++
From 3e6b205f81e743c7354ccbc69eb45afbdbebe2dc Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Tue, 25 Feb 2014 13:08:24 +0100 Subject: [PATCH] login: set pos-slot to fallback on pos-eviction
If we evict a session position, we open the position slot for future sessions. However, there might already be another session on the same position if both were started on the same VT. This is currently done if gdm spawns the session on its own Xserver. Hence, look for such a session on pos-eviction and claim the new slot immediately. --- src/login/logind-seat.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git src/login/logind-seat.c src/login/logind-seat.c index 36ec7ed..96cf08e 100644 --- src/login/logind-seat.c +++ src/login/logind-seat.c @@ -459,6 +459,7 @@ int seat_stop_sessions(Seat *s, bool force) { } void seat_evict_position(Seat *s, Session *session) { + Session *iter; unsigned int pos = session->pos; session->pos = 0; @@ -466,8 +467,19 @@ void seat_evict_position(Seat *s, Session *session) { if (!pos) return; - if (pos < s->position_count && s->positions[pos] == session) + if (pos < s->position_count && s->positions[pos] == session) { s->positions[pos] = NULL; + + /* There might be another session claiming the same + * position (eg., during gdm->session transition), so lets look + * for it and set it on the free slot. */ + LIST_FOREACH(sessions_by_seat, iter, s->sessions) { + if (iter->pos == pos) { + s->positions[pos] = iter; + break; + } + } + } } void seat_claim_position(Seat *s, Session *session, unsigned int pos) { -- 1.7.9.2 ++++++ 0002-logind-add-support-for-TPS65217-Power-Button.patch ++++++
From 492d7a3038b154e1813a1ece913a5a27148fec19 Mon Sep 17 00:00:00 2001 From: Koen Kooi <koen@dominion.thruhere.net> Date: Sat, 27 Sep 2014 09:55:44 +0200 Subject: [PATCH] logind: add support for TPS65217 Power Button
This PMIC is found on TI AM335x based boards like the beaglebone and beaglebone black. root@beaglebone-white:~# udevadm info -a /dev/input/event0 Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/devices/ocp.3/44e0b000.i2c/i2c-0/0-0024/input/input0/event0': KERNEL=="event0" SUBSYSTEM=="input" DRIVER=="" looking at parent device '/devices/ocp.3/44e0b000.i2c/i2c-0/0-0024/input/input0': KERNELS=="input0" SUBSYSTEMS=="input" DRIVERS=="" ATTRS{name}=="tps65217_pwr_but" ATTRS{phys}=="" ATTRS{uniq}=="" ATTRS{properties}=="0" looking at parent device '/devices/ocp.3/44e0b000.i2c/i2c-0/0-0024': KERNELS=="0-0024" SUBSYSTEMS=="i2c" DRIVERS=="tps65217" ATTRS{name}=="tps65217" looking at parent device '/devices/ocp.3/44e0b000.i2c/i2c-0': KERNELS=="i2c-0" SUBSYSTEMS=="i2c" DRIVERS=="" ATTRS{name}=="OMAP I2C adapter" looking at parent device '/devices/ocp.3/44e0b000.i2c': KERNELS=="44e0b000.i2c" SUBSYSTEMS=="platform" DRIVERS=="omap_i2c" looking at parent device '/devices/ocp.3': KERNELS=="ocp.3" SUBSYSTEMS=="platform" DRIVERS=="" --- src/login/70-power-switch.rules | 1 + 1 file changed, 1 insertion(+) diff --git src/login/70-power-switch.rules src/login/70-power-switch.rules index a6997f7..695d246 100644 --- src/login/70-power-switch.rules +++ src/login/70-power-switch.rules @@ -10,5 +10,6 @@ ACTION=="remove", GOTO="power_switch_end" SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", TAG+="power-switch" SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", TAG+="power-switch" SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="twl4030_pwrbutton", TAG+="power-switch" +SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="tps65217_pwr_but", TAG+="power-switch" LABEL="power_switch_end" -- 1.7.9.2 ++++++ 0002-logind-bring-polkit-policy-for-hibernate-in-line-wit.patch ++++++
From 301f9684e6465df5d0590f6c571fe3229ded966d Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 15 May 2014 18:30:07 +0200 Subject: [PATCH] logind: bring polkit policy for hibernate in line with suspend/poweroff/reboot
THere's no reason why hibernate should be better protected then suspendor poweroff, so sync the policies. --- src/login/org.freedesktop.login1.policy.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/login/org.freedesktop.login1.policy.in src/login/org.freedesktop.login1.policy.in index b96d32d..b8e90f1 100644 --- src/login/org.freedesktop.login1.policy.in +++ src/login/org.freedesktop.login1.policy.in @@ -254,7 +254,7 @@ <defaults> <allow_any>auth_admin_keep</allow_any> <allow_inactive>auth_admin_keep</allow_inactive> - <allow_active>auth_admin_keep</allow_active> + <allow_active>yes</allow_active> </defaults> <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.hibernate</annotate> </action> -- 1.7.9.2 ++++++ 0002-logind-fix-printf-format.patch ++++++
From 7e9110a29d90041b0364cb93a84aec9dd72363b6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 3 Mar 2014 19:39:51 +0100 Subject: [PATCH] logind: fix printf format
--- src/login/logind-action.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/login/logind-action.c src/login/logind-action.c index da5a830..c9d8bc5 100644 --- src/login/logind-action.c +++ src/login/logind-action.c @@ -81,7 +81,7 @@ int manager_handle_action( n = manager_count_displays(m); if (n != 1) { - log_debug("Ignoring lid switch request, %s displays connected."); + log_debug("Ignoring lid switch request, %i displays connected.", n); return 0; } } -- 1.7.9.2 ++++++ 0002-machined-fix-Kill-bus-call-on-machine-objects-when-w.patch ++++++
From de58a50e24a0d55e3bbcc77f8f6170a7322acf52 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 18 Mar 2014 04:43:08 +0100 Subject: [PATCH] machined: fix Kill() bus call on machine objects when "what" is specified as "leader"
--- src/machine/machine.c | 10 +++++++++- src/machine/machined-dbus.c | 4 ++-- src/machine/machined.h | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git src/machine/machine.c src/machine/machine.c index 4596a80..9a5cc9a 100644 --- src/machine/machine.c +++ src/machine/machine.c @@ -410,7 +410,15 @@ int machine_kill(Machine *m, KillWho who, int signo) { if (!m->unit) return -ESRCH; - return manager_kill_unit(m->manager, m->unit, who, signo, NULL); + if (who == KILL_LEADER) { + /* If we shall simply kill the leader, do so directly */ + + if (kill(m->leader, signo) < 0) + return -errno; + } + + /* Otherwise make PID 1 do it for us, for the entire cgroup */ + return manager_kill_unit(m->manager, m->unit, signo, NULL); } static const char* const machine_class_table[_MACHINE_CLASS_MAX] = { diff --git src/machine/machined-dbus.c src/machine/machined-dbus.c index 09d28bb..9473105 100644 --- src/machine/machined-dbus.c +++ src/machine/machined-dbus.c @@ -655,7 +655,7 @@ int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, c return 1; } -int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo, sd_bus_error *error) { +int manager_kill_unit(Manager *manager, const char *unit, int signo, sd_bus_error *error) { assert(manager); assert(unit); @@ -667,7 +667,7 @@ int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo "KillUnit", error, NULL, - "ssi", unit, who == KILL_LEADER ? "main" : "all", signo); + "ssi", unit, "all", signo); } int manager_unit_is_active(Manager *manager, const char *unit) { diff --git src/machine/machined.h src/machine/machined.h index d4b581b..2dba303 100644 --- src/machine/machined.h +++ src/machine/machined.h @@ -67,6 +67,6 @@ int match_job_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_b int manager_start_scope(Manager *manager, const char *scope, pid_t pid, const char *slice, const char *description, sd_bus_message *more_properties, sd_bus_error *error, char **job); int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job); -int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo, sd_bus_error *error); +int manager_kill_unit(Manager *manager, const char *unit, int signo, sd_bus_error *error); int manager_unit_is_active(Manager *manager, const char *unit); int manager_job_is_active(Manager *manager, const char *path); -- 1.7.9.2 ++++++ 0002-man-document-yearly-and-annually-in-systemd.time-7.patch ++++++
From 8c275eef38bf7e3e592e4cb35a497522d1f15bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Wed, 16 Jul 2014 22:17:29 -0400 Subject: [PATCH] man: document yearly and annually in systemd.time(7)
https://bugs.freedesktop.org/show_bug.cgi?id=81158 --- man/systemd.time.xml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git man/systemd.time.xml man/systemd.time.xml index 0706cdf..02431a5 100644 --- man/systemd.time.xml +++ man/systemd.time.xml @@ -243,12 +243,16 @@ <para>The special expressions <literal>hourly</literal>, <literal>daily</literal>, - <literal>monthly</literal> and <literal>weekly</literal> - may be used as calendar events which refer to - <literal>*-*-* *:00:00</literal>, <literal>*-*-* - 00:00:00</literal>, <literal>*-*-01 00:00:00</literal> and - <literal>Mon *-*-* 00:00:00</literal>, - respectively.</para> + <literal>monthly</literal>, <literal>weekly</literal>, + and <literal>yearly</literal> or + <literal>annually</literal> may be used as calendar + events which refer to + <literal>*-*-* *:00:00</literal>, + <literal>*-*-* 00:00:00</literal>, + <literal>*-*-01 00:00:00</literal>, + <literal>Mon *-*-* 00:00:00</literal>, and + <literal>*-01-01 00:00:00</literal> respectively. + </para> <para>Examples for valid timestamps and their normalized form:</para> @@ -277,6 +281,8 @@ Wed-Sat,Tue 12-10-15 1:2:3 → Tue-Sat 2012-10-15 01:02:03 daily → *-*-* 00:00:00 monthly → *-*-01 00:00:00 weekly → Mon *-*-* 00:00:00 + yearly → *-01-01 00:00:00 + annually → *-01-01 00:00:00 *:2/3 → *-*-* *:02/3:00</programlisting> <para>Calendar events are used by timer units, see -- 1.7.9.2 ++++++ 0002-man-note-that-entire-sections-can-now-be-ignored.patch ++++++
From 2bcc2523711e69e6daa744641e56ed8b78646676 Mon Sep 17 00:00:00 2001 From: Michael Marineau <michael.marineau@coreos.com> Date: Sat, 17 May 2014 16:09:08 -0700 Subject: [PATCH] man: note that entire sections can now be ignored
Prefixing a section name with "X-" will cause it and all of its contents to be silently ignored as of commit 342aea19. --- man/systemd.unit.xml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git man/systemd.unit.xml man/systemd.unit.xml index 157530b..e903156 100644 --- man/systemd.unit.xml +++ man/systemd.unit.xml @@ -139,10 +139,12 @@ <para>Unit files may contain additional options on top of those listed here. If systemd encounters an unknown option, it will write a warning log message but - continue loading the unit. If an option is prefixed - with <option>X-</option>, it is ignored completely by - systemd. Applications may use this to include - additional information in the unit files.</para> + continue loading the unit. If an option or section name + is prefixed with <option>X-</option>, it is ignored + completely by systemd. Options within an ignored + section do not need the prefix. Applications may use + this to include additional information in the unit + files.</para> <para>Boolean arguments used in unit files can be written in various formats. For positive settings the -- 1.7.9.2 ++++++ 0002-man-tmpfiles.d-recommend-using-b-and-c.patch ++++++ diff -Naur systemd-210/man/tmpfiles.d.xml systemd-210-mod/man/tmpfiles.d.xml --- systemd-210/man/tmpfiles.d.xml 2014-12-16 10:16:51.269189374 +0100 +++ systemd-210-mod/man/tmpfiles.d.xml 2014-12-16 10:39:49.937552189 +0100 @@ -158,12 +158,18 @@ <varlistentry> <term><varname>c</varname></term> - <listitem><para>Create a character device node if it does not exist yet.</para></listitem> + <listitem><para>Create a character device node if it does not exist yet. + It is recommended to suffix this entry with an exclamation mark to only + create static device nodes at boot, as udev will not manage static device + nodes that are created at runtime.</para></listitem> </varlistentry> <varlistentry> <term><varname>b</varname></term> - <listitem><para>Create a block device node if it does not exist yet.</para></listitem> + <listitem><para>Create a block device node if it does not exist yet. + It is recommended to suffix this entry with an exclamation mark to only + create static device nodes at boot, as udev will not manage static device + nodes that re created at runtime.</para></listitem> </varlistentry> <varlistentry> ++++++ 0002-manager-flush-memory-stream-before-using-the-buffer.patch ++++++
From b2cdc6664ef6b56e47d38649d69b9943d9f9f5d0 Mon Sep 17 00:00:00 2001 From: Daniel Mack <zonque@gmail.com> Date: Fri, 7 Mar 2014 14:43:59 +0100 Subject: [PATCH] manager: flush memory stream before using the buffer
When the manager receives a SIGUSR2 signal, it opens a memory stream with open_memstream(), uses the returned file handle for logging, and dumps the logged content with log_dump(). However, the char* buffer is only safe to use after the file handle has been flushed with fflush, as the man pages states: When the stream is closed (fclose(3)) or flushed (fflush(3)), the locations pointed to by ptr and sizeloc are updated to contain, respectively, a pointer to the buffer and the current size of the buffer. These values remain valid only as long as the caller performs no further output on the stream. If further output is performed, then the stream must again be flushed before trying to access these variables. Without that call, dump remains NULL and the daemon crashes in log_dump(). --- src/core/manager.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git src/core/manager.c src/core/manager.c index 27a1cc6..78f4f3d 100644 --- src/core/manager.c +++ src/core/manager.c @@ -1621,6 +1621,11 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t break; } + if (fflush(f)) { + log_warning("Failed to flush status stream"); + break; + } + log_dump(LOG_INFO, dump); break; } -- 1.7.9.2 ++++++ 0002-namespace-fix-uninitialized-memory-access.patch ++++++ Based on 002b226843e77630128da580225f9c3ef8474db2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 3 Jul 2014 16:27:53 +0200 Subject: [PATCH] namespace: fix uninitialized memory access --- src/core/namespace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- src/core/namespace.c +++ src/core/namespace.c 2014-07-04 00:00:00.000000000 +0000 @@ -68,6 +68,7 @@ static int append_mounts(BindMount **p, STRV_FOREACH(i, strv) { (*p)->ignore = false; + (*p)->done = false; if ((mode == INACCESSIBLE || mode == READONLY) && (*i)[0] == '-') { (*p)->ignore = true; @@ -298,7 +299,7 @@ int setup_namespace( private_dev; if (n > 0) { - m = mounts = (BindMount *) alloca(n * sizeof(BindMount)); + m = mounts = (BindMount *) alloca0(n * sizeof(BindMount)); r = append_mounts(&m, read_write_dirs, READWRITE); if (r < 0) return r; ++++++ 0002-namespace-when-setting-up-an-inaccessible-mount-poin.patch ++++++ Based on 6d313367d9ef780560e117e886502a99fa220eac Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 5 Jun 2014 21:35:35 +0200 Subject: [PATCH] namespace: when setting up an inaccessible mount point, unmounting everything below This has the benefit of not triggering any autofs mount points unnecessarily. --- src/core/namespace.c | 6 ++++ src/shared/util.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/shared/util.h | 2 + 3 files changed, 76 insertions(+) --- src/core/namespace.c +++ src/core/namespace.c 2014-06-11 00:00:00.000000000 +0000 @@ -220,6 +220,12 @@ static int apply_mount( return mount_dev(m); case INACCESSIBLE: + + /* First, get rid of everything that is below if there + * is anything... Then, overmount it with an + * inaccessible directory. */ + umount_recursive(m->path, 0); + what = "/run/systemd/inaccessible"; break; --- src/shared/util.c +++ src/shared/util.c 2014-06-11 00:00:00.000000000 +0000 @@ -54,6 +54,7 @@ #include <grp.h> #include <sys/mman.h> #include <sys/vfs.h> +#include <sys/mount.h> #include <linux/magic.h> #include <limits.h> #include <langinfo.h> @@ -4635,6 +4636,73 @@ char *strjoin(const char *x, ...) { return r; } +int umount_recursive(const char *prefix, int flags) { + bool again; + int n = 0, r; + + /* Try to umount everything recursively below a + * directory. Also, take care of stacked mounts, and keep + * unmounting them until they are gone. */ + + do { + _cleanup_fclose_ FILE *proc_self_mountinfo = NULL; + + again = false; + r = 0; + + proc_self_mountinfo = fopen("/proc/self/mountinfo", "re"); + if (!proc_self_mountinfo) + return -errno; + + for (;;) { + _cleanup_free_ char *path = NULL, *p = NULL; + int k; + + k = fscanf(proc_self_mountinfo, + "%*s " /* (1) mount id */ + "%*s " /* (2) parent id */ + "%*s " /* (3) major:minor */ + "%*s " /* (4) root */ + "%ms " /* (5) mount point */ + "%*s" /* (6) mount options */ + "%*[^-]" /* (7) optional fields */ + "- " /* (8) separator */ + "%*s " /* (9) file system type */ + "%*s" /* (10) mount source */ + "%*s" /* (11) mount options 2 */ + "%*[^\n]", /* some rubbish at the end */ + &path); + + if (k != 1) { + if (k == EOF) + break; + + continue; + } + + p = cunescape(path); + if (!p) + return -ENOMEM; + + if (!path_startswith(p, prefix)) + continue; + + if (umount2(p, flags) < 0) { + r = -errno; + continue; + } + + again = true; + n++; + + break; + } + + } while (again); + + return r ? r : n; +} + bool is_main_thread(void) { static thread_local int cached = 0; --- src/shared/util.h +++ src/shared/util.h 2014-06-11 10:10:08.000000000 +0000 @@ -890,3 +890,5 @@ union file_handle_union { struct file_handle handle; char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ]; }; + +int umount_recursive(const char *target, int flags); ++++++ 0002-nspawn-restore-journal-directory-is-empty-check.patch ++++++
From cdb2b9d05a2f3d649f47bd2ba24eb3fe30b52e92 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 22 May 2014 15:19:46 +0900 Subject: [PATCH] nspawn: restore journal directory is empty check
This undoes part of commit e6a4a517befe559adf6d1dbbadf425c3538849c9. Instead of removing the error message about non-empty journal bind mount directories, simply downgrade the message to a warning and proceed. --- src/nspawn/nspawn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git src/nspawn/nspawn.c src/nspawn/nspawn.c index ef84664..eb9c5e0 100644 --- src/nspawn/nspawn.c +++ src/nspawn/nspawn.c @@ -1143,6 +1143,9 @@ static int setup_journal(const char *directory) { } else if (access(p, F_OK) < 0) return 0; + if (dir_is_empty(q) == 0) + log_warning("%s is not empty, proceeding anyway.", q); + r = mkdir_p(q, 0755); if (r < 0) { log_error("Failed to create %s: %m", q); -- 1.7.9.2 ++++++ 0002-pam_systemd-use-F_DUPFD_CLOEXEC-when-dupping-session.patch ++++++
From 85c08dc013f9f99b58bc9b79284af0b35304237b Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 13 May 2014 16:35:34 +0200 Subject: [PATCH] pam_systemd: use F_DUPFD_CLOEXEC when dupping session fds
http://lists.freedesktop.org/archives/systemd-devel/2014-May/019034.html --- src/login/pam-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/login/pam-module.c src/login/pam-module.c index 9873dd5..1259457 100644 --- src/login/pam-module.c +++ src/login/pam-module.c @@ -475,7 +475,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( } if (session_fd >= 0) { - session_fd = dup(session_fd); + session_fd = fcntl(session_fd, F_DUPFD_CLOEXEC, 3); if (session_fd < 0) { pam_syslog(handle, LOG_ERR, "Failed to dup session fd: %m"); return PAM_SESSION_ERR; -- 1.7.9.2 ++++++ 0002-rfkill-rework-how-we-generate-file-names-from-rfkill.patch ++++++ Based on 4844262f25a3ff6bd23de05a0a6f84a8e2983d74 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 3 Dec 2014 02:02:11 +0100 Subject: [PATCH] rfkill: rework how we generate file names from rfkill devices Generate the file name from ID_PATH plus the rfkill type (wlan, bluetooth, ...) and ignore the rfkill device name, since it apparently is not a stable identifier. Also, ensure that devices disappearing don't result in broken services, simply exit cleanly. --- src/rfkill/rfkill.c | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) --- src/rfkill/rfkill.c +++ src/rfkill/rfkill.c 2014-12-05 12:05:59.053518122 +0000 @@ -28,8 +28,8 @@ int main(int argc, char *argv[]) { _cleanup_udev_unref_ struct udev *udev = NULL; _cleanup_udev_device_unref_ struct udev_device *device = NULL; - _cleanup_free_ char *saved = NULL, *escaped_name = NULL, *escaped_path_id = NULL; - const char *name, *path_id; + _cleanup_free_ char *saved = NULL, *escaped_type = NULL, *escaped_path_id = NULL; + const char *name, *type, *path_id; int r; if (argc != 3) { @@ -55,25 +55,28 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - errno = 0; device = udev_device_new_from_subsystem_sysname(udev, "rfkill", argv[2]); if (!device) { - if (errno != 0) - log_error("Failed to get rfkill device '%s': %m", argv[2]); - else - log_oom(); - - return EXIT_FAILURE; + log_debug("Failed to get rfkill device '%s', ignoring: %m", argv[2]); + return EXIT_SUCCESS; } name = udev_device_get_sysattr_value(device, "name"); if (!name) { - log_error("rfkill device has no name?"); - return EXIT_FAILURE; + log_error("rfkill device has no name? Ignoring device."); + return EXIT_SUCCESS; + } + + log_debug("Operating on rfkill device '%s'.", name); + + type = udev_device_get_sysattr_value(device, "type"); + if (!type) { + log_error("rfkill device has no type? Ignoring device."); + return EXIT_SUCCESS; } - escaped_name = cescape(name); - if (!escaped_name) { + escaped_type = cescape(type); + if (!escaped_type) { log_oom(); return EXIT_FAILURE; } @@ -86,9 +89,9 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - saved = strjoin("/var/lib/systemd/rfkill/", escaped_path_id, ":", escaped_name, NULL); + saved = strjoin("/var/lib/systemd/rfkill/", escaped_path_id, ":", escaped_type, NULL); } else - saved = strjoin("/var/lib/systemd/rfkill/", escaped_name, NULL); + saved = strjoin("/var/lib/systemd/rfkill/", escaped_type, NULL); if (!saved) { log_oom(); @@ -102,19 +105,17 @@ int main(int argc, char *argv[]) { return EXIT_SUCCESS; r = read_one_line_file(saved, &value); + if (r == -ENOENT) + return EXIT_SUCCESS; if (r < 0) { - - if (r == -ENOENT) - return EXIT_SUCCESS; - log_error("Failed to read %s: %s", saved, strerror(-r)); return EXIT_FAILURE; } r = udev_device_set_sysattr_value(device, "soft", value); if (r < 0) { - log_error("Failed to write system attribute: %s", strerror(-r)); - return EXIT_FAILURE; + log_debug("Failed to write 'soft' attribute on rfkill device, ignoring: %s", strerror(-r)); + return EXIT_SUCCESS; } } else if (streq(argv[1], "save")) { @@ -122,8 +123,8 @@ int main(int argc, char *argv[]) { value = udev_device_get_sysattr_value(device, "soft"); if (!value) { - log_error("Failed to read system attribute: %s", strerror(-r)); - return EXIT_FAILURE; + log_debug("Failed to read system attribute, ignoring device: %s", strerror(-r)); + return EXIT_SUCCESS; } r = write_string_file(saved, value); ++++++ 0002-shell-completion-prevent-mangling-unit-names.patch ++++++ Based on 6d314eca15f6cbda38d82774b210f784d3d4f52a Mon Sep 17 00:00:00 2001 From: Eric Cook <llua@gmx.com> Date: Sat, 26 Jul 2014 11:15:52 -0400 Subject: [PATCH] shell-completion: prevent mangling unit names Units with literal hex '\xFF' in their names has to be read and printed properly. dev-disk-byx2dlabel-root.device != dev-disk-by\x2dlabel-root.device --- shell-completion/zsh/_systemctl.in | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git shell-completion/zsh/_systemctl.in shell-completion/zsh/_systemctl.in index d364d17..e681ec6 100644 --- shell-completion/zsh/_systemctl +++ shell-completion/zsh/_systemctl @@ -100,7 +100,7 @@ _systemctl_all_units() if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) && ! _retrieve_cache SYS_ALL_UNITS; then - _sys_all_units=( $(__systemctl list-units --all | { while read a b; do echo " $a"; done; }) ) + _sys_all_units=( $(__systemctl list-units --all | { while read -r a b; do echo -E - " $a"; done; }) ) _store_cache SYS_ALL_UNITS _sys_all_units fi } @@ -113,7 +113,7 @@ _systemctl_really_all_units() if ( [[ ${+_sys_really_all_units} -eq 0 ]] || _cache_invalid SYS_REALLY_ALL_UNITS ) && ! _retrieve_cache SYS_REALLY_ALL_UNITS; then - all_unit_files=( $(__systemctl list-unit-files | { while read a b; do echo " $a"; done; }) ) + all_unit_files=( $(__systemctl list-unit-files | { while read -r a b; do echo -E - " $a"; done; }) ) _systemctl_all_units really_all_units=($_sys_all_units $all_unit_files) _sys_really_all_units=(${(u)really_all_units}) @@ -138,12 +138,12 @@ _filter_units_by_property() { done } -_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read a b; do echo " $a"; done; }) )} -_systemctl_inactive_units(){_sys_inactive_units=($(__systemctl list-units --all | { while read a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }) )} -_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read a b; do echo " $a"; done; }) )} -_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files | { while read a b; do [[ $b == "enabled" ]] && echo " $a"; done; }) )} -_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read a b; do [[ $b == "disabled" ]] && echo " $a"; done; }) )} -_systemctl_masked_units() {_sys_masked_units=( $(__systemctl list-unit-files | { while read a b; do [[ $b == "masked" ]] && echo " $a"; done; }) )} +_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read -r a b; do echo -E - " $a"; done; }) )} +_systemctl_inactive_units(){_sys_inactive_units=($(__systemctl list-units --all | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo -E - " $a"; done; }) )} +_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read -r a b; do echo -E - " $a"; done; }) )} +_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files | { while read -r a b; do [[ $b == "enabled" ]] && echo -E - " $a"; done; }) )} +_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read -r a b; do [[ $b == "disabled" ]] && echo -E - " $a"; done; }) )} +_systemctl_masked_units() {_sys_masked_units=( $(__systemctl list-unit-files | { while read -r a b; do [[ $b == "masked" ]] && echo -E - " $a"; done; }) )} # Completion functions for ALL_UNITS for fun in is-active is-failed is-enabled status show cat mask preset help list-dependencies ; do @@ -219,8 +219,8 @@ for fun in restart reload-or-restart ; do { _systemctl_all_units compadd "$@" - $( _filter_units_by_property CanStart yes \ - ${_sys_all_units[*]} | while read line; do \ - [[ "$line" =~ \.device$ ]] || echo " $line"; \ + ${_sys_all_units[*]} | while read -r line; do \ + [[ "$line" =~ \.device$ ]] || echo -E - " $line"; \ done ) } done -- 1.7.9.2 ++++++ 0002-shell-completion-propose-templates-for-disable-re-en.patch ++++++ Based on e9a19bd882ff8a2c8aef5c63b39525ea231e5fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 14 Oct 2014 21:10:02 -0400 Subject: [PATCH] shell-completion: propose templates for disable/[re]enable/[re]start Templates can be [re]enabled, on their own if the have DefaultInstance set, and with an instance suffix in all cases. Propose just the template name ending in @, to underline the instance suffix may have to be appended. Likewise for start/restart. This means that sometimes superflous units that one will not really want to operate on will be proposed, but this seems better than proposing a very incomplete set of names. https://bugs.freedesktop.org/show_bug.cgi?id=66912 --- shell-completion/bash/systemctl | 15 +++++++++++---- shell-completion/zsh/_systemctl | 20 +++++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-) --- shell-completion/bash/systemctl +++ shell-completion/bash/systemctl @@ -53,6 +53,9 @@ __filter_units_by_property () { __get_all_units () { { __systemctl $1 list-unit-files; __systemctl $1 list-units --all; } \ | { while read -r a b; do echo " $a"; done; }; } +__get_template_names () { __systemctl $1 list-unit-files \ + | { while read -r a b; do [[ $a =~ @\. ]] && echo " ${a%%@.*}@"; done; }; } + __get_active_units () { __systemctl $1 list-units \ | { while read -r a b; do echo " $a"; done; }; } __get_startable_units () { @@ -169,22 +172,26 @@ _systemctl () { compopt -o filenames elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then - comps=$( __get_disabled_units $mode ) + comps=$( __get_disabled_units $mode; + __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[REENABLABLE_UNITS]}; then comps=$( __get_disabled_units $mode; - __get_enabled_units $mode ) + __get_enabled_units $mode; + __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then comps=$( __filter_units_by_property $mode CanStart yes \ - $( __get_startable_units $mode)) + $( __get_startable_units $mode); + __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then comps=$( __filter_units_by_property $mode CanStart yes \ - $( __get_restartable_units $mode)) + $( __get_restartable_units $mode); \ + __get_template_names $mode) compopt -o filenames elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then --- shell-completion/zsh/_systemctl +++ shell-completion/zsh/_systemctl @@ -139,6 +139,8 @@ _filter_units_by_property() { } _systemctl_all_units() { { __systemctl list-unit-files; __systemctl list-units --all; } | { while read -r a b; do echo -E - " $a"; done; } } +_systemctl_get_template_names() { __systemctl list-unit-files | { while read -r a b; do [[ $a =~ @\. ]] && echo -E - " ${a%%@.*}@"; done; } } + _systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read -r a b; do echo -E - " $a"; done; }) )} _systemctl_startable_units(){_sys_startable_units=($(__systemctl list-units --state inactive,failed -- $(_systemctl_all_units) | { while read -r a b c d; do [[ $b == "loaded" ]] && echo -E - " $a"; done; }) )} @@ -158,20 +160,24 @@ for fun in is-active is-failed is-enabled status show cat mask preset help list- done # Completion functions for ENABLED_UNITS -for fun in disable reenable ; do - (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() - { +(( $+functions[_systemctl_disable] )) || _systemctl_disable() +{ + _systemctl_enabled_units + compadd "$@" -a - _sys_enabled_units +} + +(( $+functions[_systemctl_reenable] )) || _systemctl_reenable() +{ _systemctl_enabled_units _systemctl_disabled_units - compadd "$@" -a - _sys_enabled_units _sys_disabled_units - } -done + compadd "$@" -a - _sys_enabled_units _sys_disabled_units $(_systemctl_get_template_names) +} # Completion functions for DISABLED_UNITS (( $+functions[_systemctl_enable] )) || _systemctl_enable() { _systemctl_disabled_units - compadd "$@" -a - _sys_disabled_units + compadd "$@" -a - _sys_disabled_units $(_systemctl_get_template_names) } # Completion functions for FAILED_UNITS -- 1.7.9.2 ++++++ 0002-shutdown-fix-arguments-to-run-initramfs-shutdown.patch ++++++ Based on 4b5d8d0f22ae61ceb45a25391354ba53b43ee992 Mon Sep 17 00:00:00 2001 From: Michal Schmidt <mschmidt@redhat.com> Date: Thu, 6 Nov 2014 22:24:13 +0100 Subject: [PATCH] shutdown: fix arguments to /run/initramfs/shutdown Our initrd interface specifies that the verb is in argv[1]. This is where systemd passes it to systemd-shutdown, but getopt permutes argv[]. This confuses dracut's shutdown script: Shutdown called with argument '--log-level'. Rebooting! getopt can be convinced to not permute argv[] by having '-' as the first character of optstring. Let's use it. This requires changing the way non-option arguments (in our case, the verb) are processed. This fixes a bug where the system would reboot instead of powering off. --- src/core/shutdown.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) --- src/core/shutdown.c +++ src/core/shutdown.c 2014-11-10 14:14:20.869519112 +0000 @@ -75,9 +75,9 @@ static int parse_argv(int argc, char *ar assert(argc >= 1); assert(argv); - opterr = 0; - - while ((c = getopt_long(argc, argv, ":", options, NULL)) >= 0) + /* "-" prevents getopt from permuting argv[] and moving the verb away + * from argv[1]. Our interface to initrd promises it'll be there. */ + while ((c = getopt_long(argc, argv, "-", options, NULL)) >= 0) switch (c) { case ARG_LOG_LEVEL: @@ -115,27 +115,25 @@ static int parse_argv(int argc, char *ar break; - case '?': - log_error("Unknown option %s.", argv[optind-1]); - return -EINVAL; + case '\001': + if (!arg_verb) + arg_verb = optarg; + else + log_error("Excess arguments, ignoring"); + break; - case ':': - log_error("Missing argument to %s.", argv[optind-1]); + case '?': return -EINVAL; default: assert_not_reached("Unhandled option code."); } - if (optind >= argc) { + if (!arg_verb) { log_error("Verb argument missing."); return -EINVAL; } - arg_verb = argv[optind]; - - if (optind + 1 < argc) - log_error("Excess arguments, ignoring"); return 0; } ++++++ 0002-shutdown-pass-own-argv-to-run-initramfs-shutdown.patch ++++++ Based on a2726e5cedfa5edeabd7e0784be11bc578555ac5 Mon Sep 17 00:00:00 2001 From: Marius Tessmann <mus.svz@gmail.com> Date: Fri, 29 Aug 2014 17:51:45 +0200 Subject: [PATCH] shutdown: pass own argv to /run/initramfs/shutdown Since commit b1e90ec515408aec2702522f6f68c4920b56375b systemd passes its log settings to systemd-shutdown via command line parameters. However, systemd-shutdown doesn't pass these parameters to /run/initramfs/shutdown, causing it to fall back to the default log settings. This fixes the following bugs about the shutdown not being quiet despite "quiet" being in the kernel parameters: https://bugs.freedesktop.org/show_bug.cgi?id=79582 https://bugs.freedesktop.org/show_bug.cgi?id=57216 --- src/core/shutdown.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- src/core/shutdown.c +++ src/core/shutdown.c 2014-10-24 12:32:44.704337960 +0000 @@ -377,11 +377,11 @@ int main(int argc, char *argv[]) { if (prepare_new_root() >= 0 && pivot_to_new_root() >= 0) { - arguments[0] = (char*) "/shutdown"; + argv[0] = (char*) "/shutdown"; log_info("Returning to initrd..."); - execv("/shutdown", arguments); + execv("/shutdown", argv); log_error("Failed to execute shutdown binary: %m"); } } ++++++ 0002-snapshot-return-error-when-snapshot-exists.patch ++++++
From 7cabba07745b388497e8c0fc19b61984167fd474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 28 Oct 2014 12:36:17 -0400 Subject: [PATCH] snapshot: return error when snapshot exists
--- src/core/snapshot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/core/snapshot.c src/core/snapshot.c index 5eed615..c2678cb 100644 --- src/core/snapshot.c +++ src/core/snapshot.c @@ -208,7 +208,7 @@ int snapshot_create(Manager *m, const char *name, bool cleanup, sd_bus_error *e, return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Unit name %s lacks snapshot suffix.", name); if (manager_get_unit(m, name)) - sd_bus_error_setf(e, BUS_ERROR_UNIT_EXISTS, "Snapshot %s exists already.", name); + return sd_bus_error_setf(e, BUS_ERROR_UNIT_EXISTS, "Snapshot %s exists already.", name); } else { -- 1.7.9.2 ++++++ 0002-switch-root-umount-the-old-root-correctly.patch ++++++ Based on 23f25b1496c31ef4c20b8f3ee8328f7b1d5f3a54 Mon Sep 17 00:00:00 2001 From: Dan Dedrick <dan.dedrick@gmail.com> Date: Tue, 29 Jul 2014 15:31:23 -0400 Subject: [PATCH] switch-root: umount the old root correctly The unmount occurs after the pivot_root, so the path used to unmount should take into account the new root directory. This will allow the umount to actually succeed. --- src/core/switch-root.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- src/core/switch-root.c +++ src/core/switch-root.c 2014-08-22 11:22:50.230735231 +0000 @@ -122,9 +122,9 @@ int switch_root(const char *new_root) { /* Immediately get rid of the old root. Since we are * running off it we need to do this lazily. */ - if (umount2(temporary_old_root, MNT_DETACH) < 0) { + if (umount2("/mnt", MNT_DETACH) < 0) { r = -errno; - log_error("Failed to umount old root dir %s: %m", temporary_old_root); + log_error("Failed to umount old root dir /mnt: %m"); goto fail; } ++++++ 0002-sysctl-replaces-some-slashes-with-dots.patch ++++++
From 2e573fcf8754fdfe0db0a783b1631ec1679b063a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Wed, 16 Apr 2014 21:33:46 -0400 Subject: [PATCH] sysctl: replaces some slashes with dots
It turns out that plain sysctl understands a.b/c syntax to write to /proc/sys/a/b.c. Support this for compatibility. https://bugs.freedesktop.org/show_bug.cgi?id=77466 --- man/sysctl.d.xml | 29 +++++++++++++++++++++-------- src/sysctl/sysctl.c | 18 ++++++++++++++++-- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git man/sysctl.d.xml man/sysctl.d.xml index 00a857b..db53b49 100644 --- man/sysctl.d.xml +++ man/sysctl.d.xml @@ -68,13 +68,26 @@ <para>The configuration files contain a list of variable assignments, separated by newlines. Empty lines and lines whose first non-whitespace character - is # or ; are ignored.</para> - - <para>Note that both / and . are accepted as label - separators within sysctl variable - names. <literal>kernel.domainname=foo</literal> and - <literal>kernel/domainname=foo</literal> hence are - entirely equivalent.</para> + is <literal>#</literal> or <literal>;</literal> are + ignored.</para> + + <para>Note that either <literal>/</literal> or + <literal>.</literal> may be used as separators within + sysctl variable names. If the first separator is a + slash, remaining slashes and dots are left intact. If + the first separator is a dot, dots and slashes are + interchanged. <literal>kernel.domainname=foo</literal> + and <literal>kernel/domainname=foo</literal> are + equivalent and will cause <literal>foo</literal> to + be written to + <filename>/proc/sys/kernel/domainname</filename>. + Either + <literal>net.ipv4.conf.enp3s0/200.forwarding</literal> + or + <literal>net/ipv4/conf/enp3s0.200/forwarding</literal> + may be used to refer to + <filename>/proc/sys/net/ipv4/conf/enp3s0.200/forwarding</filename>. + </para> <para>Each configuration file shall be named in the style of <filename><replaceable>program</replaceable>.conf</filename>. @@ -109,7 +122,7 @@ early on boot. The network interface-specific options will also be applied individually for each network interface as it shows up in the system. (More - specifically, that is + specifically, <filename>net.ipv4.conf.*</filename>, <filename>net.ipv6.conf.*</filename>, <filename>net.ipv4.neigh.*</filename> and <filename>net.ipv6.neigh.*</filename>)</para> diff --git src/sysctl/sysctl.c src/sysctl/sysctl.c index 283eefe..06defa5 100644 --- src/sysctl/sysctl.c +++ src/sysctl/sysctl.c @@ -48,12 +48,26 @@ static const char conf_file_dirs[] = #endif ; -static char *normalize_sysctl(char *s) { +static char* normalize_sysctl(char *s) { char *n; - for (n = s; *n; n++) + n = strpbrk(s, "/."); + /* If the first separator is a slash, the path is + * assumed to be normalized and slashes remain slashes + * and dots remains dots. */ + if (!n || *n == '/') + return s; + + /* Otherwise, dots become slashes and slashes become + * dots. Fun. */ + while (n) { if (*n == '.') *n = '/'; + else + *n = '.'; + + n = strpbrk(n + 1, "/."); + } return s; } -- 1.7.9.2 ++++++ 0002-systemctl-obey-state-in-list-unit-files.patch ++++++
From fec1530e6b5b8d6dc352c7338010357126e84621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Wed, 29 Oct 2014 22:51:00 -0400 Subject: [PATCH] systemctl: obey --state in list-unit-files
--- src/systemctl/systemctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c index b71040b..8481a9b 100644 --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c @@ -1268,6 +1268,11 @@ next: return false; } + if (!strv_isempty(arg_states)) { + if (!strv_find(arg_states, unit_file_state_to_string(u->state))) + return false; + } + return true; } -- 1.7.9.2 ++++++ 0002-systemctl-show-BindsTo-BoundBy-in-list-dependencies.patch ++++++
From c469089cf647ac740c7dcf09c463d2907b6d00eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 22 Nov 2014 20:21:56 -0500 Subject: [PATCH] systemctl: show BindsTo/BoundBy in list-dependencies
Suggested-by: Peter Mattern <matternp@arcor.de> http://lists.freedesktop.org/archives/systemd-devel/2014-November/025437.htm... --- src/systemctl/systemctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c index 78b7c96..fd69c69 100644 --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c @@ -1480,11 +1480,13 @@ static int list_dependencies_get_dependencies(sd_bus *bus, const char *name, cha "RequiresOverridable\0" "Requisite\0" "RequisiteOverridable\0" - "Wants\0", + "Wants\0" + "BindsTo\0", [DEPENDENCY_REVERSE] = "RequiredBy\0" "RequiredByOverridable\0" "WantedBy\0" - "PartOf\0", + "PartOf\0" + "BoundBy\0", [DEPENDENCY_AFTER] = "After\0", [DEPENDENCY_BEFORE] = "Before\0", }; -- 1.7.9.2 ++++++ 0002-systemctl-update-NAME-to-PATTERN-in-help.patch ++++++
From b3ae710c251d0ce5cf2cef63208e325497b5e323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 1 Apr 2014 20:43:15 -0400 Subject: [PATCH] systemctl: update NAME to PATTERN in help()
Previously the man page was modified, but not help(). --- TODO | 2 ++ src/systemctl/systemctl.c | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git TODO TODO index 4ff69ff..0343b94 100644 --- TODO +++ TODO @@ -1,4 +1,6 @@ Bugfixes: +* Should systemctl status \* work on all unit types, not just .service? + * enabling an instance unit creates a pointless link, and the unit will be started with getty@getty.service: $ systemctl enable getty@.service diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c index 6b88f85..653a324 100644 --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c @@ -5403,15 +5403,15 @@ static int systemctl_help(void) { " otherwise restart if active\n" " isolate NAME Start one unit and stop all others\n" " kill NAME... Send signal to processes of a unit\n" - " is-active NAME... Check whether units are active\n" - " is-failed NAME... Check whether units are failed\n" - " status [NAME...|PID...] Show runtime status of one or more units\n" - " show [NAME...|JOB...] Show properties of one or more\n" + " is-active PATTERN... Check whether units are active\n" + " is-failed PATTERN... Check whether units are failed\n" + " status [PATTERN...|PID...] Show runtime status of one or more units\n" + " show [PATTERN...|JOB...] Show properties of one or more\n" " units/jobs or the manager\n" - " cat NAME... Show files and drop-ins of one or more units\n" + " cat PATTERN... Show files and drop-ins of one or more units\n" " set-property NAME ASSIGNMENT... Sets one or more properties of a unit\n" - " help NAME...|PID... Show manual for one or more units\n" - " reset-failed [NAME...] Reset failed state for all, one, or more\n" + " help PATTERN...|PID... Show manual for one or more units\n" + " reset-failed [PATTERN...] Reset failed state for all, one, or more\n" " units\n" " list-dependencies [NAME] Recursively show units which are required\n" " or wanted by this unit or by which this\n" -- 1.7.9.2 ++++++ 0002-systemd-fix-error-message.patch ++++++ Based on 6ad3b2b62cbe34cc02ee98deb5f48047f5e42d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 30 Aug 2014 17:22:42 -0400 Subject: [PATCH] systemd: fix error message --- src/core/dbus-manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- src/core/dbus-manager.c +++ src/core/dbus-manager.c 2014-09-01 12:51:33.266735961 +0000 @@ -1114,7 +1114,7 @@ static int method_switch_root(sd_bus *bu return r; if (m->running_as != SYSTEMD_SYSTEM) - return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "KExec is only supported for system managers."); + return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Root switching is only supported by system manager."); r = sd_bus_message_read(message, "ss", &root, &init); if (r < 0) @@ -1125,7 +1125,7 @@ static int method_switch_root(sd_bus *bu /* Safety check */ if (isempty(init)) { - if (! path_is_os_tree(root)) + if (!path_is_os_tree(root)) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Specified switch root path %s does not seem to be an OS tree. /etc/os-release is missing.", root); } else { _cleanup_free_ char *p = NULL; ++++++ 0002-systemd-try-harder-to-bind-to-notify-socket.patch ++++++ Based on e7bc519620cb7bcdbe2166fc2a446453769d827e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Thu, 16 Oct 2014 19:15:38 -0500 Subject: [PATCH] systemd: try harder to bind to notify socket Without the socket open we are going to crash and burn. If for whatever reason we fail during deserialization we will fail when trying to open the socket. In this case it is better to unlink the old socket and maybe lose some messages, than to continue without the notification socket. Of course this situation should not happen, but we should handle it as gracefully as possible anyway. https://bugzilla.redhat.com/show_bug.cgi?id=1099299 --- src/core/manager.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) --- src/core/manager.c +++ src/core/manager.c 2014-10-20 13:47:21.035837897 +0000 @@ -572,7 +572,21 @@ static int manager_setup_notify(Manager r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1)); if (r < 0) { log_error("bind(@%s) failed: %m", sa.un.sun_path+1); - return -errno; + if (errno == EADDRINUSE) { + log_notice("Removing %s socket and trying again.", m->notify_socket); + r = unlink(m->notify_socket); + if (r < 0) { + log_error("Failed to remove %s: %m", m->notify_socket); + return -EADDRINUSE; + } + + r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)); + if (r < 0) { + log_error("bind(@%s) failed: %m", sa.un.sun_path+1); + return -errno; + } + } else + return -errno; } r = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)); ++++++ 0002-time-also-support-infinity-syntax-in-parse_nsec.patch ++++++ Based on e73c78c27511b03c7abc55aed87896092c0de699 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 24 Oct 2014 19:07:26 +0200 Subject: [PATCH] time: also support 'infinity' syntax in parse_nsec() Let's make parse_usec() and parse_nsec() work similar --- src/shared/time-util.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- src/shared/time-util.c +++ src/shared/time-util.c @@ -773,7 +773,7 @@ int parse_nsec(const char *t, nsec_t *nsec) { { "", 1ULL }, /* default is nsec */ }; - const char *p; + const char *p, *s; nsec_t r = 0; bool something = false; @@ -781,6 +781,18 @@ int parse_nsec(const char *t, nsec_t *nsec) { assert(nsec); p = t; + + p += strspn(p, WHITESPACE); + s = startswith(p, "infinity"); + if (s) { + s += strspn(s, WHITESPACE); + if (!*s != 0) + return -EINVAL; + + *nsec = ((nsec_t) -1); + return 0; + } + for (;;) { long long l, z = 0; char *e; ++++++ 0002-udev-hwdb-New-Entry-for-Dell-XPS12-9Q33-keyboard.patch ++++++
From 24119cf10c7ed58a8fc0851745149dcc6dd5757f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de> Date: Mon, 29 Sep 2014 22:32:10 -0400 Subject: [PATCH] udev/hwdb: New Entry for Dell XPS12 9Q33 keyboard
https://bugs.freedesktop.org/show_bug.cgi?id=84437 --- hwdb/60-keyboard.hwdb | 5 +++++ 1 file changed, 5 insertions(+) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index 0ffcb83..8a1baa7 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -243,6 +243,11 @@ keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnPrecision*:pvr* keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnXPS*:pvr* KEYBOARD_KEY_8c=!unknown +# Dell XPS12 9Q33 +keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnXPS12-9Q33*:pvr* + KEYBOARD_KEY_88=wlan + KEYBOARD_KEY_65=switchvideomode # Screen Rotate + # Dell Latitude microphone mute keyboard:name:Dell WMI hotkeys:dmi:bvn*:bvr*:bd*:svnDell*:pnLatitude* KEYBOARD_KEY_150=f20 # Mic mute toggle, should be micmute -- 1.7.9.2 ++++++ 0002-units-add-missing-caps-so-that-GetAddresses-can-work.patch ++++++ Basedo n a55954297dade7b432fd3a4f328f23261621ff79 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 19 Jun 2014 19:53:16 +0200 Subject: [PATCH] units: add missing caps so that GetAddresses() can work --- units/systemd-machined.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- units/systemd-machined.service.in +++ units/systemd-machined.service.in 2014-06-24 11:26:19.554235869 +0000 @@ -15,5 +15,5 @@ After=machine.slice [Service] ExecStart=@rootlibexecdir@/systemd-machined BusName=org.freedesktop.machine1 -CapabilityBoundingSet=CAP_KILL +CapabilityBoundingSet=CAP_KILL CAP_SYS_PTRACE CAP_SYS_ADMIN CAP_SETGID WatchdogSec=1min ++++++ 0002-units-order-systemd-fsck-.service-after-local-fs-pre.patch ++++++
From 66f311206e908a5b6f21e66fad73e1e5ea3e31d6 Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov <intelfx100@gmail.com> Date: Wed, 27 Aug 2014 00:17:43 +0400 Subject: [PATCH] units: order systemd-fsck@.service after local-fs-pre.target.
With this change, it becomes possible to order a unit to activate before any modifications to the file systems. This is especially useful for supporting resume from hibernation. --- units/systemd-fsck@.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git units/systemd-fsck@.service.in units/systemd-fsck@.service.in index c12efa8..d2cda6a 100644 --- units/systemd-fsck@.service.in +++ units/systemd-fsck@.service.in @@ -10,7 +10,7 @@ Description=File System Check on %f Documentation=man:systemd-fsck@.service(8) DefaultDependencies=no BindsTo=%i.device -After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device systemd-fsck-root.service +After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device systemd-fsck-root.service local-fs-pre.target Before=shutdown.target [Service] -- 1.7.9.2 ++++++ 0002-units-serial-getty-.service-use-the-default-RestartS.patch ++++++ Based on 4bf04322b8b7ecca4f3d65cfc642d0ac16356129 Mon Sep 17 00:00:00 2001 From: Michael Olbrich <m.olbrich@pengutronix.de> Date: Tue, 15 Jul 2014 18:28:10 +0200 Subject: [PATCH] units/serial-getty@.service: use the default RestartSec For pluggable ttys such as USB serial devices, the getty is restarted and exits in a loop until the remove event reaches systemd. Under certain circumstances the restart loop can overload the system in a way that prevents the remove event from reaching systemd for a long time (e.g. at least several minutes on a small embedded system). Use the default RestartSec to prevent the restart loop from overloading the system. Serial gettys are interactive units, so waiting an extra 100ms really doesn't make a difference anyways compared to the time it takes the user to log in. --- units/serial-getty@.service.m4 | 1 - 1 file changed, 1 deletion(-) --- units/serial-getty@.service.m4 +++ units/serial-getty@.service.m4 2014-07-16 00:00:00.000000000 +0000 @@ -27,7 +27,6 @@ ExecStart=-/sbin/agetty --keep-baud %I 1 ExecStopPost=-/sbin/vhangup /dev/%I Type=idle Restart=always -RestartSec=0 UtmpIdentifier=%I TTYPath=/dev/%I TTYReset=yes ++++++ 0002-util-avoid-non-portable-__WORDSIZE.patch ++++++ Based on 8507eb20b64010b26f23822cbf442bb0bf96511c Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing <systemd@esmil.dk> Date: Fri, 19 Sep 2014 20:26:53 +0200 Subject: [PATCH] util: avoid non-portable __WORDSIZE Lets not unnecessarily rely on __WORDSIZE, which is not clearly specified by any spec. Use explicit size comparisons if we're not interested in the WORDSIZE, anyway. (David: adjust commit message to explain why we do this) --- src/shared/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- src/shared/util.h +++ src/shared/util.h 2014-09-24 06:58:11.378235669 +0000 @@ -166,7 +166,7 @@ int safe_atolli(const char *s, long long int safe_atod(const char *s, double *ret_d); -#if __WORDSIZE == 32 +#if LONG_MAX == INT_MAX static inline int safe_atolu(const char *s, unsigned long *ret_u) { assert_cc(sizeof(unsigned long) == sizeof(unsigned)); return safe_atou(s, (unsigned*) ret_u); ++++++ 0002-util-don-t-consider-tabs-special-in-string_has_cc-an.patch ++++++
From 6294aa76d818e831de4592b41a37e225fd0871f9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 7 Jul 2014 12:04:55 +0200 Subject: [PATCH] util: don't consider tabs special in string_has_cc() anymore
Instead, take a list of exceptions to our usual CC check --- src/hostname/hostnamed.c | 3 +-- src/shared/env-util.c | 4 +++- src/shared/fileio.c | 2 +- src/shared/util.c | 19 ++++++++++--------- src/shared/util.h | 5 +++-- 5 files changed, 18 insertions(+), 15 deletions(-) Index: src/hostname/hostnamed.c =================================================================== --- src/hostname/hostnamed.c.orig +++ src/hostname/hostnamed.c @@ -507,8 +507,7 @@ static int set_machine_info(Context *c, if (prop == PROP_ICON_NAME && !filename_is_safe(name)) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid icon name '%s'", name); - if (prop == PROP_PRETTY_HOSTNAME && - (string_has_cc(name) || chars_intersect(name, "\t"))) + if (prop == PROP_PRETTY_HOSTNAME && string_has_cc(name, NULL)) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid pretty host name '%s'", name); if (prop == PROP_CHASSIS && !valid_chassis(name)) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid chassis '%s'", name); Index: src/shared/env-util.c =================================================================== --- src/shared/env-util.c.orig +++ src/shared/env-util.c @@ -78,7 +78,9 @@ bool env_value_is_valid(const char *e) { if (!utf8_is_valid(e)) return false; - if (string_has_cc(e)) + /* bash allows tabs in environment variables, and so should + * we */ + if (string_has_cc(e, "\t")) return false; /* POSIX says the overall size of the environment block cannot Index: src/shared/fileio.c =================================================================== --- src/shared/fileio.c.orig +++ src/shared/fileio.c @@ -658,7 +658,7 @@ static void write_env_var(FILE *f, const p++; fwrite(v, 1, p-v, f); - if (string_has_cc(p) || chars_intersect(p, WHITESPACE "\'\"\\`$")) { + if (string_has_cc(p, NULL) || chars_intersect(p, WHITESPACE "\'\"\\`$")) { fputc('\"', f); for (; *p; p++) { Index: src/shared/util.c =================================================================== --- src/shared/util.c.orig +++ src/shared/util.c @@ -5466,16 +5466,14 @@ bool filename_is_safe(const char *p) { bool string_is_safe(const char *p) { const char *t; - assert(p); + if (!p) + return false; for (t = p; *t; t++) { if (*t > 0 && *t < ' ') return false; - if (*t == 127) - return false; - - if (strchr("\\\"\'", *t)) + if (strchr("\\\"\'\0x7f", *t)) return false; } @@ -5483,16 +5481,19 @@ bool string_is_safe(const char *p) { } /** - * Check if a string contains control characters. - * Spaces and tabs are not considered control characters. + * Check if a string contains control characters. If 'ok' is non-NULL + * it may be a string containing additional CCs to be considered OK. */ -bool string_has_cc(const char *p) { +bool string_has_cc(const char *p, const char *ok) { const char *t; assert(p); for (t = p; *t; t++) { - if (*t > 0 && *t < ' ' && *t != '\t') + if (ok && strchr(ok, *t)) + return false; + + if (*t > 0 && *t < ' ') return true; if (*t == 127) Index: src/shared/util.h =================================================================== --- src/shared/util.h.orig +++ src/shared/util.h @@ -652,7 +652,7 @@ _alloc_(2, 3) static inline void *memdup bool filename_is_safe(const char *p) _pure_; bool path_is_safe(const char *p) _pure_; bool string_is_safe(const char *p) _pure_; -bool string_has_cc(const char *p) _pure_; +bool string_has_cc(const char *p, const char *ok) _pure_; /** * Check if a string contains any glob patterns. ++++++ 0002-util-fix-has-cc-check-and-add-test.patch ++++++ Based on 1cb1767a29458b3d16d6b161b4ee34dd496ff60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 11 Jul 2014 09:21:15 -0400 Subject: [PATCH] util: fix has cc check and add test --- src/shared/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/shared/util.c src/shared/util.c index 3342798..75dc58b 100644 --- src/shared/util.c +++ src/shared/util.c @@ -5419,7 +5419,7 @@ bool string_has_cc(const char *p, const char *ok) { for (t = p; *t; t++) { if (ok && strchr(ok, *t)) - return false; + continue; if (*t > 0 && *t < ' ') return true; -- 1.7.9.2 ++++++ 0002-util-fix-minimal-race-where-we-might-miss-SIGTERMs-w.patch ++++++ Based on 8a7c93d858c342744adf481565d8bb03b9713dcf Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 27 Aug 2014 21:42:20 +0200 Subject: [PATCH] util: fix minimal race where we might miss SIGTERMs when forking off an agent Before forking, block all signals, and unblock them afterwards. This way the child will have them blocked, and we won't lose them. --- src/shared/util.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) --- src/shared/util.c +++ src/shared/util.c 2014-08-28 10:32:06.442693437 +0000 @@ -894,6 +894,18 @@ int reset_all_signal_handlers(void) { return 0; } +static int reset_signal_mask(void) { + sigset_t ss; + + if (sigemptyset(&ss) < 0) + return -errno; + + if (sigprocmask(SIG_SETMASK, &ss, NULL) < 0) + return -errno; + + return 0; +} + char *strstrip(char *s) { char *e; @@ -5119,9 +5131,9 @@ int fd_inc_rcvbuf(int fd, size_t n) { } int fork_agent(pid_t *pid, const int except[], unsigned n_except, const char *path, ...) { - pid_t parent_pid, agent_pid; - int fd; bool stdout_is_tty, stderr_is_tty; + pid_t parent_pid, agent_pid; + sigset_t ss, saved_ss; unsigned n, i; va_list ap; char **l; @@ -5129,16 +5141,25 @@ int fork_agent(pid_t *pid, const int exc assert(pid); assert(path); - parent_pid = getpid(); - /* Spawns a temporary TTY agent, making sure it goes away when * we go away */ + parent_pid = getpid(); + + /* First we temporarily block all signals, so that the new + * child has them blocked initially. This way, we can be sure + * that SIGTERMs are not lost we might send to the agent. */ + assert_se(sigfillset(&ss) >= 0); + assert_se(sigprocmask(SIG_SETMASK, &ss, &saved_ss) >= 0); + agent_pid = fork(); - if (agent_pid < 0) + if (agent_pid < 0) { + assert_se(sigprocmask(SIG_SETMASK, &saved_ss, NULL) >= 0); return -errno; + } if (agent_pid != 0) { + assert_se(sigprocmask(SIG_SETMASK, &saved_ss, NULL) >= 0); *pid = agent_pid; return 0; } @@ -5149,6 +5170,12 @@ int fork_agent(pid_t *pid, const int exc if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0) _exit(EXIT_FAILURE); + /* Make sure we actually can kill the agent, if we need to, in + * case somebody invoked us from a shell script that trapped + * SIGTERM or so... */ + reset_all_signal_handlers(); + reset_signal_mask(); + /* Check whether our parent died before we were able * to set the death signal */ if (getppid() != parent_pid) @@ -5161,6 +5188,8 @@ int fork_agent(pid_t *pid, const int exc stderr_is_tty = isatty(STDERR_FILENO); if (!stdout_is_tty || !stderr_is_tty) { + int fd; + /* Detach from stdout/stderr. and reopen * /dev/tty for them. This is important to * ensure that when systemctl is started via ++++++ 0002-util-remove-a-unnecessary-check.patch ++++++ Based on 42646a8bf24be2c9280554c9d8540c67c835b3c4 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Tue, 16 Sep 2014 22:58:35 +0200 Subject: [PATCH] util: remove a unnecessary check We only break out of the previous loop if fd >= 0 so there is no use in checking it again. Found by coverity. Fixes: CID#1237577 --- src/shared/util.c | 3 --- 1 file changed, 3 deletions(-) --- src/shared/util.c +++ src/shared/util.c 2014-09-18 13:05:08.218236754 +0000 @@ -1772,9 +1772,6 @@ int open_terminal(const char *name, int c++; } - if (fd < 0) - return -errno; - r = isatty(fd); if (r < 0) { close_nointr_nofail(fd); ++++++ 0002-util-when-unescaping-strings-don-t-allow-smuggling-i.patch ++++++ Based on e0a33e7ba619eb44f732aaf23cb249fa43d0ce8d Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 2 Jul 2014 13:42:25 +0200 Subject: [PATCH] util: when unescaping strings, don't allow smuggling in of additional NUL bytes Better safe than sorry. --- src/shared/util.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git src/shared/util.c src/shared/util.c index ceafa01..4ad3f20 100644 --- src/shared/util.c +++ src/shared/util.c @@ -1256,7 +1256,7 @@ char *cunescape_length_with_prefix(const char *s, size_t length, const char *pre a = unhexchar(f[1]); b = unhexchar(f[2]); - if (a < 0 || b < 0) { + if (a < 0 || b < 0 || (a == 0 && b == 0)) { /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = 'x'; @@ -1283,7 +1283,7 @@ char *cunescape_length_with_prefix(const char *s, size_t length, const char *pre b = unoctchar(f[1]); c = unoctchar(f[2]); - if (a < 0 || b < 0 || c < 0) { + if (a < 0 || b < 0 || c < 0 || (a == 0 && b == 0 && c == 0)) { /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = f[0]; @@ -1566,8 +1566,7 @@ int chvt(int vt) { int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) { struct termios old_termios, new_termios; - char c; - char line[LINE_MAX]; + char c, line[LINE_MAX]; assert(f); assert(ret); @@ -1604,9 +1603,10 @@ int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) { } } - if (t != (usec_t) -1) + if (t != (usec_t) -1) { if (fd_wait_for_event(fileno(f), POLLIN, t) <= 0) return -ETIMEDOUT; + } if (!fgets(line, sizeof(line), f)) return -EIO; @@ -1624,6 +1624,7 @@ int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) { } int ask(char *ret, const char *replies, const char *text, ...) { + int r; assert(ret); assert(replies); @@ -1632,7 +1633,6 @@ int ask(char *ret, const char *replies, const char *text, ...) { for (;;) { va_list ap; char c; - int r; bool need_nl = true; if (on_tty()) -- 1.7.9.2 ++++++ 0002-vconsole-setup-run-setfont-before-loadkeys.patch ++++++ Based on abee28c56d523e55751b0c007d0bf812cc285c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 1 Jul 2014 22:20:11 -0400 Subject: [PATCH] vconsole-setup: run setfont before loadkeys https://bugs.freedesktop.org/show_bug.cgi?id=80685 For SUSE please note that this had been ported on top of the patches * handle-disable_caplock-and-compose_table-and-kbd_rate.patch * handle-numlock-value-in-etc-sysconfig-keyboard.patch that is that now set_kbd_rate() will be called first before font_load(). Then font_load() is followed by load_compose_table() and afterwards as in the original commit the keymap_load() follows. --- src/vconsole/vconsole-setup.c | 93 +++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 46 deletions(-) Index: src/vconsole/vconsole-setup.c =================================================================== --- src/vconsole/vconsole-setup.c.orig +++ src/vconsole/vconsole-setup.c @@ -340,23 +340,20 @@ static int set_kbd_rate(const char *vc, int main(int argc, char **argv) { const char *vc; - char *vc_keymap = NULL; - char *vc_keymap_toggle = NULL; - char *vc_font = NULL; - char *vc_font_map = NULL; - char *vc_font_unimap = NULL; + _cleanup_free_ char + *vc_keymap = NULL, *vc_keymap_toggle = NULL, + *vc_font = NULL, *vc_font_map = NULL, *vc_font_unimap = NULL; + _cleanup_close_ int fd = -1; #ifdef HAVE_SYSV_COMPAT - char *vc_kbd_delay = NULL; - char *vc_kbd_rate = NULL; - char *vc_kbd_disable_caps_lock = NULL; - char *vc_kbd_numlock = NULL; - char *vc_compose_table = NULL; + _cleanup_free_ char + *vc_kbd_numlock = NULL, *vc_kbd_delay = NULL, + *vc_kbd_rate = NULL, * vc_kbd_disable_caps_lock = NULL, + *vc_compose_table = NULL; pid_t kbd_rate_pid = 0, compose_table_pid = 0; + bool numlock = false; #endif - int fd = -1; bool utf8; bool disable_capslock = false; - bool numlock = false; pid_t font_pid = 0, keymap_pid = 0; bool font_copy = false; int r = EXIT_FAILURE; @@ -377,12 +374,12 @@ int main(int argc, char **argv) { fd = open_terminal(vc, O_RDWR|O_CLOEXEC); if (fd < 0) { log_error("Failed to open %s: %m", vc); - goto finish; + return EXIT_FAILURE; } if (!is_vconsole(fd)) { log_error("Device %s is not a virtual console.", vc); - goto finish; + return EXIT_FAILURE; } utf8 = is_locale_utf8(); @@ -464,58 +461,62 @@ int main(int argc, char **argv) { if (r < 0 && r != -ENOENT) log_warning("Failed to read /proc/cmdline: %s", strerror(-r)); } +#ifdef HAVE_SYSV_COMPAT +finish: + r = set_kbd_rate(vc, vc_kbd_rate, vc_kbd_delay, &kbd_rate_pid); + if (r < 0) { + log_error("Failed to start /bin/kbdrate: %s", strerror(-r)); + return EXIT_FAILURE; + } + + if (kbd_rate_pid > 0) + wait_for_terminate_and_warn("/bin/kbdrate", kbd_rate_pid); +#endif if (utf8) enable_utf8(fd); else disable_utf8(fd); - r = EXIT_FAILURE; - - if (keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, disable_capslock, &keymap_pid) >= 0 && -#ifdef HAVE_SYSV_COMPAT - load_compose_table(vc, vc_compose_table, &compose_table_pid) >= 0 && - set_kbd_rate(vc, vc_kbd_rate, vc_kbd_delay, &kbd_rate_pid) >= 0 && -#endif - font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) >= 0) - r = EXIT_SUCCESS; + r = font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid); + if (r < 0) { + log_error("Failed to start " KBD_SETFONT ": %s", strerror(-r)); + return EXIT_FAILURE; + } -finish: - if (keymap_pid > 0) - wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid); - if (numlock) - touch("/run/numlock-on"); - else - unlink("/run/numlock-on"); + if (font_pid > 0) + wait_for_terminate_and_warn(KBD_SETFONT, font_pid); #ifdef HAVE_SYSV_COMPAT + r = load_compose_table(vc, vc_compose_table, &compose_table_pid); + if (r < 0) { + log_error("Failed to start " KBD_LOADKEYS ": %s", strerror(-r)); + return EXIT_FAILURE; + } + if (compose_table_pid > 0) wait_for_terminate_and_warn(KBD_LOADKEYS, compose_table_pid); - - if (kbd_rate_pid > 0) - wait_for_terminate_and_warn("/bin/kbdrate", kbd_rate_pid); #endif - if (font_pid > 0) { - wait_for_terminate_and_warn(KBD_SETFONT, font_pid); - if (font_copy) - font_copy_to_all_vcs(fd); + r = keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, disable_capslock, &keymap_pid); + if (r < 0) { + log_error("Failed to start " KBD_LOADKEYS ": %s", strerror(-r)); + return EXIT_FAILURE; } - free(vc_keymap); - free(vc_font); - free(vc_font_map); - free(vc_font_unimap); - free(vc_kbd_numlock); + if (keymap_pid > 0) + wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid); + #ifdef HAVE_SYSV_COMPAT - free(vc_kbd_delay); - free(vc_kbd_rate); - free(vc_kbd_disable_caps_lock); - free(vc_compose_table); + if (numlock) + touch("/run/numlock-on"); + else + unlink("/run/numlock-on"); #endif - if (fd >= 0) - close_nointr_nofail(fd); + /* Only copy the font when we started setfont successfully */ + if (font_copy && font_pid > 0) + font_copy_to_all_vcs(fd); return r; } ++++++ 0003-Add-quotes-to-warning-message.patch ++++++
From f0ea29eaeb3449822bfbdfa839b00e323dfc523e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sun, 20 Jul 2014 19:47:42 -0400 Subject: [PATCH] Add quotes to warning message
The message for SYSTEMD_LOG_LEVEL= looked a bit strange. --- src/shared/log.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git src/shared/log.c src/shared/log.c index 9039db3..3941e3e 100644 --- src/shared/log.c +++ src/shared/log.c @@ -884,19 +884,19 @@ void log_parse_environment(void) { e = secure_getenv("SYSTEMD_LOG_TARGET"); if (e && log_set_target_from_string(e) < 0) - log_warning("Failed to parse log target %s. Ignoring.", e); + log_warning("Failed to parse log target '%s'. Ignoring.", e); e = secure_getenv("SYSTEMD_LOG_LEVEL"); if (e && log_set_max_level_from_string(e) < 0) - log_warning("Failed to parse log level %s. Ignoring.", e); + log_warning("Failed to parse log level '%s'. Ignoring.", e); e = secure_getenv("SYSTEMD_LOG_COLOR"); if (e && log_show_color_from_string(e) < 0) - log_warning("Failed to parse bool %s. Ignoring.", e); + log_warning("Failed to parse bool '%s'. Ignoring.", e); e = secure_getenv("SYSTEMD_LOG_LOCATION"); if (e && log_show_location_from_string(e) < 0) - log_warning("Failed to parse bool %s. Ignoring.", e); + log_warning("Failed to parse bool '%s'. Ignoring.", e); } LogTarget log_get_target(void) { -- 1.7.9.2 ++++++ 0003-Always-check-asprintf-return-code.patch ++++++ Based on 7de80bfe2e61d5818601ccfddbadad3b7703ed70 Mon Sep 17 00:00:00 2001 From: Karel Zak <kzak@redhat.com> Date: Fri, 25 Jul 2014 15:38:31 +0200 Subject: [PATCH] Always check asprintf return code There is a small number of the places in sources where we don't check asprintf() return code and assume that after error the function returns NULL pointer via the first argument. That's wrong, after error the content of pointer is undefined. --- src/core/unit-printf.c | 8 ++++---- src/cryptsetup/cryptsetup.c | 11 ++++++++--- src/journal/journalctl.c | 16 +++++++++++----- src/run/run.c | 20 ++++++++++---------- src/shared/install.c | 15 +++++++++------ src/systemctl/systemctl.c | 18 +++++++++--------- src/tty-ask-password-agent/tty-ask-password-agent.c | 5 +++-- 7 files changed, 54 insertions(+), 39 deletions(-) --- src/core/unit-printf.c +++ src/core/unit-printf.c 2014-07-28 09:42:20.726235696 +0000 @@ -182,7 +182,7 @@ static int specifier_user_name(char spec char *printed = NULL; Unit *u = userdata; ExecContext *c; - int r; + int r = 0; assert(u); @@ -208,7 +208,7 @@ static int specifier_user_name(char spec if (r < 0) return -ENODATA; - asprintf(&printed, "%lu", (unsigned long) uid); + r = asprintf(&printed, "%lu", (unsigned long) uid); } } @@ -231,10 +231,10 @@ static int specifier_user_name(char spec if (specifier == 'u') printed = strdup(username); else - asprintf(&printed, "%lu", (unsigned long) uid); + r = asprintf(&printed, "%lu", (unsigned long) uid); } - if (!printed) + if (r < 0 || !printed) return -ENOMEM; *ret = printed; --- src/cryptsetup/cryptsetup.c +++ src/cryptsetup/cryptsetup.c 2014-07-28 00:00:00.000000000 +0000 @@ -535,13 +535,18 @@ int main(int argc, char *argv[]) { description = NULL; } + k = 0; if (mount_point && description) - asprintf(&name_buffer, "%s (%s) on %s", description, argv[2], mount_point); + k = asprintf(&name_buffer, "%s (%s) on %s", description, argv[2], mount_point); else if (mount_point) - asprintf(&name_buffer, "%s on %s", argv[2], mount_point); + k = asprintf(&name_buffer, "%s on %s", argv[2], mount_point); else if (description) - asprintf(&name_buffer, "%s (%s)", description, argv[2]); + k = asprintf(&name_buffer, "%s (%s)", description, argv[2]); + if (k < 0) { + log_oom(); + goto finish; + } name = name_buffer ? name_buffer : argv[2]; k = crypt_init(&cd, argv[3]); --- src/journal/journalctl.c +++ src/journal/journalctl.c 2014-07-28 00:00:00.000000000 +0000 @@ -746,11 +746,17 @@ static int add_matches(sd_journal *j, ch } } else t = strappend("_EXE=", path); - } else if (S_ISCHR(st.st_mode)) - asprintf(&t, "_KERNEL_DEVICE=c%u:%u", major(st.st_rdev), minor(st.st_rdev)); - else if (S_ISBLK(st.st_mode)) - asprintf(&t, "_KERNEL_DEVICE=b%u:%u", major(st.st_rdev), minor(st.st_rdev)); - else { + } else if (S_ISCHR(st.st_mode)) { + if (asprintf(&t, "_KERNEL_DEVICE=c%u:%u", + major(st.st_rdev), + minor(st.st_rdev)) < 0) + return -ENOMEM; + } else if (S_ISBLK(st.st_mode)) { + if (asprintf(&t, "_KERNEL_DEVICE=b%u:%u", + major(st.st_rdev), + minor(st.st_rdev)) < 0) + return -ENOMEM; + } else { log_error("File is neither a device node, nor regular file, nor executable: %s", *i); return -EINVAL; } --- src/run/run.c +++ src/run/run.c 2014-07-28 09:46:36.846235596 +0000 @@ -309,12 +309,12 @@ static int start_transient_service( _cleanup_free_ char *name = NULL; int r; - if (arg_unit) + if (arg_unit) { name = unit_name_mangle_with_suffix(arg_unit, MANGLE_NOGLOB, ".service"); - else - asprintf(&name, "run-%lu.service", (unsigned long) getpid()); - if (!name) - return -ENOMEM; + if (!name) + return log_oom(); + } else if (asprintf(&name, "run-%lu.service", (unsigned long) getpid()) < 0) + return log_oom(); r = message_start_transient_unit_new(bus, name, &m); if (r < 0) @@ -436,12 +436,12 @@ static int start_transient_scope( assert(bus); - if (arg_unit) + if (arg_unit) { name = unit_name_mangle_with_suffix(arg_unit, MANGLE_NOGLOB, ".scope"); - else - asprintf(&name, "run-%lu.scope", (unsigned long) getpid()); - if (!name) - return -ENOMEM; + if (!name) + return log_oom(); + } else if (asprintf(&name, "run-%lu.scope", (unsigned long) getpid()) < 0) + return log_oom(); r = message_start_transient_unit_new(bus, name, &m); if (r < 0) --- src/shared/install.c +++ src/shared/install.c 2014-07-28 00:00:00.000000000 +0000 @@ -72,13 +72,16 @@ static int get_config_path(UnitFileScope case UNIT_FILE_SYSTEM: - if (root_dir && runtime) - asprintf(&p, "%s/run/systemd/system", root_dir); - else if (runtime) + if (root_dir && runtime) { + if (asprintf(&p, "%s/run/systemd/system", root_dir) < 0) + return -ENOMEM; + } else if (runtime) p = strdup("/run/systemd/system"); - else if (root_dir) - asprintf(&p, "%s/%s", root_dir, SYSTEM_CONFIG_UNIT_PATH); - else + else if (root_dir) { + if (asprintf(&p, "%s/%s", root_dir, + SYSTEM_CONFIG_UNIT_PATH) < 0) + return -ENOMEM; + } else p = strdup(SYSTEM_CONFIG_UNIT_PATH); break; --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c 2014-07-28 09:51:40.894735541 +0000 @@ -4639,11 +4639,11 @@ static int enable_sysv_units(const char STRV_FOREACH(k, paths.unit_path) { if (!isempty(arg_root)) - asprintf(&p, "%s/%s/%s", arg_root, *k, name); + j = asprintf(&p, "%s/%s/%s", arg_root, *k, name); else - asprintf(&p, "%s/%s", *k, name); + j = asprintf(&p, "%s/%s", *k, name); - if (!p) { + if (j < 0) { r = log_oom(); goto finish; } @@ -4660,10 +4660,10 @@ static int enable_sysv_units(const char continue; if (!isempty(arg_root)) - asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/%s", arg_root, name); + j = asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/%s", arg_root, name); else - asprintf(&p, SYSTEM_SYSVINIT_PATH "/%s", name); - if (!p) { + j = asprintf(&p, SYSTEM_SYSVINIT_PATH "/%s", name); + if (j < 0) { r = log_oom(); goto finish; } @@ -4676,10 +4676,10 @@ static int enable_sysv_units(const char free(p); p = NULL; if (!isempty(arg_root)) - asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/boot.%s", arg_root, name); + j = asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/boot.%s", arg_root, name); else - asprintf(&p, SYSTEM_SYSVINIT_PATH "/boot.%s", name); - if (!p) { + j = asprintf(&p, SYSTEM_SYSVINIT_PATH "/boot.%s", name); + if (j < 0) { r = log_oom(); goto finish; } --- src/tty-ask-password-agent/tty-ask-password-agent.c +++ src/tty-ask-password-agent/tty-ask-password-agent.c 2014-07-28 00:00:00.000000000 +0000 @@ -102,8 +102,9 @@ static int ask_password_plymouth( if (accept_cached) { packet = strdup("c"); n = 1; - } else - asprintf(&packet, "*\002%c%s%n", (int) (strlen(message) + 1), message, &n); + } else if (asprintf(&packet, "*\002%c%s%n", (int) (strlen(message) + 1), + message, &n) < 0) + packet = NULL; if (!packet) { r = -ENOMEM; ++++++ 0003-Do-not-print-invalid-UTF-8-in-error-messages.patch ++++++
From b5d742138f71e87312541a89aac5657015f50f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 4 Mar 2014 09:50:26 -0500 Subject: [PATCH] Do not print invalid UTF-8 in error messages
Inexplicably, 550a40ec ('core: do not print invalid utf-8 in error messages') only fixed two paths. Convert all of them now. --- src/core/load-fragment.c | 13 ++++--------- src/shared/conf-parser.c | 7 +++---- src/shared/conf-parser.h | 6 ++++++ src/shared/fileio.c | 9 ++++++--- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git src/core/load-fragment.c src/core/load-fragment.c index d77bf5c..5628d8c 100644 --- src/core/load-fragment.c +++ src/core/load-fragment.c @@ -536,9 +536,7 @@ int config_parse_exec(const char *unit, } if (!utf8_is_valid(path)) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Path is not UTF-8 clean, ignoring assignment: %s", - rvalue); + log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue); r = 0; goto fail; } @@ -553,9 +551,7 @@ int config_parse_exec(const char *unit, } if (!utf8_is_valid(c)) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Path is not UTF-8 clean, ignoring assignment: %s", - rvalue); + log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue); r = 0; goto fail; } @@ -1960,8 +1956,7 @@ int config_parse_unit_requires_mounts_for( return log_oom(); if (!utf8_is_valid(n)) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Path is not UTF-8 clean, ignoring assignment: %s", rvalue); + log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue); continue; } diff --git src/shared/conf-parser.c src/shared/conf-parser.c index 0a87a71..d27b1b7 100644 --- src/shared/conf-parser.c +++ src/shared/conf-parser.c @@ -618,8 +618,7 @@ int config_parse_string(const char *unit return log_oom(); if (!utf8_is_valid(n)) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "String is not UTF-8 clean, ignoring assignment: %s", rvalue); + log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue); free(n); return 0; } @@ -656,8 +655,7 @@ int config_parse_path(const char *unit, assert(data); if (!utf8_is_valid(rvalue)) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Path is not UTF-8 clean, ignoring assignment: %s", rvalue); + log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue); return 0; } @@ -725,8 +723,7 @@ int config_parse_strv(const char *unit, return log_oom(); if (!utf8_is_valid(n)) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "String is not UTF-8 clean, ignoring: %s", rvalue); + log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue); continue; } diff --git src/shared/conf-parser.h src/shared/conf-parser.h index e1c7ab4..ba0e58d 100644 --- src/shared/conf-parser.h +++ src/shared/conf-parser.h @@ -121,6 +121,12 @@ int log_syntax_internal(const char *unit, int level, config_file, config_line, \ error, __VA_ARGS__) +#define log_invalid_utf8(unit, level, config_file, config_line, error, rvalue) { \ + _cleanup_free_ char *__p = utf8_escape_invalid(rvalue); \ + log_syntax(unit, level, config_file, config_line, error, \ + "String is not UTF-8 clean, ignoring assignment: %s", __p); \ + } + #define DEFINE_CONFIG_PARSE_ENUM(function,name,type,msg) \ int function(const char *unit, \ const char *filename, \ diff --git src/shared/fileio.c src/shared/fileio.c index d591567..f101269 100644 --- src/shared/fileio.c +++ src/shared/fileio.c @@ -598,15 +598,18 @@ static int load_env_file_push(const char *filename, unsigned line, int r; if (!utf8_is_valid(key)) { + _cleanup_free_ char *t = utf8_escape_invalid(key); + log_error("%s:%u: invalid UTF-8 for key '%s', ignoring.", - filename, line, key); + filename, line, t); return -EINVAL; } if (value && !utf8_is_valid(value)) { - /* FIXME: filter UTF-8 */ + _cleanup_free_ char *t = utf8_escape_invalid(value); + log_error("%s:%u: invalid UTF-8 value for key %s: '%s', ignoring.", - filename, line, key, value); + filename, line, key, t); return -EINVAL; } -- 1.7.9.2 ++++++ 0003-Quote-unit-names-in-suggested-systemctl-commandlines.patch ++++++
From 8e07fc41f86d41e68c5663b2a3c620a0adedcc11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sun, 31 Aug 2014 00:42:27 -0400 Subject: [PATCH] Quote unit names in suggested systemctl commandlines
The fact that unit names have to be quoted can be a bit surprising. Show quotes in the hint commandline, but only after checking that this is necessary, since quotes are visually heavy and usually not needed. https://bugs.freedesktop.org/show_bug.cgi?id=82832 --- src/core/job.c | 11 +++++++++-- src/systemctl/systemctl.c | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git src/core/job.c src/core/job.c index 5e4987f..ef5dbce 100644 --- src/core/job.c +++ src/core/job.c @@ -632,11 +632,18 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) { unit_status_printf(u, ANSI_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, format); break; - case JOB_FAILED: + case JOB_FAILED: { + bool quotes; + + quotes = chars_intersect(u->id, SHELL_NEED_QUOTES); + manager_flip_auto_status(u->manager, true); unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, format); - manager_status_printf(u->manager, false, NULL, "See 'systemctl status %s' for details.", u->id); + manager_status_printf(u->manager, false, NULL, + "See \"systemctl status %s%s%s\" for details.", + quotes ? "'" : "", u->id, quotes ? "'" : ""); break; + } case JOB_DEPENDENCY: manager_flip_auto_status(u->manager, true); diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c index 6534819..de43c87 100644 --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c @@ -2351,8 +2351,18 @@ static int check_wait_response(WaitData *d) { log_error("Job for %s canceled.", strna(d->name)); else if (streq(d->result, "dependency")) log_error("A dependency job for %s failed. See 'journalctl -xn' for details.", strna(d->name)); - else if (!streq(d->result, "done") && !streq(d->result, "skipped")) - log_error("Job for %s failed. See 'systemctl status %s' and 'journalctl -xn' for details.", strna(d->name), strna(d->name)); + else if (!streq(d->result, "done") && !streq(d->result, "skipped")) { + if (d->name) { + bool quotes; + + quotes = chars_intersect(d->name, SHELL_NEED_QUOTES); + + log_error("Job for %s failed. See \"systemctl status %s%s%s\" and \"journalctl -xn\" for details.", + d->name, + quotes ? "'" : "", d->name, quotes ? "'" : ""); + } else + log_error("Job failed. See \"journalctl -xn\" for details."); + } } if (streq(d->result, "timeout")) -- 1.7.9.2 ++++++ 0003-analyze-fix-mem-leak.patch ++++++
From 0ee9613d98cbe1f36ffc98c6bfa51dd2b798fc6d Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Sat, 13 Sep 2014 12:29:43 +0200 Subject: [PATCH] analyze: fix mem leak
Found with Coverity. Fixes: CID#1237756 --- src/analyze/analyze.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git src/analyze/analyze.c src/analyze/analyze.c index 1281d6b..82f5cf3 100644 --- src/analyze/analyze.c +++ src/analyze/analyze.c @@ -848,7 +848,8 @@ static int list_dependencies(sd_bus *bus, const char *name) { char ts[FORMAT_TIMESPAN_MAX]; struct unit_times *times; int r; - const char *path, *id; + const char *id; + _cleanup_free_ char *path = NULL; _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; struct boot_times *boot; -- 1.7.9.2 ++++++ 0003-analyze-fix-plot-with-bad-y-size.patch ++++++
From a213b7e977221ca96bbc1b19a5a879c912ba2488 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark <h0tw1r3@gmail.com> Date: Wed, 23 Apr 2014 22:37:43 +0200 Subject: [PATCH] analyze: fix plot with bad y size
systemd-analyze plot > test.svg produces output with all y and height element attributes equal to zero. This of course causes the resulting svg to appear blank (zero height). Bug does not affect x86. Looks like a compiler optimization may be the culprit. https://github.com/archlinuxarm/PKGBUILDs/issues/815 --- src/analyze/analyze.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/analyze/analyze.c src/analyze/analyze.c index ba236d9..ebaa9d0 100644 --- src/analyze/analyze.c +++ src/analyze/analyze.c @@ -43,7 +43,7 @@ #include "pager.h" #define SCALE_X (0.1 / 1000.0) /* pixels per us */ -#define SCALE_Y 20.0 +#define SCALE_Y (20.0) #define compare(a, b) (((a) > (b))? 1 : (((b) > (a))? -1 : 0)) -- 1.7.9.2 ++++++ 0003-arch-add-crisv32-to-uname-check.patch ++++++
From 9b3a0ba3e9e28382a1072bf0e2c07a3661432743 Mon Sep 17 00:00:00 2001 From: Umut Tezduyar Lindskog <umut.tezduyar@axis.com> Date: Thu, 3 Jul 2014 09:54:45 +0200 Subject: [PATCH] arch: add crisv32 to uname check
--- src/shared/architecture.c | 1 + 1 file changed, 1 insertion(+) diff --git src/shared/architecture.c src/shared/architecture.c index 9e0c3ef..7dd049a 100644 --- src/shared/architecture.c +++ src/shared/architecture.c @@ -116,6 +116,7 @@ Architecture uname_architecture(void) { { "tilegx", ARCHITECTURE_TILEGX }, #elif defined(__cris__) { "cris", ARCHITECTURE_CRIS }, + { "crisv32", ARCHITECTURE_CRIS }, #else #error "Please register your architecture here!" #endif -- 1.7.9.2 ++++++ 0003-architecture-add-string-table-entries-for-mips-le-ar.patch ++++++ Based on 037c26d0aeb750ca9c8d605884ea1db7baecfea8 Mon Sep 17 00:00:00 2001 Based on 9a00f57a5ba7ed431e6bac8d8b36518708503b4e Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 7 Jul 2014 14:59:06 +0200 Subject: [PATCH] architecture: add string table entries for mips-le archs which were missing --- src/shared/architecture.c | 2 ++ src/shared/architecture.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git src/shared/architecture.c src/shared/architecture.c index 6cdca4e..dc45f35 100644 --- src/shared/architecture.c +++ src/shared/architecture.c @@ -153,7 +153,9 @@ static const char *const architecture_table[_ARCHITECTURE_MAX] = { [ARCHITECTURE_SPARC] = "sparc", [ARCHITECTURE_SPARC64] = "sparc64", [ARCHITECTURE_MIPS] = "mips", + [ARCHITECTURE_MIPS_LE] = "mips-le", [ARCHITECTURE_MIPS64] = "mips64", + [ARCHITECTURE_MIPS64_LE] = "mips64-le", [ARCHITECTURE_ALPHA] = "alpha", [ARCHITECTURE_ARM] = "arm", [ARCHITECTURE_ARM_BE] = "arm-be", diff --git src/shared/architecture.h src/shared/architecture.h index 20e848b..0807924 100644 --- src/shared/architecture.h +++ src/shared/architecture.h @@ -23,6 +23,8 @@ #include "util.h" +/* A cleaned up architecture definition */ + typedef enum Architecture { ARCHITECTURE_X86 = 0, ARCHITECTURE_X86_64, @@ -38,7 +40,9 @@ typedef enum Architecture { ARCHITECTURE_SPARC, ARCHITECTURE_SPARC64, ARCHITECTURE_MIPS, + ARCHITECTURE_MIPS_LE, ARCHITECTURE_MIPS64, + ARCHITECTURE_MIPS64_LE, ARCHITECTURE_ALPHA, ARCHITECTURE_ARM, ARCHITECTURE_ARM_BE, -- 1.7.9.2 ++++++ 0003-backlight-unify-error-messages.patch ++++++ Based on 938d2699d2e818bd996614e89ea3d668200ad2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Mon, 7 Apr 2014 20:57:22 -0400 Subject: [PATCH] backlight: unify error messages --- src/backlight/backlight.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) --- src/backlight/backlight.c +++ src/backlight/backlight.c 2014-05-12 13:31:50.502235843 +0000 @@ -24,6 +24,7 @@ #include "fileio.h" #include "libudev.h" #include "udev-util.h" +#include "def.h" static struct udev_device *find_pci_or_platform_parent(struct udev_device *device) { struct udev_device *parent; @@ -50,7 +51,7 @@ static struct udev_device *find_pci_or_p if (!c) return NULL; - c += strspn(c, "0123456789"); + c += strspn(c, DIGITS); if (*c == '-') { /* A connector DRM device, let's ignore all but LVDS and eDP! */ @@ -67,7 +68,8 @@ static struct udev_device *find_pci_or_p unsigned long class = 0; if (safe_atolu(value, &class) < 0) { - log_warning("Cannot parse PCI class %s of device %s:%s.", value, subsystem, sysname); + log_warning("Cannot parse PCI class %s of device %s:%s.", + value, subsystem, sysname); return NULL; } @@ -175,7 +177,9 @@ static bool validate_device(struct udev if (same_device(parent, other_parent)) { /* Both have the same PCI parent, that means * we are out. */ - log_debug("Skipping backlight device %s, since backlight device %s is on same PCI device and, takes precedence.", udev_device_get_sysname(device), udev_device_get_sysname(other)); + log_debug("Skipping backlight device %s, since device %s is on same PCI device and takes precedence.", + udev_device_get_sysname(device), + udev_device_get_sysname(other)); return false; } @@ -184,7 +188,9 @@ static bool validate_device(struct udev /* The other is connected to the platform bus * and we are a PCI device, that also means we * are out. */ - log_debug("Skipping backlight device %s, since backlight device %s is a platform device and takes precedence.", udev_device_get_sysname(device), udev_device_get_sysname(other)); + log_debug("Skipping backlight device %s, since device %s is a platform device and takes precedence.", + udev_device_get_sysname(device), + udev_device_get_sysname(other)); return false; } } @@ -199,13 +205,14 @@ static unsigned get_max_brightness(struc max_brightness_str = udev_device_get_sysattr_value(device, "max_brightness"); if (!max_brightness_str) { - log_warning("Failed to read max_brightness attribute"); + log_warning("Failed to read 'max_brightness' attribute"); return 0; } r = safe_atou(max_brightness_str, &max_brightness); if (r < 0) { - log_warning("Failed to parse max_brightness \"%s\": %s", max_brightness_str, strerror(-r)); + log_warning("Failed to parse 'max_brightness' \"%s\": %s", + max_brightness_str, strerror(-r)); return 0; } @@ -262,7 +269,8 @@ int main(int argc, char *argv[]) { r = mkdir_p("/var/lib/systemd/backlight", 0755); if (r < 0) { - log_error("Failed to create backlight directory: %s", strerror(-r)); + log_error("Failed to create backlight directory /var/lib/systemd/backlight: %s", + strerror(-r)); return EXIT_FAILURE; } @@ -274,7 +282,7 @@ int main(int argc, char *argv[]) { sysname = strchr(argv[2], ':'); if (!sysname) { - log_error("Requires pair of subsystem and sysname for specifying backlight device."); + log_error("Requires a subsystem and sysname pair specifying a backlight device."); return EXIT_FAILURE; } @@ -368,7 +376,8 @@ int main(int argc, char *argv[]) { r = udev_device_set_sysattr_value(device, "brightness", value); if (r < 0) { - log_error("Failed to write system attribute: %s", strerror(-r)); + log_error("Failed to write system 'brightness' attribute: %s", + strerror(-r)); return EXIT_FAILURE; } @@ -382,7 +391,7 @@ int main(int argc, char *argv[]) { value = udev_device_get_sysattr_value(device, "brightness"); if (!value) { - log_error("Failed to read system attribute: %s", strerror(-r)); + log_error("Failed to read system 'brightness' attribute: %s", strerror(-r)); return EXIT_FAILURE; } ++++++ 0003-bootchart-it-s-not-OK-to-return-1-from-a-main-progra.patch ++++++
From 4155f7d4be5053d5f34a26e5437fd85e1fe00fa3 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 11 Aug 2014 18:23:47 +0200 Subject: [PATCH] bootchart: it's not OK to return -1 from a main program
--- src/bootchart/bootchart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git src/bootchart/bootchart.c src/bootchart/bootchart.c index c0e176d..8ef5ad1 100644 --- src/bootchart/bootchart.c +++ src/bootchart/bootchart.c @@ -380,8 +380,8 @@ int main(int argc, char *argv[]) { sampledata = new0(struct list_sample_data, 1); if (sampledata == NULL) { - log_error("Failed to allocate memory for a node: %m"); - return -1; + log_oom(); + return EXIT_FAILURE; } sampledata->sampletime = gettime_ns(); -- 1.7.9.2 ++++++ 0003-bootchart-parse-userinput-with-safe_atoi.patch ++++++
From 9bcf7507fab6e6b022ae3cc7178237e6e0a09e9a Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Fri, 26 Sep 2014 21:41:02 +0200 Subject: [PATCH] bootchart: parse userinput with safe_atoi
Found by coverity. Fixes: CID#996409 --- src/bootchart/store.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git src/bootchart/store.c src/bootchart/store.c index ed683e8..3099ff1 100644 --- src/bootchart/store.c +++ src/bootchart/store.c @@ -192,12 +192,14 @@ vmstat_next: m = buf; while (m) { + int r; + if (sscanf(m, "%s %*s %*s %*s %*s %*s %*s %s %s", key, rt, wt) < 3) goto schedstat_next; if (strstr(key, "cpu")) { - c = atoi((const char*)(key+3)); - if (c > MAXCPUS) + r = safe_atoi((const char*)(key+3), &c); + if (r < 0 || c > MAXCPUS) /* Oops, we only have room for MAXCPUS data */ break; sampledata->runtime[c] = atoll(rt); -- 1.7.9.2 ++++++ 0003-busname-don-t-drop-service-from-the-result-string.patch ++++++
From 700ff4d97311902a440109a2c081731ab6ae8a20 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 7 Mar 2014 17:29:16 +0100 Subject: [PATCH] busname: don't drop 'service' from the result string
--- src/core/busname.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/core/busname.c src/core/busname.c index 237011a..bca2145 100644 --- src/core/busname.c +++ src/core/busname.c @@ -548,7 +548,7 @@ DEFINE_STRING_TABLE_LOOKUP(busname_state, BusNameState); static const char* const busname_result_table[_BUSNAME_RESULT_MAX] = { [BUSNAME_SUCCESS] = "success", [BUSNAME_FAILURE_RESOURCES] = "resources", - [BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT] = "failed-permanent", + [BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT] = "service-failed-permanent", }; DEFINE_STRING_TABLE_LOOKUP(busname_result, BusNameResult); -- 1.7.9.2 ++++++ 0003-core-You-can-not-put-the-cached-result-of-use_smack-.patch ++++++
From d1d8e5d49f3149d03ceb94d1d2f6c14e7abccb6f Mon Sep 17 00:00:00 2001 From: Ronan Le Martret <ronan@fridu.net> Date: Tue, 22 Apr 2014 10:33:25 +0200 Subject: [PATCH] core: You can not put the cached result of use_smack fct, as we are not sure the "/sys" is mounted. So we should mount "sys" before "/proc"
https://bugs.freedesktop.org/show_bug.cgi?id=77646 --- src/core/mount-setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git src/core/mount-setup.c src/core/mount-setup.c index ae8447c..991bfdf 100644 --- src/core/mount-setup.c +++ src/core/mount-setup.c @@ -67,10 +67,10 @@ typedef struct MountPoint { #define N_EARLY_MOUNT 5 static const MountPoint mount_table[] = { - { "proc", "/proc", "proc", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, - NULL, MNT_FATAL|MNT_IN_CONTAINER }, { "sysfs", "/sys", "sysfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, NULL, MNT_FATAL|MNT_IN_CONTAINER }, + { "proc", "/proc", "proc", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, + NULL, MNT_FATAL|MNT_IN_CONTAINER }, { "devtmpfs", "/dev", "devtmpfs", "mode=755", MS_NOSUID|MS_STRICTATIME, NULL, MNT_FATAL|MNT_IN_CONTAINER }, { "securityfs", "/sys/kernel/security", "securityfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, -- 1.7.9.2 ++++++ 0003-core-allow-transient-mount-units.patch ++++++
From 0e252f6b375af59eac9bd6d2fe8dd6ee2f51998d Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Fri, 6 Jun 2014 15:10:20 +0200 Subject: [PATCH] core: allow transient mount units
For now only What=, Options=, Type= are supported, and Where= is deduced from the unit name. --- src/core/dbus-mount.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++- src/core/mount.c | 2 ++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git src/core/dbus-mount.c src/core/dbus-mount.c index e64d3ea..e27019d 100644 --- src/core/dbus-mount.c +++ src/core/dbus-mount.c @@ -124,6 +124,47 @@ const sd_bus_vtable bus_mount_vtable[] = { SD_BUS_VTABLE_END }; +static int bus_mount_set_transient_property( + Mount *m, + const char *name, + sd_bus_message *message, + UnitSetPropertiesMode mode, + sd_bus_error *error) { + + const char *new_property; + char **property; + char *p; + int r; + + assert(m); + assert(name); + assert(message); + + if (streq(name, "What")) + property = &m->parameters_fragment.what; + else if (streq(name, "Options")) + property = &m->parameters_fragment.options; + else if (streq(name, "Type")) + property = &m->parameters_fragment.fstype; + else + return 0; + + r = sd_bus_message_read(message, "s", &new_property); + if (r < 0) + return r; + + if (mode != UNIT_CHECK) { + p = strdup(new_property); + if (!p) + return -ENOMEM; + + free(*property); + *property = p; + } + + return 1; +} + int bus_mount_set_property( Unit *u, const char *name, @@ -132,12 +173,33 @@ int bus_mount_set_property( sd_bus_error *error) { Mount *m = MOUNT(u); + int r; assert(m); assert(name); assert(message); - return bus_cgroup_set_property(u, &m->cgroup_context, name, message, mode, error); + r = bus_cgroup_set_property(u, &m->cgroup_context, name, message, mode, error); + if (r != 0) + return r; + + if (u->transient && u->load_state == UNIT_STUB) { + /* This is a transient unit, let's load a little more */ + + r = bus_mount_set_transient_property(m, name, message, mode, error); + if (r != 0) + return r; + + r = bus_exec_context_set_transient_property(u, &m->exec_context, name, message, mode, error); + if (r != 0) + return r; + + r = bus_kill_context_set_transient_property(u, &m->kill_context, name, message, mode, error); + if (r != 0) + return r; + } + + return 0; } int bus_mount_commit_properties(Unit *u) { diff --git src/core/mount.c src/core/mount.c index a979837..14ac0a0 100644 --- src/core/mount.c +++ src/core/mount.c @@ -1819,6 +1819,8 @@ const UnitVTable mount_vtable = { .get_timeout = mount_get_timeout, + .can_transient = true, + .enumerate = mount_enumerate, .shutdown = mount_shutdown, -- 1.7.9.2 ++++++ 0003-core-make-sure-to-serialize-jobs-for-all-units.patch ++++++
From 9bdb98c59451ed090f8d35d470a54710f389ce71 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 16 May 2014 01:15:03 +0200 Subject: [PATCH] core: make sure to serialize jobs for all units
Previously we wouldn't serialize jobs for units that themselves have nothing to serialize. http://lists.freedesktop.org/archives/systemd-devel/2014-May/019051.html --- src/core/manager.c | 3 --- src/core/unit.c | 43 +++++++++++++++++++++---------------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git src/core/manager.c src/core/manager.c index 1e3e127..d0af674 100644 --- src/core/manager.c +++ src/core/manager.c @@ -2131,9 +2131,6 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool switching_root) { if (u->id != t) continue; - if (!unit_can_serialize(u)) - continue; - /* Start marker */ fputs(u->id, f); fputc('\n', f); diff --git src/core/unit.c src/core/unit.c index c4ed923..41651ba 100644 --- src/core/unit.c +++ src/core/unit.c @@ -2288,25 +2288,25 @@ bool unit_can_serialize(Unit *u) { } int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs) { - ExecRuntime *rt; int r; assert(u); assert(f); assert(fds); - if (!unit_can_serialize(u)) - return 0; - - r = UNIT_VTABLE(u)->serialize(u, f, fds); - if (r < 0) - return r; + if (unit_can_serialize(u)) { + ExecRuntime *rt; - rt = unit_get_exec_runtime(u); - if (rt) { - r = exec_runtime_serialize(rt, u, f, fds); + r = UNIT_VTABLE(u)->serialize(u, f, fds); if (r < 0) return r; + + rt = unit_get_exec_runtime(u); + if (rt) { + r = exec_runtime_serialize(rt, u, f, fds); + if (r < 0) + return r; + } } dual_timestamp_serialize(f, "inactive-exit-timestamp", &u->inactive_exit_timestamp); @@ -2368,17 +2368,14 @@ void unit_serialize_item(Unit *u, FILE *f, const char *key, const char *value) { } int unit_deserialize(Unit *u, FILE *f, FDSet *fds) { - size_t offset; ExecRuntime **rt = NULL; + size_t offset; int r; assert(u); assert(f); assert(fds); - if (!unit_can_serialize(u)) - return 0; - offset = UNIT_VTABLE(u)->exec_runtime_offset; if (offset > 0) rt = (ExecRuntime**) ((uint8_t*) u + offset); @@ -2503,17 +2500,19 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) { continue; } - if (rt) { - r = exec_runtime_deserialize_item(rt, u, l, v, fds); + if (unit_can_serialize(u)) { + if (rt) { + r = exec_runtime_deserialize_item(rt, u, l, v, fds); + if (r < 0) + return r; + if (r > 0) + continue; + } + + r = UNIT_VTABLE(u)->deserialize_item(u, l, v, fds); if (r < 0) return r; - if (r > 0) - continue; } - - r = UNIT_VTABLE(u)->deserialize_item(u, l, v, fds); - if (r < 0) - return r; } } -- 1.7.9.2 ++++++ 0003-core-never-consider-failure-when-reading-drop-ins-fa.patch ++++++
From bcd816bd349241bcd9c0bfbfd9cfe7b034ba351b Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 22 May 2014 16:49:12 +0900 Subject: [PATCH] core: never consider failure when reading drop-ins fatal
drop-ins don't carry the main configuration of a unit, hence read them if we can't, complain if we cannot, but don't fail. --- src/core/load-dropin.c | 42 +++++++++++++----------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) Index: src/core/load-dropin.c =================================================================== --- src/core/load-dropin.c.orig +++ src/core/load-dropin.c @@ -58,6 +58,7 @@ static int iterate_dir( if (errno == ENOENT) return 0; + log_error("Failed to open directory %s: %m", path); return -errno; } @@ -101,7 +102,6 @@ static int process_dir( char ***strv) { _cleanup_free_ char *path = NULL; - int r; assert(u); assert(unit_path); @@ -112,11 +112,8 @@ static int process_dir( if (!path) return log_oom(); - if (!u->manager->unit_path_cache || set_get(u->manager->unit_path_cache, path)) { - r = iterate_dir(u, path, dependency, strv); - if (r < 0) - return r; - } + if (!u->manager->unit_path_cache || set_get(u->manager->unit_path_cache, path)) + iterate_dir(u, path, dependency, strv); if (u->instance) { _cleanup_free_ char *template = NULL, *p = NULL; @@ -130,11 +127,8 @@ static int process_dir( if (!p) return log_oom(); - if (!u->manager->unit_path_cache || set_get(u->manager->unit_path_cache, p)) { - r = iterate_dir(u, p, dependency, strv); - if (r < 0) - return r; - } + if (!u->manager->unit_path_cache || set_get(u->manager->unit_path_cache, p)) + iterate_dir(u, p, dependency, strv); } return 0; @@ -152,12 +146,8 @@ char **unit_find_dropin_paths(Unit *u) { SET_FOREACH(t, u->names, i) { char **p; - STRV_FOREACH(p, u->manager->lookup_paths.unit_path) { - /* This loads the drop-in config snippets */ - r = process_dir(u, *p, t, ".d", _UNIT_DEPENDENCY_INVALID, &strv); - if (r < 0) - return NULL; - } + STRV_FOREACH(p, u->manager->lookup_paths.unit_path) + process_dir(u, *p, t, ".d", _UNIT_DEPENDENCY_INVALID, &strv); } if (strv_isempty(strv)) @@ -176,7 +166,6 @@ char **unit_find_dropin_paths(Unit *u) { int unit_load_dropin(Unit *u) { Iterator i; char *t, **f; - int r; assert(u); @@ -186,13 +175,8 @@ int unit_load_dropin(Unit *u) { char **p; STRV_FOREACH(p, u->manager->lookup_paths.unit_path) { - r = process_dir(u, *p, t, ".wants", UNIT_WANTS, NULL); - if (r < 0) - return r; - - r = process_dir(u, *p, t, ".requires", UNIT_REQUIRES, NULL); - if (r < 0) - return r; + process_dir(u, *p, t, ".wants", UNIT_WANTS, NULL); + process_dir(u, *p, t, ".requires", UNIT_REQUIRES, NULL); } } @@ -201,11 +185,9 @@ int unit_load_dropin(Unit *u) { return 0; STRV_FOREACH(f, u->dropin_paths) { - r = config_parse(u->id, *f, NULL, - UNIT_VTABLE(u)->sections, config_item_perf_lookup, - (void*) load_fragment_gperf_lookup, false, false, u); - if (r < 0) - return r; + config_parse(u->id, *f, NULL, + UNIT_VTABLE(u)->sections, config_item_perf_lookup, + (void*) load_fragment_gperf_lookup, false, false, u); } u->dropin_mtime = now(CLOCK_REALTIME); ++++++ 0003-core-nicer-message-when-inotify-watches-are-exhauste.patch ++++++
From 18abe7bd3e13525b257da69ac49ff7841c289567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Wed, 16 Jul 2014 22:52:53 -0400 Subject: [PATCH] core: nicer message when inotify watches are exhausted
inotify_add_watch returns ENOSPC, which translates to "No space left on device", which is misleading. https://bugs.freedesktop.org/show_bug.cgi?id=73628 --- src/core/path.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git src/core/path.c src/core/path.c index 20e454d..f54c77f 100644 --- src/core/path.c +++ src/core/path.c @@ -99,7 +99,8 @@ int path_spec_watch(PathSpec *s, sd_event_io_handler_t handler) { break; } - log_warning("Failed to add watch on %s: %m", s->path); + log_warning("Failed to add watch on %s: %s", s->path, + errno == ENOSPC ? "too many watches" : strerror(-r)); r = -errno; if (cut) *cut = tmp; -- 1.7.9.2 ++++++ 0003-cryptsetup-default-to-no-hash-when-keyfile-is-specif.patch ++++++ Based on 8a52210c9392887a31fdb2845f65b4c5869e8e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Mon, 24 Nov 2014 09:11:12 -0500 Subject: [PATCH] cryptsetup: default to no hash when keyfile is specified For plain dm-crypt devices, the behavior of cryptsetup package is to ignore the hash algorithm when a key file is provided. It seems wrong to ignore a hash when it is explicitly specified, but we should default to no hash if the keyfile is specified. https://bugs.freedesktop.org/show_bug.cgi?id=52630 --- src/cryptsetup/cryptsetup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- src/cryptsetup/cryptsetup.c +++ src/cryptsetup/cryptsetup.c 2014-12-15 12:00:17.554019752 +0000 @@ -386,7 +386,9 @@ static int attach_luks_or_plain(struct c /* plain isn't a real hash type. it just means "use no hash" */ if (!streq(opt_hash, "plain")) params.hash = opt_hash; - } else + } else if (!key_file) + /* for CRYPT_PLAIN, the behaviour of cryptsetup + * package is to not hash when a key file is provided */ params.hash = "ripemd160"; if (opt_cipher) { ++++++ 0003-delta-do-not-use-unicode-chars-in-C-locale.patch ++++++
From 00a5cc3a63c125633e822f39efd9c32223169f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Wed, 16 Apr 2014 23:33:41 -0400 Subject: [PATCH] delta: do not use unicode chars in C locale
https://bugzilla.redhat.com/show_bug.cgi?id=1088418 --- src/delta/delta.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git src/delta/delta.c src/delta/delta.c index 369f8f8..8fc37c5 100644 --- src/delta/delta.c +++ src/delta/delta.c @@ -85,6 +85,10 @@ static void pager_open_if_enabled(void) { pager_open(false); } +static inline const char* arrow(void) { + return is_locale_utf8() ? "→" : "->"; +} + static int equivalent(const char *a, const char *b) { _cleanup_free_ char *x = NULL, *y = NULL; @@ -103,8 +107,9 @@ static int notify_override_masked(const char *top, const char *bottom) { if (!(arg_flags & SHOW_MASKED)) return 0; - printf("%s%s%s %s → %s\n", - ansi_highlight_red(), "[MASKED]", ansi_highlight_off(), top, bottom); + printf("%s%s%s %s %s %s\n", + ansi_highlight_red(), "[MASKED]", ansi_highlight_off(), + top, arrow(), bottom); return 1; } @@ -112,8 +117,9 @@ static int notify_override_equivalent(const char *top, const char *bottom) { if (!(arg_flags & SHOW_EQUIVALENT)) return 0; - printf("%s%s%s %s → %s\n", - ansi_highlight_green(), "[EQUIVALENT]", ansi_highlight_off(), top, bottom); + printf("%s%s%s %s %s %s\n", + ansi_highlight_green(), "[EQUIVALENT]", ansi_highlight_off(), + top, arrow(), bottom); return 1; } @@ -121,8 +127,9 @@ static int notify_override_redirected(const char *top, const char *bottom) { if (!(arg_flags & SHOW_REDIRECTED)) return 0; - printf("%s%s%s %s → %s\n", - ansi_highlight(), "[REDIRECTED]", ansi_highlight_off(), top, bottom); + printf("%s%s%s %s %s %s\n", + ansi_highlight(), "[REDIRECTED]", ansi_highlight_off(), + top, arrow(), bottom); return 1; } @@ -130,8 +137,9 @@ static int notify_override_overridden(const char *top, const char *bottom) { if (!(arg_flags & SHOW_OVERRIDDEN)) return 0; - printf("%s%s%s %s → %s\n", - ansi_highlight(), "[OVERRIDDEN]", ansi_highlight_off(), top, bottom); + printf("%s%s%s %s %s %s\n", + ansi_highlight(), "[OVERRIDDEN]", ansi_highlight_off(), + top, arrow(), bottom); return 1; } @@ -139,8 +147,9 @@ static int notify_override_extended(const char *top, const char *bottom) { if (!(arg_flags & SHOW_EXTENDED)) return 0; - printf("%s%s%s %s → %s\n", - ansi_highlight(), "[EXTENDED]", ansi_highlight_off(), top, bottom); + printf("%s%s%s %s %s %s\n", + ansi_highlight(), "[EXTENDED]", ansi_highlight_off(), + top, arrow(), bottom); return 1; } @@ -241,7 +250,7 @@ static int enumerate_dir_d(Hashmap *top, Hashmap *bottom, Hashmap *drops, const return -ENOMEM; d = p + strlen(toppath) + 1; - log_debug("Adding at top: %s → %s", d, p); + log_debug("Adding at top: %s %s %s", d, arrow(), p); k = hashmap_put(top, d, p); if (k >= 0) { p = strdup(p); @@ -253,7 +262,7 @@ static int enumerate_dir_d(Hashmap *top, Hashmap *bottom, Hashmap *drops, const return k; } - log_debug("Adding at bottom: %s → %s", d, p); + log_debug("Adding at bottom: %s %s %s", d, arrow(), p); free(hashmap_remove(bottom, d)); k = hashmap_put(bottom, d, p); if (k < 0) { @@ -276,7 +285,8 @@ static int enumerate_dir_d(Hashmap *top, Hashmap *bottom, Hashmap *drops, const if (!p) return -ENOMEM; - log_debug("Adding to drops: %s → %s → %s", unit, basename(p), p); + log_debug("Adding to drops: %s %s %s %s %s", + unit, arrow(), basename(p), arrow(), p); k = hashmap_put(h, basename(p), p); if (k < 0) { free(p); @@ -328,7 +338,7 @@ static int enumerate_dir(Hashmap *top, Hashmap *bottom, Hashmap *drops, const ch if (!p) return -ENOMEM; - log_debug("Adding at top: %s → %s", basename(p), p); + log_debug("Adding at top: %s %s %s", basename(p), arrow(), p); k = hashmap_put(top, basename(p), p); if (k >= 0) { p = strdup(p); @@ -339,7 +349,7 @@ static int enumerate_dir(Hashmap *top, Hashmap *bottom, Hashmap *drops, const ch return k; } - log_debug("Adding at bottom: %s → %s", basename(p), p); + log_debug("Adding at bottom: %s %s %s", basename(p), arrow(), p); free(hashmap_remove(bottom, basename(p))); k = hashmap_put(bottom, basename(p), p); if (k < 0) { -- 1.7.9.2 ++++++ 0003-fileio-label-return-error-when-writing-fails.patch ++++++ Based on 754fc0c720eb998b8e47e695c12807ced0ff3602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 3 Oct 2014 08:58:40 -0400 Subject: [PATCH] fileio-label: return error when writing fails The status of actually writing the file was totally ignored. --- src/shared/fileio-label.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- src/shared/fileio-label.c +++ src/shared/fileio-label.c 2014-10-14 14:52:50.883837740 +0000 @@ -33,7 +33,7 @@ int write_string_file_atomic_label(const if (r < 0) return r; - write_string_file_atomic(fn, line); + r = write_string_file_atomic(fn, line); label_context_clear(); @@ -47,7 +47,7 @@ int write_env_file_label(const char *fna if (r < 0) return r; - write_env_file(fname, l); + r = write_env_file(fname, l); label_context_clear(); ++++++ 0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch ++++++ Based on 571d0134bd464444567cf4eb0d2ed8df40045f36 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 24 Jun 2014 19:37:22 +0200 Subject: [PATCH] fsck: consider a fsck implementation linked to /bin/true non-existant --- src/fsck/fsck.c | 32 ++++++++++++++++++++++---------- src/shared/path-util.c | 26 +++++++++++++++----------- 2 files changed, 37 insertions(+), 21 deletions(-) Index: src/fsck/fsck.c =================================================================== --- src/fsck/fsck.c.orig +++ src/fsck/fsck.c @@ -37,6 +37,7 @@ #include "bus-errors.h" #include "fileio.h" #include "udev-util.h" +#include "path-util.h" static bool arg_skip = false; static bool arg_force = false; @@ -280,16 +281,28 @@ int main(int argc, char *argv[]) { type = udev_device_get_property_value(udev_device, "ID_FS_TYPE"); if (type) { - const char *checker = strappenda("/sbin/fsck.", type); - r = access(checker, X_OK); - if (r < 0) { - if (errno == ENOENT) { - log_info("%s doesn't exist, not checking file system on %s", - checker, device); - return EXIT_SUCCESS; - } else - log_warning("%s cannot be used for %s: %m", - checker, device); + _cleanup_free_ char *p = NULL, *d = NULL; + const char *checker = strappenda("fsck.", type); + r = find_binary(checker, &p); + if (r == -ENOENT) { + log_info("fsck.%s doesn't exist, not checking file system on %s", + type, device); + return EXIT_SUCCESS; + } else if (r < 0) { + log_warning("fsck.%s cannot be used for %s: %m", + type, device); + return r; + } + + /* An fsck that is linked to /bin/true is a non-existant fsck */ + r = readlink_malloc(p, &d); + if (r >= 0 && + (path_equal(d, "/bin/true") || + path_equal(d, "/usr/bin/true") || + path_equal(d, "/dev/null"))) { + log_info("fsck.%s doesn't exist, not checking file system on %s", + type, device); + return EXIT_SUCCESS; } } Index: src/shared/path-util.c =================================================================== --- src/shared/path-util.c.orig +++ src/shared/path-util.c @@ -425,19 +425,21 @@ int path_is_os_tree(const char *path) { int find_binary(const char *name, char **filename) { assert(name); - assert(filename); - if (strchr(name, '/')) { - char *p; + if (is_path(name)) { + if (access(name, X_OK) < 0) + return -errno; + + if (filename) { + char *p; - if (path_is_absolute(name)) - p = strdup(name); - else p = path_make_absolute_cwd(name); - if (!p) - return -ENOMEM; + if (!p) + return -ENOMEM; + + *filename = p; + } - *filename = p; return 0; } else { const char *path; @@ -463,8 +465,10 @@ int find_binary(const char *name, char * continue; } - path_kill_slashes(p); - *filename = p; + if (filename) { + path_kill_slashes(p); + *filename = p; + } return 0; } ++++++ 0003-hwdb-PCI-include-primary-model-string-in-subsystem-m.patch ++++++ ++++ 51583 lines (skipped) ++++++ 0003-hwdb-Update-database-of-Bluetooth-company-identifier.patch ++++++
From f89b42ec0fd51feab5566d6bdbacee101023c037 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann <marcel@holtmann.org> Date: Tue, 25 Mar 2014 20:21:23 -0700 Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
--- hwdb/20-bluetooth-vendor-product.hwdb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git hwdb/20-bluetooth-vendor-product.hwdb hwdb/20-bluetooth-vendor-product.hwdb index 7d86f10..b928f5a 100644 --- hwdb/20-bluetooth-vendor-product.hwdb +++ hwdb/20-bluetooth-vendor-product.hwdb @@ -923,3 +923,21 @@ bluetooth:v0130* bluetooth:v0131* ID_VENDOR_FROM_DATABASE=Cypress Semiconductor Corporation + +bluetooth:v0132* + ID_VENDOR_FROM_DATABASE=MADS Inc + +bluetooth:v0133* + ID_VENDOR_FROM_DATABASE=Blue Maestro Limited + +bluetooth:v0134* + ID_VENDOR_FROM_DATABASE=Resolution Products, Inc. + +bluetooth:v0135* + ID_VENDOR_FROM_DATABASE=Airewear LLC + +bluetooth:v0136* + ID_VENDOR_FROM_DATABASE=ETC sp. z.o.o. + +bluetooth:v0137* + ID_VENDOR_FROM_DATABASE=Prestigio Plaza Ltd. -- 1.7.9.2 ++++++ 0003-install-fix-invalid-free-in-unit_file_mask.patch ++++++
From 223217749e57996336d5730b0a28716cca56d45d Mon Sep 17 00:00:00 2001 From: Andreas Henriksson <andreas@fatal.se> Date: Fri, 13 Jun 2014 18:48:18 +0200 Subject: [PATCH] install: fix invalid free() in unit_file_mask()
int unit_file_mask(...) in ./src/shared/install.c calls get_config_path(...) which can in 4 error cases return without setting "ret", and thus "prefix" can be uninitialized when unit_file_mask(...) finishes (which it does directly after the error is returned from get_config_path(...)). --- src/shared/install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/shared/install.c src/shared/install.c index 487d0f6..f562063 100644 --- src/shared/install.c +++ src/shared/install.c @@ -563,7 +563,7 @@ int unit_file_mask( unsigned *n_changes) { char **i; - _cleanup_free_ char *prefix; + _cleanup_free_ char *prefix = NULL; int r; assert(scope >= 0); -- 1.7.9.2 ++++++ 0003-journald-add-CAP_MAC_OVERRIDE-in-journald-for-SMACK-.patch ++++++
From f2a474aea8f82fa9b695515d4590f4f3398358a7 Mon Sep 17 00:00:00 2001 From: Juho Son <juho80.son@samsung.com> Date: Thu, 11 Sep 2014 16:06:38 +0900 Subject: [PATCH] journald: add CAP_MAC_OVERRIDE in journald for SMACK issue
systemd-journald check the cgroup id to support rate limit option for every messages. so journald should be available to access cgroup node in each process send messages to journald. In system using SMACK, cgroup node in proc is assigned execute label as each process's execute label. so if journald don't want to denied for every process, journald should have all of access rule for all process's label. It's too heavy. so we could give special smack label for journald te get all accesses's permission. '^' label. When assign '^' execute smack label to systemd-journald, systemd-journald need to add CAP_MAC_OVERRIDE capability to get that smack privilege. so I want to notice this information and set default capability to journald whether system use SMACK or not. because that capability affect to only smack enabled kernel --- units/systemd-journald.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git units/systemd-journald.service.in units/systemd-journald.service.in index 7013979..4de38fa 100644 --- units/systemd-journald.service.in +++ units/systemd-journald.service.in @@ -20,7 +20,7 @@ Restart=always RestartSec=0 NotifyAccess=all StandardOutput=null -CapabilityBoundingSet=CAP_SYS_ADMIN CAP_DAC_OVERRIDE CAP_SYS_PTRACE CAP_SYSLOG CAP_AUDIT_CONTROL CAP_CHOWN CAP_DAC_READ_SEARCH CAP_FOWNER CAP_SETUID CAP_SETGID +CapabilityBoundingSet=CAP_SYS_ADMIN CAP_DAC_OVERRIDE CAP_SYS_PTRACE CAP_SYSLOG CAP_AUDIT_CONTROL CAP_CHOWN CAP_DAC_READ_SEARCH CAP_FOWNER CAP_SETUID CAP_SETGID CAP_MAC_OVERRIDE WatchdogSec=1min # Increase the default a bit in order to allow many simultaneous -- 1.7.9.2 ++++++ 0003-keymap-Adjust-for-more-Samsung-900X4-series.patch ++++++
From e512e8a255ef29d5a8eb605f8849202ea3d3e4cb Mon Sep 17 00:00:00 2001 From: Martin Pitt <martin.pitt@ubuntu.com> Date: Wed, 27 Aug 2014 08:41:10 +0200 Subject: [PATCH] keymap: Adjust for more Samsung 900X4 series
Reportedly also applies to NP900X4B, so relax the match to apply to all models of this series. https://launchpad.net/bugs/902332 --- hwdb/60-keyboard.hwdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index ef0ebc5..0ffcb83 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -939,7 +939,7 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*550P*:pvr* # Series 7 / 9 keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700Z*:pvr* keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700G*:pvr* -keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*900X[34][CDEFG]*:pvr* +keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*900X[34]*:pvr* keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*940X3G*:pvr* KEYBOARD_KEY_ce=!prog1 # Fn+F1 launch settings KEYBOARD_KEY_a0=!mute # Fn+F6 mute -- 1.7.9.2 ++++++ 0003-keymap-Annotate-all-micmute-workarounds.patch ++++++
From d946bb53f94713241004810de92cc37f1e19c2d2 Mon Sep 17 00:00:00 2001 From: Martin Pitt <martin.pitt@ubuntu.com> Date: Wed, 30 Jul 2014 10:54:23 +0200 Subject: [PATCH] keymap: Annotate all micmute workarounds
Add a comment to all assignments to f20 that this actually should be "micmute" in a future when we aren't limited by X.org's key code limiations any more. --- hwdb/60-keyboard.hwdb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index 70e372b..cbbbf2c 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -231,7 +231,7 @@ keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnXPS*:pvr* # Dell Latitude microphone mute keyboard:name:Dell WMI hotkeys:dmi:bvn*:bvr*:bd*:svnDell*:pnLatitude* - KEYBOARD_KEY_150=f20 # Mic mute toggle + KEYBOARD_KEY_150=f20 # Mic mute toggle, should be micmute ########################################################### # Everex @@ -505,7 +505,7 @@ keyboard:name:ThinkPad Extra Buttons:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn* KEYBOARD_KEY_15=volumedown KEYBOARD_KEY_16=mute KEYBOARD_KEY_17=prog1 - KEYBOARD_KEY_1a=f20 + KEYBOARD_KEY_1a=f20 # Microphone mute button; should be micmute # ThinkPad Keyboard with TrackPoint keyboard:usb:v17EFp6009* @@ -573,7 +573,7 @@ keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*IdeaPad*Y550*:pvr* keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*IdeaPad*U300s*:pvr* KEYBOARD_KEY_f1=f21 - KEYBOARD_KEY_ce=f20 + KEYBOARD_KEY_ce=f20 # micmute keyboard:dmi:bvn*:bvr*:svnLENOVO*:pn*IdeaPad*Z370*:pvr* KEYBOARD_KEY_a0=!mute @@ -809,7 +809,7 @@ keyboard:dmi:bvn*:bvr*:bd*:svnOLPC:pnXO:* KEYBOARD_KEY_f3=f17 KEYBOARD_KEY_f2=f18 KEYBOARD_KEY_f1=f19 - KEYBOARD_KEY_f0=f20 + KEYBOARD_KEY_f0=f20 # micmute KEYBOARD_KEY_ef=f21 KEYBOARD_KEY_ee=chat KEYBOARD_KEY_e4=chat -- 1.7.9.2 ++++++ 0003-keymap-Fix-HP-Pavillon-DV7.patch ++++++
From efb4bf4e419e14a13eead6289ea40165579a816f Mon Sep 17 00:00:00 2001 From: Martin Pitt <martin.pitt@ubuntu.com> Date: Tue, 5 Aug 2014 12:29:27 +0200 Subject: [PATCH] keymap: Fix HP Pavillon DV7
Properly disable scan code 94 instead of producing KEY_0. https://launchpad.net/bugs/1322770 --- hwdb/60-keyboard.hwdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index cbbbf2c..5c3d4ca 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -368,7 +368,7 @@ keyboard:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pnHP*Pavilion*dv7*Notebook*PC:pvr KEYBOARD_KEY_b7=print KEYBOARD_KEY_c2=media # FIXME: quick play KEYBOARD_KEY_c6=break - KEYBOARD_KEY_94=0 + KEYBOARD_KEY_94=reserved # Elitebook keyboard:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pn*Compaq*:pvr* -- 1.7.9.2 ++++++ 0003-localed-consider-an-unset-model-as-a-wildcard.patch ++++++
From 387066c2e5bda159201896b194711965b52f34a9 Mon Sep 17 00:00:00 2001 From: Michal Sekletar <msekleta@redhat.com> Date: Fri, 30 May 2014 18:20:16 +0200 Subject: [PATCH] localed: consider an unset model as a wildcard
--- src/locale/localed.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git src/locale/localed.c src/locale/localed.c index e3061c8..358f6c2 100644 --- src/locale/localed.c +++ src/locale/localed.c @@ -712,15 +712,16 @@ static int find_legacy_keymap(Context *c, char **new_keymap) { } } - if (matching > 0 && - streq_ptr(c->x11_model, a[2])) { - matching++; - - if (streq_ptr(c->x11_variant, a[3])) { + if (matching > 0) { + if (isempty(c->x11_model) || streq_ptr(c->x11_model, a[2])) { matching++; - if (streq_ptr(c->x11_options, a[4])) + if (streq_ptr(c->x11_variant, a[3])) { matching++; + + if (streq_ptr(c->x11_options, a[4])) + matching++; + } } } -- 1.7.9.2 ++++++ 0003-login-Allow-calling-org.freedesktop.login1.Seat.Swit.patch ++++++
From 9c413373d2112055a0142ef522bf95af9b491b4a Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" <jstpierre@mecheye.net> Date: Fri, 21 Feb 2014 18:23:17 -0500 Subject: [PATCH] login: Allow calling org.freedesktop.login1.Seat.SwitchTo
--- src/login/org.freedesktop.login1.conf | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git src/login/org.freedesktop.login1.conf src/login/org.freedesktop.login1.conf index d677f61..1318328 100644 --- src/login/org.freedesktop.login1.conf +++ src/login/org.freedesktop.login1.conf @@ -141,6 +141,18 @@ send_member="ActivateSession"/> <allow send_destination="org.freedesktop.login1" + send_interface="org.freedesktop.login1.Seat" + send_member="SwitchTo"/> + + <allow send_destination="org.freedesktop.login1" + send_interface="org.freedesktop.login1.Seat" + send_member="SwitchToPrevious"/> + + <allow send_destination="org.freedesktop.login1" + send_interface="org.freedesktop.login1.Seat" + send_member="SwitchToNext"/> + + <allow send_destination="org.freedesktop.login1" send_interface="org.freedesktop.login1.Session" send_member="Activate"/> -- 1.7.9.2 ++++++ 0003-logind-ignore-lid-switch-events-for-30s-after-each-s.patch ++++++
From f9cd6be10ece07e10488c05e270a0b5860779864 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 3 Mar 2014 20:49:33 +0100 Subject: [PATCH] logind: ignore lid switch events for 30s after each suspend and 3min after startup
This is needed to give USB docking stations and suchlike time to settle, so that a display connected to an USB docking station can actually act as a lid swith inhibitor correctly. With this change we should have somewhat reliable docking station support in place. --- src/login/logind-action.c | 15 ++++++++++++++- src/login/logind-dbus.c | 3 +++ src/login/logind.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/login/logind.h | 7 +++++++ 4 files changed, 69 insertions(+), 1 deletion(-) diff --git src/login/logind-action.c src/login/logind-action.c index c9d8bc5..ae7b350 100644 --- src/login/logind-action.c +++ src/login/logind-action.c @@ -70,20 +70,33 @@ int manager_handle_action( return 0; } - /* If we are docked don't react to lid closing */ if (inhibit_key == INHIBIT_HANDLE_LID_SWITCH) { int n; + /* If we are docked don't react to lid closing */ if (manager_is_docked(m)) { log_debug("Ignoring lid switch request, system is docked."); return 0; } + /* If we have more than one or no displays connected, + * don't react to lid closing. The no display case we + * treat like this under the assumption that there is + * no modern drm driver available. */ n = manager_count_displays(m); if (n != 1) { log_debug("Ignoring lid switch request, %i displays connected.", n); return 0; } + + /* If the last system suspend or startup is too close, + * let's not suspend for now, to give USB docking + * stations some time to settle so that we can + * properly watch its displays. */ + if (m->lid_switch_ignore_event_source) { + log_debug("Ignoring lid switch request, system startup or resume too close."); + return 0; + } } /* If the key handling is inhibited, don't do anything */ diff --git src/login/logind-dbus.c src/login/logind-dbus.c index fc89531..c9c58f3 100644 --- src/login/logind-dbus.c +++ src/login/logind-dbus.c @@ -1337,6 +1337,9 @@ static int execute_shutdown_or_sleep( m->action_job = c; m->action_what = w; + /* Make sure the lid switch is ignored for a while */ + manager_set_lid_switch_ignore(m, now(CLOCK_MONOTONIC) + IGNORE_LID_SWITCH_SUSPEND_USEC); + return 0; } diff --git src/login/logind.c src/login/logind.c index 10f61ab..fd113b3 100644 --- src/login/logind.c +++ src/login/logind.c @@ -144,6 +144,7 @@ void manager_free(Manager *m) { sd_event_source_unref(m->udev_device_event_source); sd_event_source_unref(m->udev_vcsa_event_source); sd_event_source_unref(m->udev_button_event_source); + sd_event_source_unref(m->lid_switch_ignore_event_source); if (m->console_active_fd >= 0) close_nointr_nofail(m->console_active_fd); @@ -959,6 +960,46 @@ static int manager_dispatch_idle_action(sd_event_source *s, uint64_t t, void *us return 0; } +static int lid_switch_ignore_handler(sd_event_source *e, uint64_t usec, void *userdata) { + Manager *m = userdata; + + assert(e); + assert(m); + + m->lid_switch_ignore_event_source = sd_event_source_unref(m->lid_switch_ignore_event_source); + return 0; +} + +int manager_set_lid_switch_ignore(Manager *m, usec_t until) { + int r; + + assert(m); + + if (until <= now(CLOCK_MONOTONIC)) + return 0; + + /* We want to ignore the lid switch for a while after each + * suspend, and after boot-up. Hence let's install a timer for + * this. As long as the event source exists we ignore the lid + * switch. */ + + if (m->lid_switch_ignore_event_source) { + usec_t u; + + r = sd_event_source_get_time(m->lid_switch_ignore_event_source, &u); + if (r < 0) + return r; + + if (until <= u) + return 0; + + r = sd_event_source_set_time(m->lid_switch_ignore_event_source, until); + } else + r = sd_event_add_monotonic(m->event, &m->lid_switch_ignore_event_source, until, 0, lid_switch_ignore_handler, m); + + return r; +} + int manager_startup(Manager *m) { int r; Seat *seat; @@ -994,6 +1035,10 @@ int manager_startup(Manager *m) { return r; } + r = manager_set_lid_switch_ignore(m, 0 + IGNORE_LID_SWITCH_STARTUP_USEC); + if (r < 0) + log_warning("Failed to set up lid switch ignore event source: %s", strerror(-r)); + /* Deserialize state */ r = manager_enumerate_devices(m); if (r < 0) diff --git src/login/logind.h src/login/logind.h index 74d6641..4bb8e7b 100644 --- src/login/logind.h +++ src/login/logind.h @@ -42,6 +42,9 @@ typedef struct Manager Manager; #include "logind-button.h" #include "logind-action.h" +#define IGNORE_LID_SWITCH_STARTUP_USEC (3 * USEC_PER_MINUTE) +#define IGNORE_LID_SWITCH_SUSPEND_USEC (30 * USEC_PER_SEC) + struct Manager { sd_event *event; sd_bus *bus; @@ -118,6 +121,8 @@ struct Manager { bool lid_switch_ignore_inhibited; Hashmap *polkit_registry; + + sd_event_source *lid_switch_ignore_event_source; }; Manager *manager_new(void); @@ -178,3 +183,5 @@ const struct ConfigPerfItem* logind_gperf_lookup(const char *key, unsigned lengt int manager_watch_busname(Manager *manager, const char *name); void manager_drop_busname(Manager *manager, const char *name); + +int manager_set_lid_switch_ignore(Manager *m, usec_t until); -- 1.7.9.2 ++++++ 0003-man-mention-XDG_CONFIG_HOME-in-systemd.unit.patch ++++++
From 05a2f6fefedd7254fd799502191d025d2908cf74 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen <tanu.kaskinen@linux.intel.com> Date: Sat, 12 Apr 2014 08:37:38 +0300 Subject: [PATCH] man: mention XDG_CONFIG_HOME in systemd.unit
--- man/systemd.unit.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git man/systemd.unit.xml man/systemd.unit.xml index 07a73fd..bcd4ba8 100644 --- man/systemd.unit.xml +++ man/systemd.unit.xml @@ -70,7 +70,8 @@ <filename>...</filename> </literallayout></para> - <para><literallayout><filename>$HOME/.config/systemd/user/*</filename> + <para><literallayout><filename>$XDG_CONFIG_HOME/systemd/user/*</filename> +<filename>$HOME/.config/systemd/user/*</filename> <filename>/etc/systemd/user/*</filename> <filename>/run/systemd/user/*</filename> <filename>/usr/lib/systemd/user/*</filename> @@ -320,8 +321,12 @@ </thead> <tbody> <row> + <entry><filename>$XDG_CONFIG_HOME/systemd/user</filename></entry> + <entry>User configuration (only used when $XDG_CONFIG_HOME is set)</entry> + </row> + <row> <entry><filename>$HOME/.config/systemd/user</filename></entry> - <entry>User configuration</entry> + <entry>User configuration (only used when $XDG_CONFIG_HOME is not set)</entry> </row> <row> <entry><filename>/etc/systemd/user</filename></entry> -- 1.7.9.2 ++++++ 0003-man-we-don-t-have-Wanted-dependency.patch ++++++
From 3e883473a0f36c220fc45ecf61d6878c9ac308b4 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn <lnykryn@redhat.com> Date: Wed, 15 Oct 2014 09:28:31 +0200 Subject: [PATCH] man: we don't have 'Wanted' dependency
--- man/systemd.unit.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git man/systemd.unit.xml man/systemd.unit.xml index e9395ff..88c9d7f 100644 --- man/systemd.unit.xml +++ man/systemd.unit.xml @@ -181,10 +181,10 @@ <filename>foo.service.wants/</filename> may exist. All unit files symlinked from such a directory are implicitly added as dependencies of type - <varname>Wanted=</varname> to the unit. This is useful + <varname>Wants=</varname> to the unit. This is useful to hook units into the start-up of other units, without having to modify their unit files. For details - about the semantics of <varname>Wanted=</varname>, see + about the semantics of <varname>Wants=</varname>, see below. The preferred way to create symlinks in the <filename>.wants/</filename> directory of a unit file is with the <command>enable</command> command of the -- 1.7.9.2 ++++++ 0003-mount-order-options-before-other-arguments-to-mount.patch ++++++ Based on 141a1ceaa62578f1ed14f04cae2113dd0f49fd7f Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing <systemd@esmil.dk> Date: Thu, 18 Sep 2014 15:24:59 +0200 Subject: [PATCH] mount: order options before other arguments to mount --- src/core/mount.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- src/core/mount.c +++ src/core/mount.c 2014-09-25 13:43:44.926563278 +0000 @@ -947,10 +947,11 @@ static void mount_enter_mounting(Mount * r = exec_command_set( m->control_command, "/bin/mount", + "-n", + "-t", m->parameters_fragment.fstype ? m->parameters_fragment.fstype : "auto", + "-o", m->parameters_fragment.options ? m->parameters_fragment.options : "defaults", m->parameters_fragment.what, m->where, - "-t", m->parameters_fragment.fstype ? m->parameters_fragment.fstype : "auto", - m->parameters_fragment.options ? "-o" : NULL, m->parameters_fragment.options, NULL); else r = -ENOENT; @@ -994,10 +995,11 @@ static void mount_enter_remounting(Mount r = exec_command_set( m->control_command, "/bin/mount", - m->parameters_fragment.what, - m->where, + "-n", "-t", m->parameters_fragment.fstype ? m->parameters_fragment.fstype : "auto", "-o", o, + m->parameters_fragment.what, + m->where, NULL); } else r = -ENOENT; ++++++ 0003-namespace-make-sure-tmp-var-tmp-and-dev-are-writable.patch ++++++ Based on 664064d60c36e1f62c7e9177e4c7498035467e07 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 3 Jul 2014 16:27:57 +0200 Subject: [PATCH] namespace: make sure /tmp, /var/tmp and /dev are writable in namespaces we set up --- src/core/namespace.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- src/core/namespace.c +++ src/core/namespace.c 2014-07-04 09:55:21.582234949 +0000 @@ -263,14 +263,17 @@ static int make_read_only(BindMount *m) assert(m); - if (m->mode != INACCESSIBLE && m->mode != READONLY) - return 0; + if (IN_SET(m->mode, INACCESSIBLE, READONLY)) + r = mount(NULL, m->path, NULL, MS_BIND|MS_REMOUNT|MS_RDONLY|MS_REC, NULL); + else if (IN_SET(m->mode, READWRITE, PRIVATE_TMP, PRIVATE_VAR_TMP, PRIVATE_DEV)) + r = mount(NULL, m->path, NULL, MS_BIND|MS_REMOUNT|MS_REC, NULL); + else + r = 0; - r = mount(NULL, m->path, NULL, MS_BIND|MS_REMOUNT|MS_RDONLY|MS_REC, NULL); if (r < 0 && !(m->ignore && errno == ENOENT)) return -errno; - return 0; + return r; } int setup_namespace( ++++++ 0003-sd-bus-check-return-value-of-vasprintf.patch ++++++
From 8bf13eb1e02b9977ae1cd331ae5dc7305a305a09 Mon Sep 17 00:00:00 2001 From: Daniel Mack <daniel@zonque.org> Date: Tue, 7 Oct 2014 12:10:06 +0200 Subject: [PATCH] sd-bus: check return value of vasprintf
Check for OOM situations when vasprintf() returns < 0 in bus_error_setfv(). Spotted by coverity. --- src/libsystemd/sd-bus/bus-error.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git src/libsystemd/sd-bus/bus-error.c src/libsystemd/sd-bus/bus-error.c index abdfd73..5ca974a 100644 --- src/libsystemd/sd-bus/bus-error.c +++ src/libsystemd/sd-bus/bus-error.c @@ -194,8 +194,13 @@ int bus_error_setfv(sd_bus_error *e, const char *name, const char *format, va_li return -ENOMEM; } - if (format) - vasprintf((char**) &e->message, format, ap); + if (format) { + int r; + + r = vasprintf((char**) &e->message, format, ap); + if (r < 0) + return -ENOMEM; + } e->_need_free = 1; -- 1.7.9.2 ++++++ 0003-sd-bus-don-t-use-assert_return-to-check-for-disconne.patch ++++++
From a3d59cd1b0a2738d06893948492113f2c35be0af Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 19 Mar 2014 21:41:21 +0100 Subject: [PATCH] sd-bus: don't use assert_return() to check for disconnected bus connections
A terminated connection is a runtime error and not a developer mistake, hence don't use assert_return() to check for it. --- src/libsystemd/sd-bus/bus-control.c | 20 +++++++++++++----- src/libsystemd/sd-bus/bus-convenience.c | 58 +++++++++++++++++++++++++++++++++++++++++------------- src/libsystemd/sd-bus/bus-objects.c | 23 +++++++++++++++------ src/libsystemd/sd-bus/sd-bus.c | 49 +++++++++++++++++++++++++++++++++------------ 4 files changed, 113 insertions(+), 37 deletions(-) --- src/libsystemd/sd-bus/bus-control.c +++ src/libsystemd/sd-bus/bus-control.c 2014-03-28 00:00:00.000000000 +0000 @@ -128,12 +128,14 @@ _public_ int sd_bus_request_name(sd_bus assert_return(bus, -EINVAL); assert_return(name, -EINVAL); assert_return(bus->bus_client, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); assert_return(!(flags & ~(SD_BUS_NAME_ALLOW_REPLACEMENT|SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_QUEUE)), -EINVAL); assert_return(service_name_is_valid(name), -EINVAL); assert_return(name[0] != ':', -EINVAL); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + if (bus->is_kernel) return bus_request_name_kernel(bus, name, flags); else @@ -201,11 +203,13 @@ _public_ int sd_bus_release_name(sd_bus assert_return(bus, -EINVAL); assert_return(name, -EINVAL); assert_return(bus->bus_client, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); assert_return(service_name_is_valid(name), -EINVAL); assert_return(name[0] != ':', -EINVAL); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + if (bus->is_kernel) return bus_release_name_kernel(bus, name); else @@ -344,9 +348,11 @@ static int bus_list_names_dbus1(sd_bus * _public_ int sd_bus_list_names(sd_bus *bus, char ***acquired, char ***activatable) { assert_return(bus, -EINVAL); assert_return(acquired || activatable, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + if (bus->is_kernel) return bus_list_names_kernel(bus, acquired, activatable); else @@ -737,11 +743,13 @@ _public_ int sd_bus_get_owner( assert_return(name, -EINVAL); assert_return(mask <= _SD_BUS_CREDS_ALL, -ENOTSUP); assert_return(mask == 0 || creds, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); assert_return(service_name_is_valid(name), -EINVAL); assert_return(bus->bus_client, -ENODATA); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + if (bus->is_kernel) return bus_get_owner_kdbus(bus, name, mask, creds); else @@ -1198,10 +1206,12 @@ _public_ int sd_bus_get_owner_machine_id assert_return(bus, -EINVAL); assert_return(name, -EINVAL); assert_return(machine, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); assert_return(service_name_is_valid(name), -EINVAL); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + if (streq_ptr(name, bus->unique_name)) return sd_id128_get_machine(machine); --- src/libsystemd/sd-bus/bus-convenience.c +++ src/libsystemd/sd-bus/bus-convenience.c 2014-03-28 00:00:00.000000000 +0000 @@ -36,9 +36,11 @@ _public_ int sd_bus_emit_signal( int r; assert_return(bus, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + r = sd_bus_message_new_signal(bus, &m, path, interface, member); if (r < 0) return r; @@ -70,9 +72,11 @@ _public_ int sd_bus_call_method( int r; assert_return(bus, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + r = sd_bus_message_new_method_call(bus, &m, destination, path, interface, member); if (r < 0) return r; @@ -100,9 +104,12 @@ _public_ int sd_bus_reply_method_return( assert_return(call, -EINVAL); assert_return(call->sealed, -EPERM); assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); - assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); + assert_return(call->bus, -EINVAL); assert_return(!bus_pid_changed(call->bus), -ECHILD); + if (!BUS_IS_OPEN(call->bus->state)) + return -ENOTCONN; + if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) return 0; @@ -134,9 +141,12 @@ _public_ int sd_bus_reply_method_error( assert_return(call->sealed, -EPERM); assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); assert_return(sd_bus_error_is_set(e), -EINVAL); - assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); + assert_return(call->bus, -EINVAL); assert_return(!bus_pid_changed(call->bus), -ECHILD); + if (!BUS_IS_OPEN(call->bus->state)) + return -ENOTCONN; + if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) return 0; @@ -159,9 +169,12 @@ _public_ int sd_bus_reply_method_errorf( assert_return(call, -EINVAL); assert_return(call->sealed, -EPERM); assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); - assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); + assert_return(call->bus, -EINVAL); assert_return(!bus_pid_changed(call->bus), -ECHILD); + if (!BUS_IS_OPEN(call->bus->state)) + return -ENOTCONN; + if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) return 0; @@ -182,9 +195,12 @@ _public_ int sd_bus_reply_method_errno( assert_return(call, -EINVAL); assert_return(call->sealed, -EPERM); assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); - assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); + assert_return(call->bus, -EINVAL); assert_return(!bus_pid_changed(call->bus), -ECHILD); + if (!BUS_IS_OPEN(call->bus->state)) + return -ENOTCONN; + if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) return 0; @@ -208,9 +224,12 @@ _public_ int sd_bus_reply_method_errnof( assert_return(call, -EINVAL); assert_return(call->sealed, -EPERM); assert_return(call->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); - assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); + assert_return(call->bus, -EINVAL); assert_return(!bus_pid_changed(call->bus), -ECHILD); + if (!BUS_IS_OPEN(call->bus->state)) + return -ENOTCONN; + if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) return 0; @@ -239,9 +258,11 @@ _public_ int sd_bus_get_property( assert_return(member_name_is_valid(member), -EINVAL); assert_return(reply, -EINVAL); assert_return(signature_is_single(type, false), -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &rep, "ss", strempty(interface), member); if (r < 0) return r; @@ -273,9 +294,11 @@ _public_ int sd_bus_get_property_trivial assert_return(member_name_is_valid(member), -EINVAL); assert_return(bus_type_is_trivial(type), -EINVAL); assert_return(ptr, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member); if (r < 0) return r; @@ -309,9 +332,11 @@ _public_ int sd_bus_get_property_string( assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL); assert_return(member_name_is_valid(member), -EINVAL); assert_return(ret, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member); if (r < 0) return r; @@ -348,9 +373,11 @@ _public_ int sd_bus_get_property_strv( assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL); assert_return(member_name_is_valid(member), -EINVAL); assert_return(ret, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member); if (r < 0) return r; @@ -383,9 +410,11 @@ _public_ int sd_bus_set_property( assert_return(isempty(interface) || interface_name_is_valid(interface), -EINVAL); assert_return(member_name_is_valid(member), -EINVAL); assert_return(signature_is_single(type, false), -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + r = sd_bus_message_new_method_call(bus, &m, destination, path, "org.freedesktop.DBus.Properties", "Set"); if (r < 0) return r; @@ -416,9 +445,12 @@ _public_ int sd_bus_query_sender_creds(s assert_return(call, -EINVAL); assert_return(call->sealed, -EPERM); - assert_return(call->bus && BUS_IS_OPEN(call->bus->state), -ENOTCONN); + assert_return(call->bus, -EINVAL); assert_return(!bus_pid_changed(call->bus), -ECHILD); + if (!BUS_IS_OPEN(call->bus->state)) + return -ENOTCONN; + c = sd_bus_message_get_creds(call); /* All data we need? */ --- src/libsystemd/sd-bus/bus-objects.c +++ src/libsystemd/sd-bus/bus-objects.c 2014-03-28 00:00:00.000000000 +0000 @@ -2196,9 +2196,10 @@ _public_ int sd_bus_emit_properties_chan assert_return(bus, -EINVAL); assert_return(object_path_is_valid(path), -EINVAL); assert_return(interface_name_is_valid(interface), -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; /* A non-NULL but empty names list means nothing needs to be generated. A NULL list OTOH indicates that all properties @@ -2241,9 +2242,11 @@ _public_ int sd_bus_emit_properties_chan assert_return(bus, -EINVAL); assert_return(object_path_is_valid(path), -EINVAL); assert_return(interface_name_is_valid(interface), -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + if (!name) return 0; @@ -2361,9 +2364,11 @@ _public_ int sd_bus_emit_interfaces_adde assert_return(bus, -EINVAL); assert_return(object_path_is_valid(path), -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + if (strv_isempty(interfaces)) return 0; @@ -2421,9 +2426,11 @@ _public_ int sd_bus_emit_interfaces_adde assert_return(bus, -EINVAL); assert_return(object_path_is_valid(path), -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + interfaces = strv_from_stdarg_alloca(interface); return sd_bus_emit_interfaces_added_strv(bus, path, interfaces); @@ -2435,9 +2442,11 @@ _public_ int sd_bus_emit_interfaces_remo assert_return(bus, -EINVAL); assert_return(object_path_is_valid(path), -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + if (strv_isempty(interfaces)) return 0; @@ -2461,9 +2470,11 @@ _public_ int sd_bus_emit_interfaces_remo assert_return(bus, -EINVAL); assert_return(object_path_is_valid(path), -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + interfaces = strv_from_stdarg_alloca(interface); return sd_bus_emit_interfaces_removed_strv(bus, path, interfaces); --- src/libsystemd/sd-bus/sd-bus.c +++ src/libsystemd/sd-bus/sd-bus.c 2014-03-28 12:19:27.146736146 +0000 @@ -1592,10 +1592,12 @@ static int bus_send_internal(sd_bus *bus int r; assert_return(bus, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(m, -EINVAL); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + if (m->n_fds > 0) { r = sd_bus_can_send(bus, SD_BUS_TYPE_UNIX_FD); if (r < 0) @@ -1671,10 +1673,12 @@ _public_ int sd_bus_send_to(sd_bus *bus, int r; assert_return(bus, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(m, -EINVAL); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + if (!streq_ptr(m->destination, destination)) { if (!destination) @@ -1726,13 +1730,15 @@ _public_ int sd_bus_call_async( int r; assert_return(bus, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(m, -EINVAL); assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL); assert_return(callback, -EINVAL); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + r = hashmap_ensure_allocated(&bus->reply_callbacks, uint64_hash_func, uint64_compare_func); if (r < 0) return r; @@ -1839,13 +1845,15 @@ _public_ int sd_bus_call( int r; assert_return(bus, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(m, -EINVAL); assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL); assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL); assert_return(!bus_error_is_dirty(error), -EINVAL); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; + r = bus_ensure_running(bus); if (r < 0) return r; @@ -1971,9 +1979,11 @@ _public_ int sd_bus_get_events(sd_bus *b int flags = 0; assert_return(bus, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state) || bus->state == BUS_CLOSING, -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state) && bus->state != BUS_CLOSING) + return -ENOTCONN; + if (bus->state == BUS_OPENING) flags |= POLLOUT; else if (bus->state == BUS_AUTHENTICATING) { @@ -1998,9 +2008,11 @@ _public_ int sd_bus_get_timeout(sd_bus * assert_return(bus, -EINVAL); assert_return(timeout_usec, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state) || bus->state == BUS_CLOSING, -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); + if (!BUS_IS_OPEN(bus->state) && bus->state != BUS_CLOSING) + return -ENOTCONN; + if (bus->state == BUS_CLOSING) { *timeout_usec = 0; return 1; @@ -2510,7 +2522,8 @@ static int bus_poll(sd_bus *bus, bool ne if (bus->state == BUS_CLOSING) return 1; - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; e = sd_bus_get_events(bus); if (e < 0) @@ -2565,7 +2578,8 @@ _public_ int sd_bus_wait(sd_bus *bus, ui if (bus->state == BUS_CLOSING) return 0; - assert_return(BUS_IS_OPEN(bus->state) , -ENOTCONN); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; if (bus->rqueue_size > 0) return 0; @@ -2582,7 +2596,8 @@ _public_ int sd_bus_flush(sd_bus *bus) { if (bus->state == BUS_CLOSING) return 0; - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; r = bus_ensure_running(bus); if (r < 0) @@ -3058,9 +3073,13 @@ _public_ int sd_bus_get_peer_creds(sd_bu assert_return(bus, -EINVAL); assert_return(mask <= _SD_BUS_CREDS_ALL, -ENOTSUP); assert_return(ret, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); - assert_return(!bus->is_kernel, -ENOTSUP); + + if (!bus->is_kernel) + return -ENOTSUP; + + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; if (!bus->ucred_valid && !isempty(bus->label)) return -ENODATA; @@ -3099,9 +3118,13 @@ _public_ int sd_bus_try_close(sd_bus *bu int r; assert_return(bus, -EINVAL); - assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN); assert_return(!bus_pid_changed(bus), -ECHILD); - assert_return(bus->is_kernel, -ENOTSUP); + + if (!bus->is_kernel) + return -ENOTSUP; + + if (!BUS_IS_OPEN(bus->state)) + return -ENOTCONN; if (bus->rqueue_size > 0) return -EBUSY; ++++++ 0003-sd-bus-refuse-properties-that-claim-to-be-both-writa.patch ++++++
From 9b772efb41c2d9f743ba5e96804bdf89b12630d8 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 19 Nov 2014 20:52:47 +0100 Subject: [PATCH] sd-bus: refuse properties that claim to be both writable and constant at the same time
--- src/libsystemd/sd-bus/bus-objects.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git src/libsystemd/sd-bus/bus-objects.c src/libsystemd/sd-bus/bus-objects.c index 0ab1119..7981d65 100644 --- src/libsystemd/sd-bus/bus-objects.c +++ src/libsystemd/sd-bus/bus-objects.c @@ -1682,6 +1682,11 @@ static int add_object_vtable_internal( goto fail; } + if (v->flags & SD_BUS_VTABLE_PROPERTY_CONST) { + r = -EINVAL; + goto fail; + } + /* Fall through */ case _SD_BUS_VTABLE_PROPERTY: { -- 1.7.9.2 ++++++ 0003-sd-event-always-call-epoll_ctl-on-mask-updates-if-ed.patch ++++++
From b63c8d4f0364457b0ead8793504012bb7113974f Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Thu, 10 Jul 2014 00:47:23 +0200 Subject: [PATCH] sd-event: always call epoll_ctl() on mask-updates if edge-triggered
A call to sd_event_source_set_io_events() skipps calling into the kernel if the new event-mask matches the old one. This is safe for level-triggered sources as the kernel moves them onto the ready-list automatically if events change. However, edge-triggered sources might not be on the ready-list even though events are present. A call to sd_event_source_set_io_events() with EPOLLET set might thus be used to just move the io-source onto the ready-list so the next poll will return it again. This is very useful to avoid starvation in priority-based event queues. Imagine a read() loop on an edge-triggered fd. If we cannot read data fast enough to drain the receive queue, we might decide to skip reading for now and schedule it for later. On edge-triggered io-sources we have to make sure it's put on the ready-list so the next dispatch-round will return it again if it's still the highest priority task. We could make sd-event handle edge-triggered sources directly and allow marking them ready again. However, it's much simpler to let the kernel do that for now via EPOLL_CTL_MOD. --- src/libsystemd/sd-event/sd-event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git src/libsystemd/sd-event/sd-event.c src/libsystemd/sd-event/sd-event.c index 53f1904..a21f7db 100644 --- src/libsystemd/sd-event/sd-event.c +++ src/libsystemd/sd-event/sd-event.c @@ -1282,7 +1282,8 @@ _public_ int sd_event_source_set_io_events(sd_event_source *s, uint32_t events) assert_return(s->event->state != SD_EVENT_FINISHED, -ESTALE); assert_return(!event_pid_changed(s->event), -ECHILD); - if (s->io.events == events) + /* edge-triggered updates are never skipped, so we can reset edges */ + if (s->io.events == events && !(events & EPOLLET)) return 0; if (s->enabled != SD_EVENT_OFF) { -- 1.7.9.2 ++++++ 0003-sd-journal-properly-convert-object-size-on-big-endia.patch ++++++
From 57cd09acf2c63a414aa2131c00a2b3f600eb0133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 23 Aug 2014 22:35:03 -0400 Subject: [PATCH] sd-journal: properly convert object->size on big endian
mmap code crashes when attempting to map an object of zero size. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758392 https://bugs.freedesktop.org/show_bug.cgi?id=82894 --- src/journal/journal-file.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git src/journal/journal-file.h src/journal/journal-file.h index 3d41682..da2ef3b 100644 --- src/journal/journal-file.h +++ src/journal/journal-file.h @@ -214,14 +214,15 @@ static unsigned type_to_context(int type) { static inline int journal_file_object_keep(JournalFile *f, Object *o, uint64_t offset) { unsigned context = type_to_context(o->object.type); + uint64_t s = le64toh(o->object.size); return mmap_cache_get(f->mmap, f->fd, f->prot, context, true, - offset, o->object.size, &f->last_stat, NULL); + offset, s, &f->last_stat, NULL); } static inline int journal_file_object_release(JournalFile *f, Object *o, uint64_t offset) { unsigned context = type_to_context(o->object.type); + uint64_t s = le64toh(o->object.size); - return mmap_cache_release(f->mmap, f->fd, f->prot, context, - offset, o->object.size); + return mmap_cache_release(f->mmap, f->fd, f->prot, context, offset, s); } -- 1.7.9.2 ++++++ 0003-shared-install-avoid-prematurely-rejecting-missing-u.patch ++++++
From 0ffce503cd6e5a5ff5ba5cd1cc23684cfb8bb9e3 Mon Sep 17 00:00:00 2001 From: Dave Reisner <dreisner@archlinux.org> Date: Thu, 30 Oct 2014 20:12:05 -0400 Subject: [PATCH] shared/install: avoid prematurely rejecting "missing" units
f7101b7368df copied some logic to prevent enabling masked units, but also added a check which causes attempts to enable templated units to fail. Since we know the logic beyond this check will properly handle units which truly do not exist, we can rely on the unit file state comparison to suffice for expressing the intent of f7101b7368df. ref: https://bugs.archlinux.org/task/42616 --- src/shared/install.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git src/shared/install.c src/shared/install.c index 035b44c..cab93e8 100644 --- src/shared/install.c +++ src/shared/install.c @@ -1620,12 +1620,10 @@ int unit_file_enable( STRV_FOREACH(i, files) { UnitFileState state; + /* We only want to know if this unit is masked, so we ignore + * errors from unit_file_get_state, deferring other checks. + * This allows templated units to be enabled on the fly. */ state = unit_file_get_state(scope, root_dir, *i); - if (state < 0) { - log_error("Failed to get unit file state for %s: %s", *i, strerror(-state)); - return state; - } - if (state == UNIT_FILE_MASKED || state == UNIT_FILE_MASKED_RUNTIME) { log_error("Failed to enable unit: Unit %s is masked", *i); return -ENOTSUP; -- 1.7.9.2 ++++++ 0003-systemd-use-pager-for-test-and-help.patch ++++++
From b87c2aa6bf1247c298c9bd9f56b9b56a87836b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 7 Jan 2014 00:00:05 -0500 Subject: [PATCH] systemd: use pager for --test and --help
--- src/core/main.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git src/core/main.c src/core/main.c index f9ee297..ae38b43 100644 --- src/core/main.c +++ src/core/main.c @@ -50,6 +50,7 @@ #include "conf-parser.h" #include "missing.h" #include "label.h" +#include "pager.h" #include "build.h" #include "strv.h" #include "def.h" @@ -94,6 +95,7 @@ static int arg_crash_chvt = -1; static bool arg_confirm_spawn = false; static ShowStatus arg_show_status = _SHOW_STATUS_UNSET; static bool arg_switched_root = false; +static int arg_no_pager = -1; static char ***arg_join_controllers = NULL; static ExecOutput arg_default_std_output = EXEC_OUTPUT_JOURNAL; static ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT; @@ -117,6 +119,14 @@ static bool arg_default_memory_accounting = false; static void nop_handler(int sig) {} +static void pager_open_if_enabled(void) { + + if (arg_no_pager <= 0) + return; + + pager_open(false); +} + noreturn static void crash(int sig) { if (getpid() != 1) @@ -704,6 +714,7 @@ static int parse_argv(int argc, char *argv[]) { ARG_SYSTEM, ARG_USER, ARG_TEST, + ARG_NO_PAGER, ARG_VERSION, ARG_DUMP_CONFIGURATION_ITEMS, ARG_DUMP_CORE, @@ -725,6 +736,7 @@ static int parse_argv(int argc, char *argv[]) { { "system", no_argument, NULL, ARG_SYSTEM }, { "user", no_argument, NULL, ARG_USER }, { "test", no_argument, NULL, ARG_TEST }, + { "no-pager", no_argument, NULL, ARG_NO_PAGER }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, ARG_VERSION }, { "dump-configuration-items", no_argument, NULL, ARG_DUMP_CONFIGURATION_ITEMS }, @@ -832,6 +844,12 @@ static int parse_argv(int argc, char *argv[]) { case ARG_TEST: arg_action = ACTION_TEST; + if (arg_no_pager < 0) + arg_no_pager = true; + break; + + case ARG_NO_PAGER: + arg_no_pager = true; break; case ARG_VERSION: @@ -912,6 +930,8 @@ static int parse_argv(int argc, char *argv[]) { case 'h': arg_action = ACTION_HELP; + if (arg_no_pager < 0) + arg_no_pager = true; break; case 'D': @@ -984,6 +1004,7 @@ static int help(void) { "Starts up and maintains the system or user services.\n\n" " -h --help Show this help\n" " --test Determine startup sequence, dump it and exit\n" + " --no-pager Do not pipe output into a pager\n" " --dump-configuration-items Dump understood unit configuration items\n" " --unit=UNIT Set default unit\n" " --system Run a system instance, even if PID != 1\n" @@ -1452,6 +1473,8 @@ int main(int argc, char *argv[]) { goto finish; } + pager_open_if_enabled(); + if (arg_action == ACTION_HELP) { retval = help(); goto finish; @@ -1798,6 +1821,8 @@ int main(int argc, char *argv[]) { } finish: + pager_close(); + if (m) { manager_free(m); m = NULL; -- 1.7.9.2 ++++++ 0003-time-earlier-exit-from-format_timestamp_relative-on-.patch ++++++ Based on 65de0395ffe1cfb0f9af86504e8588fb31bb0fbc Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 24 Oct 2014 19:08:22 +0200 Subject: [PATCH] time: earlier exit from format_timestamp_relative() on special times --- src/shared/time-util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- src/shared/time-util.c +++ src/shared/time-util.c 2014-10-29 14:07:28.479838096 +0000 @@ -194,11 +194,10 @@ char *format_timestamp_relative(char *bu const char *s; usec_t n, d; - n = now(CLOCK_REALTIME); - if (t <= 0 || (t == (usec_t) -1)) return NULL; + n = now(CLOCK_REALTIME); if (n > t) { d = n - t; s = "ago"; ++++++ 0003-tty-ask-password-agent-return-negative-errno.patch ++++++
From ee0e4cca5ac37a094dfe1074907dae70c7b7701c Mon Sep 17 00:00:00 2001 From: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com> Date: Thu, 3 Apr 2014 21:17:20 +0200 Subject: [PATCH] tty-ask-password-agent: return negative errno
Return negative errno in wall_tty_block(). get_ctty_devnr() already returns a negative errno in case of failure, no need to negate it again. Reported-by: Simon <hwold@odai.homelinux.net> --- .../tty-ask-password-agent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/tty-ask-password-agent/tty-ask-password-agent.c src/tty-ask-password-agent/tty-ask-password-agent.c index 1d067af..3203474 100644 --- src/tty-ask-password-agent/tty-ask-password-agent.c +++ src/tty-ask-password-agent/tty-ask-password-agent.c @@ -432,7 +432,7 @@ static int wall_tty_block(void) { r = get_ctty_devnr(0, &devnr); if (r < 0) - return -r; + return r; if (asprintf(&p, "/run/systemd/ask-password-block/%u:%u", major(devnr), minor(devnr)) < 0) return -ENOMEM; -- 1.7.9.2 ++++++ 0003-udev-event-explicitly-don-t-read-from-invalid-fd.patch ++++++
From 3f796750b192e62701e91a95f85389f876d1059b Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Wed, 17 Sep 2014 21:44:56 +0200 Subject: [PATCH] udev: event - explicitly don't read() from invalid fd
This fixes CID #1237641. --- src/udev/udev-event.c | 3 +++ 1 file changed, 3 insertions(+) diff --git src/udev/udev-event.c src/udev/udev-event.c index 6b8b5a8..c8b1420 100644 --- src/udev/udev-event.c +++ src/udev/udev-event.c @@ -494,6 +494,9 @@ static void spawn_read(struct udev_event *event, for (i = 0; i < fdcount; i++) { int *fd = (int *)ev[i].data.ptr; + if (*fd < 0) + continue; + if (ev[i].events & EPOLLIN) { ssize_t count; char buf[4096]; -- 1.7.9.2 ++++++ 0003-units-order-systemd-tmpfiles-clean.service-after-tim.patch ++++++ Based on 497d1986c13032f1ef8f4592bb7ed8d3aa321a47 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 20 Jun 2014 00:15:39 +0200 Subject: [PATCH] units: order systemd-tmpfiles-clean.service after time-sync.target That way, on systems lacking an RTC we don't false start removing aged files too early. --- units/systemd-tmpfiles-clean.service.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- units/systemd-tmpfiles-clean.service.in +++ units/systemd-tmpfiles-clean.service.in 2014-06-24 10:47:57.398235644 +0000 @@ -10,8 +10,9 @@ Description=Cleanup of Temporary Directo Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8) DefaultDependencies=no Wants=local-fs.target -After=systemd-readahead-collect.service systemd-readahead-replay.service local-fs.target -Before=sysinit.target shutdown.target +Conflicts=shutdown.target +After=systemd-readahead-collect.service systemd-readahead-replay.service local-fs.target time-sync.target +Before=shutdown.target ConditionDirectoryNotEmpty=|/usr/lib/tmpfiles.d ConditionDirectoryNotEmpty=|/usr/local/lib/tmpfiles.d ConditionDirectoryNotEmpty=|/etc/tmpfiles.d ++++++ 0003-units-remove-RefuseManualStart-from-units-which-are-.patch ++++++ Based on 0fdeb6e011dfdb17636c81e2d7e0d632186359ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 28 Jun 2014 00:06:30 -0400 Subject: [PATCH] units: remove RefuseManualStart from units which are always around In a normal running system, non-passive targets and units used during early bootup are always started. So refusing "manual start" for them doesn't make any difference, because a "start" command doesn't cause any action. In early boot however, the administrator might want to start on of those targets or services by hand. We shouldn't interfere with that. Note: in case of systemd-tmpfiles-setup.service, really running the unit after system is up would break the system. So e.g. restarting should not be allowed. The unit has "RefuseManualStop=yes", which prevents restart too. --- units/basic.target | 1 - units/sysinit.target | 1 - units/systemd-tmpfiles-setup.service.in | 1 - units/user/basic.target | 1 - 4 files changed, 4 deletions(-) diff --git units/basic.target units/basic.target index d7c68f4..b890d48 100644 --- units/basic.target +++ units/basic.target @@ -11,4 +11,3 @@ Documentation=man:systemd.special(7) Requires=sysinit.target Wants=sockets.target timers.target paths.target slices.target After=sysinit.target sockets.target timers.target paths.target slices.target -RefuseManualStart=yes diff --git units/sysinit.target units/sysinit.target index 8f4fb8f..ec33503 100644 --- units/sysinit.target +++ units/sysinit.target @@ -11,4 +11,3 @@ Documentation=man:systemd.special(7) Conflicts=emergency.service emergency.target Wants=local-fs.target swap.target After=local-fs.target swap.target emergency.service emergency.target -RefuseManualStart=yes --- units/systemd-tmpfiles-setup.service.in +++ units/systemd-tmpfiles-setup.service.in 2014-07-01 12:17:48.154235348 +0000 @@ -18,7 +18,6 @@ ConditionDirectoryNotEmpty=|/lib/tmpfile ConditionDirectoryNotEmpty=|/usr/local/lib/tmpfiles.d ConditionDirectoryNotEmpty=|/etc/tmpfiles.d ConditionDirectoryNotEmpty=|/run/tmpfiles.d -RefuseManualStart=yes RefuseManualStop=yes [Service] diff --git units/user/basic.target units/user/basic.target index b74d13c..afc6e93 100644 --- units/user/basic.target +++ units/user/basic.target @@ -10,4 +10,3 @@ Description=Basic System Documentation=man:systemd.special(7) Wants=sockets.target timers.target paths.target After=sockets.target timers.target paths.target -RefuseManualStart=yes -- 1.7.9.2 ++++++ 0003-units-use-KillMode-mixed-for-systemd-nspawn-.service.patch ++++++
From d8e40d62ab871a87fde421c4b246bb45bc3cbe2d Mon Sep 17 00:00:00 2001 From: Jonathan Liu <net147@gmail.com> Date: Thu, 29 May 2014 01:17:25 +1000 Subject: [PATCH] units: use KillMode=mixed for systemd-nspawn@.service
This causes the container to shut down cleanly when the service is stopped. --- units/systemd-nspawn@.service.in | 1 + 1 file changed, 1 insertion(+) diff --git units/systemd-nspawn@.service.in units/systemd-nspawn@.service.in index ff36e90..e373628 100644 --- units/systemd-nspawn@.service.in +++ units/systemd-nspawn@.service.in @@ -11,6 +11,7 @@ Documentation=man:systemd-nspawn(1) [Service] ExecStart=@bindir@/systemd-nspawn --quiet --keep-unit --boot --link-journal=guest --directory=/var/lib/container/%i +KillMode=mixed Type=notify [Install] -- 1.7.9.2 ++++++ 0003-utf8-when-looking-at-the-next-unichar-honour-the-siz.patch ++++++ Based on 144b3d9e093dd9310cd9590bec039dc43a7e2ad6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 7 Nov 2014 16:34:00 +0100 Subject: [PATCH] utf8: when looking at the next unichar, honour the size parameter, in utf8_is_printable_newline() --- src/shared/utf8.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- src/shared/utf8.c +++ src/shared/utf8.c 2014-11-10 14:20:28.094539264 +0000 @@ -143,9 +143,14 @@ bool utf8_is_printable_newline(const cha for (p = (const uint8_t*) str; length;) { int encoded_len = utf8_encoded_valid_unichar((const char *)p); - int val = utf8_encoded_to_unichar((const char*)p); + int val; - if (encoded_len < 0 || val < 0 || is_unicode_control(val) || + if (encoded_len < 0 || + (size_t) encoded_len > length) + return false; + + val = utf8_encoded_to_unichar((const char*)p); + if (val < 0 || is_unicode_control(val) || (!newline && val == '\n')) return false; ++++++ 0004-Raise-level-of-Found-dependency.-lines.patch ++++++
From 14fe721b5f6d8457cc8737fa75f2ed79e7fa534b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sun, 2 Nov 2014 12:10:42 -0500 Subject: [PATCH] Raise level of 'Found dependency...' lines
This way they always show up together with 'Found ordering cycle...'. Ordering cycles are a serious error and a major pain to debug. If quiet is enabled, only the first and the last line of output are shown: systemd[1]: Found ordering cycle on basic.target/start systemd[1]: Breaking ordering cycle by deleting job timers.target/start systemd[1]: Job timers.target/start deleted to break ordering cycle starting with basic.target/start which isn't particularly enlightening. So just show the whole message at the same level. https://bugzilla.redhat.com/show_bug.cgi?id=1158206 --- src/core/transaction.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git src/core/transaction.c src/core/transaction.c index 488cb86..bbaa6da 100644 --- src/core/transaction.c +++ src/core/transaction.c @@ -376,9 +376,9 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi for (k = from; k; k = ((k->generation == generation && k->marker != k) ? k->marker : NULL)) { /* logging for j not k here here to provide consistent narrative */ - log_info_unit(j->unit->id, - "Found dependency on %s/%s", - k->unit->id, job_type_to_string(k->type)); + log_warning_unit(j->unit->id, + "Found dependency on %s/%s", + k->unit->id, job_type_to_string(k->type)); if (!delete && hashmap_get(tr->jobs, k->unit) && !unit_matters_to_anchor(k->unit, k)) { -- 1.7.9.2 ++++++ 0004-architecture-remove-cris-from-uname-list.patch ++++++
From bc4bc52bc3de56405045b0437e145a7067fb085d Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 3 Jul 2014 22:52:44 +0200 Subject: [PATCH] architecture: remove "cris" from uname list
the only correct name appears to be "crisv32"... http://lists.freedesktop.org/archives/systemd-devel/2014-July/020899.html --- src/shared/architecture.c | 1 - 1 file changed, 1 deletion(-) diff --git src/shared/architecture.c src/shared/architecture.c index 7dd049a..6cdca4e 100644 --- src/shared/architecture.c +++ src/shared/architecture.c @@ -115,7 +115,6 @@ Architecture uname_architecture(void) { #elif defined(__tilegx__) { "tilegx", ARCHITECTURE_TILEGX }, #elif defined(__cris__) - { "cris", ARCHITECTURE_CRIS }, { "crisv32", ARCHITECTURE_CRIS }, #else #error "Please register your architecture here!" -- 1.7.9.2 ++++++ 0004-backlight-Avoid-error-when-state-restore-is-disabled.patch ++++++
From b76388e123e8d73ded1fd53937d816b314948517 Mon Sep 17 00:00:00 2001 From: Michael Biebl <biebl@debian.org> Date: Thu, 11 Sep 2014 00:49:36 +0200 Subject: [PATCH] backlight: Avoid error when state restore is disabled
When the state restore is disabled, we would print: "Unknown verb: load" instead of simply skipping loading the state. --- src/backlight/backlight.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git src/backlight/backlight.c src/backlight/backlight.c index 4d94ebf..0a2bac6 100644 --- src/backlight/backlight.c +++ src/backlight/backlight.c @@ -372,9 +372,12 @@ int main(int argc, char *argv[]) { * device probing should be complete), so that the validity * check at boot time doesn't have to be reliable. */ - if (streq(argv[1], "load") && shall_restore_state()) { + if (streq(argv[1], "load")) { _cleanup_free_ char *value = NULL; + if (!shall_restore_state()) + return EXIT_SUCCESS; + if (!validate_device(udev, device)) return EXIT_SUCCESS; -- 1.7.9.2 ++++++ 0004-backlight-warn-if-kernel-exposes-backlight-device-wi.patch ++++++
From c7fdf44d08e1217d40dc092fb90a65978a0f541f Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 23 Apr 2014 06:55:54 +0200 Subject: [PATCH] backlight: warn if kernel exposes backlight device with bogus max_brightness
We shouldn't silently tape over broken kernel drivers. --- src/backlight/backlight.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git src/backlight/backlight.c src/backlight/backlight.c index 754a646..c708391 100644 --- src/backlight/backlight.c +++ src/backlight/backlight.c @@ -205,14 +205,18 @@ static unsigned get_max_brightness(struct udev_device *device) { max_brightness_str = udev_device_get_sysattr_value(device, "max_brightness"); if (!max_brightness_str) { - log_warning("Failed to read 'max_brightness' attribute"); + log_warning("Failed to read 'max_brightness' attribute."); return 0; } r = safe_atou(max_brightness_str, &max_brightness); if (r < 0) { - log_warning("Failed to parse 'max_brightness' \"%s\": %s", - max_brightness_str, strerror(-r)); + log_warning("Failed to parse 'max_brightness' \"%s\": %s", max_brightness_str, strerror(-r)); + return 0; + } + + if (max_brightness <= 0) { + log_warning("Maximum brightness is 0, ignoring device."); return 0; } -- 1.7.9.2 ++++++ 0004-bash-completion-use-list-unit-files-to-get-all-units.patch ++++++ Based on c6a373a26348544d944b08bf0c5dea4f72f6980b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 26 Jul 2014 20:11:58 -0400 Subject: [PATCH] bash-completion: use list-unit-files to get "all" units I think that it is better to return good results slightly more slowly, than partial quickly. Also reading from disk seems fast enough. Even the delay on first try with completely cold cache is acceptable. This is just for bash, 'cause zsh was already doing this. https://bugzilla.redhat.com/show_bug.cgi?id=790768 --- shell-completion/bash/systemctl.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git shell-completion/bash/systemctl.in shell-completion/bash/systemctl.in index c5950cc..69ef04b 100644 --- shell-completion/bash/systemctl +++ shell-completion/bash/systemctl @@ -51,11 +51,13 @@ __filter_units_by_property () { done } -__get_all_units () { __systemctl $1 list-units --all \ +__get_all_units () { { __systemctl $1 list-unit-files; __systemctl $1 list-units --all; } \ | { while read -r a b; do echo " $a"; done; }; } __get_active_units () { __systemctl $1 list-units \ | { while read -r a b; do echo " $a"; done; }; } -__get_startable_units () { __systemctl $1 list-units --all -t service,timer,socket,mount,automount,path,snapshot,swap \ +__get_startable_units () { { + __systemctl $1 list-units --all -t service,timer,socket,mount,automount,path,snapshot,swap + __systemctl $1 list-unit-files -t service,timer,socket,mount,automount,path,snapshot,swap; } \ | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }; } __get_failed_units () { __systemctl $1 list-units \ | { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; } -- 1.7.9.2 ++++++ 0004-bootchart-check-return-of-strftime.patch ++++++
From e931d3f4241231e4102eda06adaf7cbfd68c6a5d Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Sat, 27 Sep 2014 22:25:07 +0200 Subject: [PATCH] bootchart: check return of strftime
Found by coverity. Fixes: CID#996314 and #996312 --- src/bootchart/bootchart.c | 8 ++++++-- src/bootchart/svg.c | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git src/bootchart/bootchart.c src/bootchart/bootchart.c index 8ef5ad1..366a5ab 100644 --- src/bootchart/bootchart.c +++ src/bootchart/bootchart.c @@ -389,7 +389,9 @@ int main(int argc, char *argv[]) { if (!of && (access(arg_output_path, R_OK|W_OK|X_OK) == 0)) { t = time(NULL); - strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t)); + r = strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t)); + assert_se(r > 0); + snprintf(output_file, PATH_MAX, "%s/bootchart-%s.svg", arg_output_path, datestr); of = fopen(output_file, "we"); } @@ -457,7 +459,9 @@ int main(int argc, char *argv[]) { if (!of) { t = time(NULL); - strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t)); + r = strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t)); + assert_se(r > 0); + snprintf(output_file, PATH_MAX, "%s/bootchart-%s.svg", arg_output_path, datestr); of = fopen(output_file, "we"); } diff --git src/bootchart/svg.c src/bootchart/svg.c index 135883f..faf377e 100644 --- src/bootchart/svg.c +++ src/bootchart/svg.c @@ -162,7 +162,7 @@ static void svg_title(const char *build) { char *c; FILE *f; time_t t; - int fd; + int fd, r; struct utsname uts; /* grab /proc/cmdline */ @@ -196,7 +196,8 @@ static void svg_title(const char *build) { /* date */ t = time(NULL); - strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", localtime(&t)); + r = strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", localtime(&t)); + assert_se(r > 0); /* CPU type */ fd = openat(procfd, "cpuinfo", O_RDONLY); -- 1.7.9.2 ++++++ 0004-config-parser-fix-mem-leak.patch ++++++
From 9e60277835e61597011358afcdbfb3dd712ce128 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Sun, 31 Aug 2014 23:13:12 +0200 Subject: [PATCH] config-parser: fix mem leak
From c4bfd1691f4d3e26d6d7f34dbca941e119956e8a Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 24 Mar 2014 21:04:02 +0100 Subject: [PATCH] core: don't try to relabel mounts before we loaded the
--- src/shared/conf-parser.c | 1 + 1 file changed, 1 insertion(+) diff --git src/shared/conf-parser.c src/shared/conf-parser.c index 439cfc5..ee6de65 100644 --- src/shared/conf-parser.c +++ src/shared/conf-parser.c @@ -710,6 +710,7 @@ int config_parse_strv(const char *unit, if (!utf8_is_valid(n)) { log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue); + free(n); continue; } -- 1.7.9.2 ++++++ 0004-core-Added-support-for-ERRNO-NOTIFY_SOCKET-message-p.patch ++++++ Based on 4774e357268e4a1e9fa82adb0563a538932a4c8e Mon Sep 17 00:00:00 2001 From: Miguel Angel Ajo <mangelajo@redhat.com> Date: Mon, 7 Jul 2014 14:20:36 +0200 Subject: [PATCH] core: Added support for ERRNO NOTIFY_SOCKET message parsing, and added StatusErrno dbus property along StatusText to allow notification of numeric status condition while degraded service operation or any other special situation. --- src/core/dbus-service.c | 1 + src/core/service.c | 17 +++++++++++++++++ src/core/service.h | 1 + 3 files changed, 19 insertions(+) diff --git src/core/dbus-service.c src/core/dbus-service.c index 093289f..5a881e8 100644 --- src/core/dbus-service.c +++ src/core/dbus-service.c @@ -60,6 +60,7 @@ const sd_bus_vtable bus_service_vtable[] = { SD_BUS_PROPERTY("ControlPID", "u", bus_property_get_pid, offsetof(Service, control_pid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("BusName", "s", NULL, offsetof(Service, bus_name), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("StatusText", "s", NULL, offsetof(Service, status_text), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), + SD_BUS_PROPERTY("StatusErrno", "i", NULL, offsetof(Service, status_errno), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Service, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), BUS_EXEC_STATUS_VTABLE("ExecMain", offsetof(Service, main_exec_status), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), BUS_EXEC_COMMAND_LIST_VTABLE("ExecStartPre", offsetof(Service, exec_command[SERVICE_EXEC_START_PRE]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), diff --git src/core/service.c src/core/service.c index 0b19767..ace45e2 100644 --- src/core/service.c +++ src/core/service.c @@ -2637,6 +2637,23 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) { free(t); } + /* Interpret ERRNO= */ + e = strv_find_prefix(tags, "ERRNO="); + if (e) { + int status_errno; + + if (safe_atoi(e + 6, &status_errno) < 0) + log_warning_unit(u->id, "Failed to parse ERRNO= field in notification message: %s", e); + else { + log_debug_unit(u->id, "%s: got %s", u->id, e); + + if (s->status_errno != status_errno) { + s->status_errno = status_errno; + notify_dbus = true; + } + } + } + /* Interpret WATCHDOG= */ if (strv_find(tags, "WATCHDOG=1")) { log_debug_unit(u->id, "%s: got WATCHDOG=1", u->id); --- src/core/service.h +++ src/core/service.h 2014-07-08 12:54:39.238736046 +0200 @@ -187,6 +187,7 @@ struct Service { char *bus_name; char *status_text; + int status_errno; RateLimit start_limit; StartLimitAction start_limit_action; -- 1.7.9.2 ++++++ 0004-core-don-t-try-to-relabel-mounts-before-we-loaded-th.patch ++++++ policy --- src/core/mount-setup.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git src/core/mount-setup.c src/core/mount-setup.c index 147333a..0a45b24 100644 --- src/core/mount-setup.c +++ src/core/mount-setup.c @@ -172,7 +172,10 @@ static int mount_one(const MountPoint *p, bool relabel) { /* The access mode here doesn't really matter too much, since * the mounted file system will take precedence anyway. */ - mkdir_p_label(p->where, 0755); + if (relabel) + mkdir_p_label(p->where, 0755); + else + mkdir_p(p->where, 0755); log_debug("Mounting %s to %s of type %s with options %s.", p->what, -- 1.7.9.2 ++++++ 0004-core-fix-transaction-destructiveness-check-once-more.patch ++++++ Based on e0312f4db08c7100bd00299614e87bedc759b366 Mon Sep 17 00:00:00 2001 Based on c21b92ffe7ef939dd32502ac912cf8ad1c5638fd Mon Sep 17 00:00:00 2001 From: Michal Schmidt <mschmidt@redhat.com> Date: Thu, 27 Nov 2014 15:23:58 +0100 Subject: [PATCH] core: fix transaction destructiveness check once more The previous fix e0312f4db "core: fix check for transaction destructiveness" broke test-engine (noticed by Zbyszek). Apparently I had a wrong idea of the intended semantics of --fail. The manpage says the operation should fail if it "conflicts with a pending job (more specifically: causes an already pending start job to be reversed into a stop job or vice versa)". So let's check job_type_is_conflicting, instead of !is_superset. This makes both test-engine and TEST-03-JOBS pass again. --- src/core/transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- src/core/transaction.c +++ src/core/transaction.c 2014-12-15 12:06:11.721518136 +0000 @@ -510,7 +510,7 @@ static int transaction_is_destructive(Tr assert(!j->transaction_next); if (j->unit->job && (mode == JOB_FAIL || j->unit->job->irreversible) && - !job_type_is_superset(j->type, j->unit->job->type)) { + job_type_is_conflicting(j->unit->job->type, j->type)) { sd_bus_error_setf(e, BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE, "Transaction is destructive."); return -EEXIST; ++++++ 0004-core-map-the-rescue-argument-to-rescue.target.patch ++++++
From 5329ab10ffaf5b4a3fd6ebd9380b1ec09d05cfc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com> Date: Tue, 7 Oct 2014 14:55:21 +0300 Subject: [PATCH] core: map the 'rescue' argument to rescue.target
Even though the 'emergency' and 'single' aliases come from sysvinit, the lack of 'rescue' is still quite confusing (caught me by surprise for the 9th time yet) and inconsistent with `systemctl rescue` as well. --- src/core/main.c | 1 + 1 file changed, 1 insertion(+) diff --git src/core/main.c src/core/main.c index 1a62e04..44373cc 100644 --- src/core/main.c +++ src/core/main.c @@ -272,6 +272,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value) { static const char * const rlmap[] = { "emergency", SPECIAL_EMERGENCY_TARGET, "-b", SPECIAL_EMERGENCY_TARGET, + "rescue", SPECIAL_RESCUE_TARGET, "single", SPECIAL_RESCUE_TARGET, "-s", SPECIAL_RESCUE_TARGET, "s", SPECIAL_RESCUE_TARGET, -- 1.7.9.2 ++++++ 0004-cryptsetup-don-t-add-unit-dependency-on-dev-null-dev.patch ++++++ Based on bde29068aa3815c88190a91e9867605a0aeaf9c4 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 23 Jun 2014 19:18:44 +0200 Subject: [PATCH] cryptsetup: don't add unit dependency on /dev/null devices when it is listed as password file As special magic, don't create device dependencies for /dev/null. Of course, there might be similar devices we might want to include, but given that none of them really make sense to specify as password source there's really no point in checking for anything else here. https://bugs.freedesktop.org/show_bug.cgi?id=75816 --- src/cryptsetup/cryptsetup-generator.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) --- src/cryptsetup/cryptsetup-generator.c +++ src/cryptsetup/cryptsetup-generator.c 2014-06-25 17:24:14.338237375 +0000 @@ -29,6 +29,7 @@ #include "mkdir.h" #include "strv.h" #include "fileio.h" +#include "path-util.h" static const char *arg_dest = "/tmp"; static bool arg_enabled = true; @@ -141,14 +142,18 @@ static int create_disk( if (uu == NULL) return log_oom(); - if (is_device_path(uu)) { - _cleanup_free_ char *dd = unit_name_from_path(uu, ".device"); - if (dd == NULL) - return log_oom(); - - fprintf(f, "After=%1$s\nRequires=%1$s\n", dd); - } else - fprintf(f, "RequiresMountsFor=%s\n", password); + if (!path_equal(uu, "/dev/null")) { + if (is_device_path(uu)) { + _cleanup_free_ char *dd; + + dd = unit_name_from_path(uu, ".device"); + if (!dd) + return log_oom(); + + fprintf(f, "After=%1$s\nRequires=%1$s\n", dd); + } else + fprintf(f, "RequiresMountsFor=%s\n", password); + } } } ++++++ 0004-fileio-quote-more-shell-characters-in-envfiles.patch ++++++
From 0ce5a80601597fe4d1a715a8f70ce8d5ccaa2d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com> Date: Sun, 13 Jul 2014 18:49:00 +0300 Subject: [PATCH] fileio: quote more shell characters in envfiles
Turns out, making strings shell-proof is harder than expected: # machinectl set-hostname "foo|poweroff" && . /etc/machine-info (This could be simplified by quoting *and* escaping all characters, which is harmless in shell but unnecessary.) --- src/shared/fileio.c | 4 ++-- src/shared/util.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git src/shared/fileio.c src/shared/fileio.c index b0ab780..cbb40c2 100644 --- src/shared/fileio.c +++ src/shared/fileio.c @@ -738,11 +738,11 @@ static void write_env_var(FILE *f, const char *v) { p++; fwrite(v, 1, p-v, f); - if (string_has_cc(p, NULL) || chars_intersect(p, WHITESPACE "\'\"\\`$")) { + if (string_has_cc(p, NULL) || chars_intersect(p, WHITESPACE SHELL_NEED_QUOTES)) { fputc('\"', f); for (; *p; p++) { - if (strchr("\'\"\\`$", *p)) + if (strchr(SHELL_NEED_ESCAPE, *p)) fputc('\\', f); fputc(*p, f); diff --git src/shared/util.h src/shared/util.h index c5eadc9..b3187a9 100644 --- src/shared/util.h +++ src/shared/util.h @@ -93,6 +93,12 @@ #define COMMENTS "#;" #define GLOB_CHARS "*?[" +/* What characters are special in the shell? */ +/* must be escaped outside and inside double-quotes */ +#define SHELL_NEED_ESCAPE "\"\\`$" +/* can be escaped or double-quoted */ +#define SHELL_NEED_QUOTES SHELL_NEED_ESCAPE GLOB_CHARS "'()<>|&;" + #define FORMAT_BYTES_MAX 8 #define ANSI_HIGHLIGHT_ON "\x1B[1;39m" -- 1.7.9.2 ++++++ 0004-fix-off-by-one-error-in-array-index-assertion.patch ++++++
From 26abdc73a212b90f7c4b71808a1028d2e87ab09f Mon Sep 17 00:00:00 2001 From: Dave Reisner <dreisner@archlinux.org> Date: Sat, 8 Mar 2014 17:32:53 -0500 Subject: [PATCH] fix off by one error in array index assertion
Since the index is already post-incremented when the array is appended to, this assertion can be wrongly reached when the array is at capacity (with the NULL terminator). The bug is reproducible on shutdown with the following settings in /etc/systemd/system.conf: LogTarget=journal-or-kmsg LogColor=yes LogLocation=yes Reported by Thermi on IRC. --- src/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/core/main.c src/core/main.c index 6ebfe64..f1b06d8 100644 --- src/core/main.c +++ src/core/main.c @@ -1994,7 +1994,7 @@ finish: if (log_get_show_location()) command_line[pos++] = "--log-location"; - assert(pos + 1 < ELEMENTSOF(command_line)); + assert(pos < ELEMENTSOF(command_line)); if (arm_reboot_watchdog && arg_shutdown_watchdog > 0) { char *e; -- 1.7.9.2 ++++++ 0004-fix-typo-in-iDRAC-network-interface-name-irdac-idrac.patch ++++++
From b3e4387351c835766f96796a20d94971afea7d3b Mon Sep 17 00:00:00 2001 From: Tomasz Torcz <tomek@pipebreaker.pl> Date: Tue, 25 Feb 2014 12:43:55 +0100 Subject: [PATCH] fix typo in iDRAC network interface name: irdac->idrac
--- hwdb/20-net-ifname.hwdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git hwdb/20-net-ifname.hwdb hwdb/20-net-ifname.hwdb index 29d2633..2408dc1 100644 --- hwdb/20-net-ifname.hwdb +++ hwdb/20-net-ifname.hwdb @@ -2,4 +2,4 @@ # Dell iDRAC Virtual USB NIC usb:v413CpA102* - ID_NET_NAME_FROM_DATABASE=irdac + ID_NET_NAME_FROM_DATABASE=idrac -- 1.7.9.2 ++++++ 0004-getty-generator-properly-escape-instance-names.patch ++++++
From a2ae516a25dafe41e0cd296ab7b5d022fa62b95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Thu, 19 Jun 2014 22:02:55 -0400 Subject: [PATCH] getty-generator: properly escape instance names
Otherwise the add_symlink() function tries to make directories for each slash even for the slash after the @ symbol in the final link name, failing for /dev/3270/tty1. Based on a patch by Werner Fink <werner@suse.de>. --- src/getty-generator/getty-generator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git src/getty-generator/getty-generator.c src/getty-generator/getty-generator.c index 35cd858..7d4b546 100644 --- src/getty-generator/getty-generator.c +++ src/getty-generator/getty-generator.c @@ -67,7 +67,7 @@ static int add_serial_getty(const char *tty) { log_debug("Automatically adding serial getty for /dev/%s.", tty); - n = unit_name_replace_instance("serial-getty@.service", tty); + n = unit_name_from_path_instance("serial-getty", tty, ".service"); if (!n) return log_oom(); @@ -81,7 +81,7 @@ static int add_container_getty(const char *tty) { log_debug("Automatically adding container getty for /dev/pts/%s.", tty); - n = unit_name_replace_instance("container-getty@.service", tty); + n = unit_name_from_path_instance("container-getty", tty, ".service"); if (!n) return log_oom(); -- 1.7.9.2 ++++++ 0004-hwdb-Update-database-of-Bluetooth-company-identifier.patch ++++++
From b189101727e80a09864c5e5880663ef565467f19 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann <marcel@holtmann.org> Date: Sat, 12 Apr 2014 10:38:16 -0700 Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
--- hwdb/20-bluetooth-vendor-product.hwdb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git hwdb/20-bluetooth-vendor-product.hwdb hwdb/20-bluetooth-vendor-product.hwdb index b928f5a..28aa2a7 100644 --- hwdb/20-bluetooth-vendor-product.hwdb +++ hwdb/20-bluetooth-vendor-product.hwdb @@ -733,7 +733,7 @@ bluetooth:v00F1* ID_VENDOR_FROM_DATABASE=Witron Technology Limited bluetooth:v00F2* - ID_VENDOR_FROM_DATABASE=Morse Project Inc. + ID_VENDOR_FROM_DATABASE=Aether Things Inc. (formerly Morse Project Inc.) bluetooth:v00F3* ID_VENDOR_FROM_DATABASE=Kent Displays Inc. @@ -941,3 +941,24 @@ bluetooth:v0136* bluetooth:v0137* ID_VENDOR_FROM_DATABASE=Prestigio Plaza Ltd. + +bluetooth:v0138* + ID_VENDOR_FROM_DATABASE=NTEO Inc. + +bluetooth:v0139* + ID_VENDOR_FROM_DATABASE=Focus Systems Corporation + +bluetooth:v013A* + ID_VENDOR_FROM_DATABASE=Tencent Holdings Limited + +bluetooth:v013B* + ID_VENDOR_FROM_DATABASE=Allegion + +bluetooth:v013C* + ID_VENDOR_FROM_DATABASE=Murata Manufacuring Co., Ltd. + +bluetooth:v013D* + ID_VENDOR_FROM_DATABASE=WirelessWERX + +bluetooth:v013E* + ID_VENDOR_FROM_DATABASE=nimai -- 1.7.9.2 ++++++ 0004-hwdb-update-format-description-and-document-reloadin.patch ++++++
From fa9d4be3f1f4a792b2f3624c2a08fe9cc6ce6e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Thu, 7 Aug 2014 21:48:57 -0400 Subject: [PATCH] hwdb: update format description and document reloading
https://bugs.freedesktop.org/show_bug.cgi?id=82311 --- hwdb/60-keyboard.hwdb | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index 5c3d4ca..ef0ebc5 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -28,19 +28,33 @@ # driver, <vendor> is the firmware-provided string exported # by the kernel DMI modalias. # -# Scan codes are specified as: -# KEYBOARD_KEY_<hex scan code>=<key code identifier> -# The scan code should be expressed in hex lowercase and in -# full bytes, a multiple of 2 digits. The key codes are retrieved -# and normalized from the kernel input API header. +# Scan codes are specified as: +# KEYBOARD_KEY_<hex scan code>=<key code identifier> +# The scan code should be expressed in hex lowercase. The key codes +# are retrieved and normalized from the kernel input API header. # -# A '!' as the first charcter of the key identifier string -# will add the scan code to the AT keyboard's list of scan codes -# where the driver will synthesize a release event and not expect -# it to be generated by the hardware. +# An '!' as the first character of the key identifier string +# will add the scan code to the AT keyboard's list of scan codes +# where the driver will synthesize a release event and not expect +# it to be generated by the hardware. # # To debug key presses and access scan code mapping data of # an input device use the commonly available tool: evtest(1). +# +# To update this file, create a new file +# /etc/udev/hwdb.d/70-keyboad.hwdb +# and add your rules there. To load the new rules execute (as root): +# udevadm hwdb --update +# udevadm trigger /dev/input/eventXX +# where /dev/input/eventXX is the keyboard in question. If in +# doubt, simply use /dev/input/event* to reload all input rules. +# +# If your changes are generally applicable, open a bug report on +# http://bugs.freedesktop.org/enter_bug.cgi?product=systemd +# and include your new rules, a description of the device, and the +# output of +# udevadm info /dev/input/eventXX +# (or /dev/input/event*). ########################################## # Acer -- 1.7.9.2 ++++++ 0004-hwdb-update.patch ++++++ ++++ 3964 lines (skipped) ++++++ 0004-implement-a-union-to-pad-out-file_handle.patch ++++++
From 370c860f748d149097710dc7952a64f627db9de7 Mon Sep 17 00:00:00 2001 From: Dave Reisner <dreisner@archlinux.org> Date: Sat, 19 Apr 2014 13:22:35 -0400 Subject: [PATCH] implement a union to pad out file_handle
Cases where name_to_handle_at is used allocated the full struct to be MAX_HANDLE_SZ, and assigned this size to handle_bytes. This is wrong since handle_bytes should describe the length of the flexible array member and not the whole struct. Define a union type which includes sufficient padding to allow assignment of MAX_HANDLE_SZ to be correct. --- src/libudev/libudev-monitor.c | 6 ++---- src/readahead/readahead-common.c | 6 ++---- src/shared/util.h | 6 ++++++ src/tmpfiles/tmpfiles.c | 11 ++++------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git src/libudev/libudev-monitor.c src/libudev/libudev-monitor.c index 3f7436b..0a2ab82 100644 --- src/libudev/libudev-monitor.c +++ src/libudev/libudev-monitor.c @@ -108,15 +108,13 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) /* we consider udev running when /dev is on devtmpfs */ static bool udev_has_devtmpfs(struct udev *udev) { - struct file_handle *h; + union file_handle_union h = { .handle.handle_bytes = MAX_HANDLE_SZ, }; int mount_id; _cleanup_fclose_ FILE *f = NULL; char line[LINE_MAX], *e; int r; - h = alloca(MAX_HANDLE_SZ); - h->handle_bytes = MAX_HANDLE_SZ; - r = name_to_handle_at(AT_FDCWD, "/dev", h, &mount_id, 0); + r = name_to_handle_at(AT_FDCWD, "/dev", &h.handle, &mount_id, 0); if (r < 0) return false; diff --git src/readahead/readahead-common.c src/readahead/readahead-common.c index 5ffa88b..49679fc 100644 --- src/readahead/readahead-common.c +++ src/readahead/readahead-common.c @@ -75,7 +75,7 @@ int fs_on_ssd(const char *p) { if (major(st.st_dev) == 0) { _cleanup_fclose_ FILE *f = NULL; int mount_id; - struct file_handle *h; + union file_handle_union h = { .handle.handle_bytes = MAX_HANDLE_SZ, }; /* Might be btrfs, which exposes "ssd" as mount flag if it is on ssd. * @@ -83,9 +83,7 @@ int fs_on_ssd(const char *p) { * and then lookup the mount ID in mountinfo to find * the mount options. */ - h = alloca(MAX_HANDLE_SZ); - h->handle_bytes = MAX_HANDLE_SZ; - r = name_to_handle_at(AT_FDCWD, p, h, &mount_id, AT_SYMLINK_FOLLOW); + r = name_to_handle_at(AT_FDCWD, p, &h.handle, &mount_id, AT_SYMLINK_FOLLOW); if (r < 0) return false; diff --git src/shared/util.h src/shared/util.h index 900f1cf..891848a 100644 --- src/shared/util.h +++ src/shared/util.h @@ -22,6 +22,7 @@ ***/ #include <alloca.h> +#include <fcntl.h> #include <inttypes.h> #include <time.h> #include <sys/time.h> @@ -883,3 +884,8 @@ int fd_warn_permissions(const char *path unsigned long personality_from_string(const char *p); const char *personality_to_string(unsigned long); + +union file_handle_union { + struct file_handle handle; + char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ]; +}; diff --git src/tmpfiles/tmpfiles.c src/tmpfiles/tmpfiles.c index 33e7cbc..04b472d 100644 --- src/tmpfiles/tmpfiles.c +++ src/tmpfiles/tmpfiles.c @@ -217,19 +217,16 @@ static bool unix_socket_alive(const char *fn) { } static int dir_is_mount_point(DIR *d, const char *subdir) { - struct file_handle *h; + union file_handle_union h = { .handle.handle_bytes = MAX_HANDLE_SZ }; int mount_id_parent, mount_id; int r_p, r; - h = alloca(MAX_HANDLE_SZ); - - h->handle_bytes = MAX_HANDLE_SZ; - r_p = name_to_handle_at(dirfd(d), ".", h, &mount_id_parent, 0); + r_p = name_to_handle_at(dirfd(d), ".", &h.handle, &mount_id_parent, 0); if (r_p < 0) r_p = -errno; - h->handle_bytes = MAX_HANDLE_SZ; - r = name_to_handle_at(dirfd(d), subdir, h, &mount_id, 0); + h.handle.handle_bytes = MAX_HANDLE_SZ; + r = name_to_handle_at(dirfd(d), subdir, &h.handle, &mount_id, 0); if (r < 0) r = -errno; -- 1.7.9.2 ++++++ 0004-job-add-waiting-jobs-to-run-queue-in-unit_coldplug.patch ++++++ Based on 20a83d7bf4542875f8033b68682a4da4993010e8 Mon Sep 17 00:00:00 2001 From: Brandon Philips <brandon@ifup.co> Date: Fri, 25 Apr 2014 09:31:59 -0600 Subject: [PATCH] job: add waiting jobs to run queue in unit_coldplug When we have job installed and added to run queue for service which is still in dead state and systemd initiates reload then after reload we never add deserialized job to the run queue again. This is caused by check in service_coldplug() where we check if deserialized state is something else than dead state, which is not the case thus we never call service_set_state() and finally unit_notify() where we would have added job to the run queue. Thanks to Michal Sekletar <msekleta@redhat.com> for the original patch. --- src/core/job.c | 3 +++ 1 file changed, 3 insertions(+) --- src/core/job.c +++ src/core/job.c 2014-05-12 12:58:30.354235531 +0000 @@ -1057,6 +1057,9 @@ int job_coldplug(Job *j) { if (j->timer_event_source) j->timer_event_source = sd_event_source_unref(j->timer_event_source); + if (j->state == JOB_WAITING) + job_add_to_run_queue(j); + r = sd_event_add_monotonic(j->manager->event, &j->timer_event_source, j->begin_usec + j->unit->job_timeout, 0, job_dispatch_timer, j); if (r < 0) log_debug("Failed to restart timeout for job: %s", strerror(-r)); ++++++ 0004-journal-do-server_vacuum-for-sigusr1.patch ++++++
From 3bfd4e0c6341b0ef946d2198f089743fa99e0a97 Mon Sep 17 00:00:00 2001 From: WaLyong Cho <walyong.cho@samsung.com> Date: Thu, 28 Aug 2014 21:33:03 +0900 Subject: [PATCH] journal: do server_vacuum for sigusr1
runtime journal is migrated to system journal when only "/run/systemd/journal/flushed" exist. It's ok but according to this the system journal directory size(max use) can be over the config. If journal is not rotated during some time the journal directory can be remained as over the config(or default) size. To avoid, do server_vacuum just after the system journal migration from runtime. --- src/journal/journald-server.c | 1 + 1 file changed, 1 insertion(+) diff --git src/journal/journald-server.c src/journal/journald-server.c index 52111f7..bf9cfcc 100644 --- src/journal/journald-server.c +++ src/journal/journald-server.c @@ -1224,6 +1224,7 @@ static int dispatch_sigusr1(sd_event_source *es, const struct signalfd_siginfo * touch("/run/systemd/journal/flushed"); server_flush_to_var(s); server_sync(s); + server_vacuum(s); return 0; } -- 1.7.9.2 ++++++ 0004-login-set_controller-should-fail-if-prepare_vt-fails.patch ++++++ Based on baccf3e40bab6c0b69992ae29c396930de4660c9 Mon Sep 17 00:00:00 2001 From: Olivier Brunel <jjk@jjacky.com> Date: Fri, 8 Aug 2014 20:45:43 +0200 Subject: [PATCH] login: set_controller should fail if prepare_vt fails If controllers can expect logind to have "prepared" the VT (e.g. set it to graphics mode, etc) then TakeControl() should fail if said preparation failed (and session_restore_vt() was called). (David: fixed up !CONFIG_VT case and errno-numbers) --- src/login/logind-session.c | 47 +++++++++++++++++++++++++++++++++------------ src/login/logind-session.h | 2 - 2 files changed, 36 insertions(+), 13 deletions(-) --- src/login/logind-session.c +++ src/login/logind-session.c 2014-08-26 10:14:21.014235811 +0000 @@ -950,8 +950,8 @@ int session_kill(Session *s, KillWho who static int session_open_vt(Session *s) { char path[sizeof("/dev/tty") + DECIMAL_STR_MAX(s->vtnr)]; - if (!s->vtnr) - return -1; + if (s->vtnr < 1) + return -ENODEV; if (s->vtfd >= 0) return s->vtfd; @@ -975,22 +975,38 @@ static int session_vt_fn(sd_event_source return 0; } -void session_mute_vt(Session *s) { +int session_mute_vt(Session *s) { int vt, r; struct vt_mode mode = { 0 }; sigset_t mask; + if (s->vtnr < 1) + return 0; + vt = session_open_vt(s); if (vt < 0) - return; + return vt; + + r = fchown(vt, s->user->uid, -1); + if (r < 0) { + r = -errno; + log_error("Cannot change owner of /dev/tty%u: %m", s->vtnr); + goto error; + } r = ioctl(vt, KDSKBMODE, K_OFF); - if (r < 0) + if (r < 0) { + r = -errno; + log_error("Cannot set K_OFF on /dev/tty%u: %m", s->vtnr); goto error; + } r = ioctl(vt, KDSETMODE, KD_GRAPHICS); - if (r < 0) + if (r < 0) { + r = -errno; + log_error("Cannot set KD_GRAPHICS on /dev/tty%u: %m", s->vtnr); goto error; + } sigemptyset(&mask); sigaddset(&mask, SIGUSR1); @@ -1007,14 +1023,17 @@ void session_mute_vt(Session *s) { mode.relsig = SIGUSR1; mode.acqsig = SIGUSR1; r = ioctl(vt, VT_SETMODE, &mode); - if (r < 0) + if (r < 0) { + r = -errno; + log_error("Cannot set VT_PROCESS on /dev/tty%u: %m", s->vtnr); goto error; + } - return; + return 0; error: - log_error("cannot mute VT %u for session %s (%d/%d)", s->vtnr, s->id, r, errno); session_restore_vt(s); + return r; } void session_restore_vt(Session *s) { @@ -1037,6 +1056,8 @@ void session_restore_vt(Session *s) { mode.mode = VT_AUTO; ioctl(vt, VT_SETMODE, &mode); + fchown(vt, 0, -1); + close_nointr_nofail(vt); s->vtfd = -1; } @@ -1091,8 +1112,6 @@ int session_set_controller(Session *s, c return r; } - session_swap_controller(s, t); - /* When setting a session controller, we forcibly mute the VT and set * it into graphics-mode. Applications can override that by changing * VT state after calling TakeControl(). However, this serves as a good @@ -1101,7 +1120,11 @@ int session_set_controller(Session *s, c * exits. * If logind crashes/restarts, we restore the controller during restart * or reset the VT in case it crashed/exited, too. */ - session_mute_vt(s); + r = session_mute_vt(s); + if (r < 0) + return r; + + session_swap_controller(s, t); return 0; } --- src/login/logind-session.h +++ src/login/logind-session.h 2014-08-25 17:19:29.042236429 +0000 @@ -172,7 +172,7 @@ SessionClass session_class_from_string(c const char *kill_who_to_string(KillWho k) _const_; KillWho kill_who_from_string(const char *s) _pure_; -void session_mute_vt(Session *s); +int session_mute_vt(Session *s); void session_restore_vt(Session *s); bool session_is_controller(Session *s, const char *sender); ++++++ 0004-logind-Do-not-fail-display-count-if-a-device-has-no-.patch ++++++
From 94036de887ad5b0dc805abe38b5c1c58b57d9465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com> Date: Tue, 11 Mar 2014 17:49:00 +0200 Subject: [PATCH] logind: Do not fail display count if a device has no parent
udev_device_get_parent() may return NULL when the device doesn't have a parent, as is the case with (for example) /sys/devices/virtual/drm/ttm. Also, log an actual error message instead of "-12 displays connected". --- src/login/logind-action.c | 4 +++- src/login/logind-core.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git src/login/logind-action.c src/login/logind-action.c index ae7b350..1928f43 100644 --- src/login/logind-action.c +++ src/login/logind-action.c @@ -84,7 +84,9 @@ int manager_handle_action( * treat like this under the assumption that there is * no modern drm driver available. */ n = manager_count_displays(m); - if (n != 1) { + if (n < 0) + log_warning("Display counting failed: %s", strerror(-n)); + else if (n != 1) { log_debug("Ignoring lid switch request, %i displays connected.", n); return 0; } diff --git src/login/logind-core.c src/login/logind-core.c index ca34d37..053d2ed 100644 --- src/login/logind-core.c +++ src/login/logind-core.c @@ -520,7 +520,7 @@ int manager_count_displays(Manager *m) { p = udev_device_get_parent(d); if (!p) - return -ENOMEM; + continue; /* If the parent shares the same subsystem as the * device we are looking at then it is a connector, -- 1.7.9.2 ++++++ 0004-machined-make-sure-GetMachineAddresses-is-available-.patch ++++++
From d3152a09ac5804ec8603daee12f98cf03523cce0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 19 May 2014 00:47:26 +0900 Subject: [PATCH] machined: make sure GetMachineAddresses() is available for unprivileged processes
--- src/machine/org.freedesktop.machine1.conf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git src/machine/org.freedesktop.machine1.conf src/machine/org.freedesktop.machine1.conf index 970ccd8..ab349a5 100644 --- src/machine/org.freedesktop.machine1.conf +++ src/machine/org.freedesktop.machine1.conf @@ -42,12 +42,20 @@ <allow send_destination="org.freedesktop.machine1" send_interface="org.freedesktop.machine1.Manager" + send_member="GetMachineAddresses"/> + + <allow send_destination="org.freedesktop.machine1" + send_interface="org.freedesktop.machine1.Manager" send_member="GetMachine"/> <allow send_destination="org.freedesktop.machine1" send_interface="org.freedesktop.machine1.Manager" send_member="GetMachineByPID"/> + <allow send_destination="org.freedesktop.machine1" + send_interface="org.freedesktop.machine1.Machine" + send_member="GetAddresses"/> + <allow receive_sender="org.freedesktop.machine1"/> </policy> -- 1.7.9.2 ++++++ 0004-man-document-missing-options-of-systemd-run.patch ++++++
From 981ee551945f4e00de52fcbb7780fd7476bcd47e Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 5 Mar 2014 03:37:48 +0100 Subject: [PATCH] man: document missing options of systemd-run
--- man/systemd-run.xml | 71 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 11 deletions(-) diff --git man/systemd-run.xml man/systemd-run.xml index 95c1cb7..81d41dc 100644 --- man/systemd-run.xml +++ man/systemd-run.xml @@ -121,9 +121,9 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. <varlistentry> <term><option>--description=</option></term> - <listitem><para>Provide description for the unit. If not - specified, the command itself will be used as a description. - See <varname>Description=</varname> in + <listitem><para>Provide description for the service or scope + unit. If not specified, the command itself will be used as a + description. See <varname>Description=</varname> in <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. </para></listitem> </varlistentry> @@ -140,10 +140,10 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. <varlistentry> <term><option>--remain-after-exit</option></term> - <listitem><para>After the service's process has terminated, keep - the service around until it is explicitly stopped. This is - useful to collect runtime information about the service after - it finished running. Also see + <listitem><para>After the service or scope process has + terminated, keep the service around until it is explicitly + stopped. This is useful to collect runtime information about + the service after it finished running. Also see <varname>RemainAfterExit=</varname> in <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>. </para> @@ -153,15 +153,64 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. <varlistentry> <term><option>--send-sighup</option></term> - <listitem><para>When terminating the scope unit, send a SIGHUP - immediately after SIGTERM. This is useful to indicate to - shells and shell-like processes that the connection has been - severed. Also see <varname>SendSIGHUP=</varname> in + <listitem><para>When terminating the scope or service unit, + send a SIGHUP immediately after SIGTERM. This is useful to + indicate to shells and shell-like processes that the + connection has been severed. Also see + <varname>SendSIGHUP=</varname> in <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>. </para> </listitem> </varlistentry> + <varlistentry> + <term><option>--service-type=</option></term> + + <listitem><para>Sets the service type. Also see + <varname>Type=</varname> in + <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This + option has no effect in conjunction with + <option>--scope</option>. Defaults to + <constant>simple</constant>.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--uid=</option></term> + <term><option>--gid=</option></term> + + <listitem><para>Runs the service process under the UNIX user + and group. Also see <varname>User=</varname> and + <varname>Group=</varname> in + <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This + option has no effect in conjunction with + <option>--scope</option>.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--nice=</option></term> + + <listitem><para>Runs the service process with the specified + nice level. Also see <varname>Nice=</varname> in + <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This + option has no effect in conjunction with + <option>--scope</option>.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--setenv=</option></term> + + <listitem><para>Runs the service process with the specified + environment variables set. Also see + <varname>Environment=</varname> in + <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This + option has no effect in conjunction with + <option>--scope</option>.</para> + </listitem> + </varlistentry> + <xi:include href="user-system-options.xml" xpointer="user" /> <xi:include href="user-system-options.xml" xpointer="system" /> <xi:include href="user-system-options.xml" xpointer="host" /> -- 1.7.9.2 ++++++ 0004-sd-bus-if-we-don-t-manage-to-properly-allocate-the-e.patch ++++++
From 455cd8b137b8ef45d04889f2d967c562a097f1e6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 24 Oct 2014 19:24:53 +0200 Subject: [PATCH] sd-bus: if we don't manage to properly allocate the error message for an sd_bus_error, just go on
sd_bus_error_setfv() must initialize the sd_bus_error value to some sensible value and then return a good errno code matching that. If it cannot work at all it should set the error statically to the OOM error. But if it can work half-way (i.e. initialize the name, but not the message) it should do so and still return the correct errno number for it. This effectively reverts 8bf13eb1e02b9977ae1cd331ae5dc7305a305a09 --- src/libsystemd/sd-bus/bus-error.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git src/libsystemd/sd-bus/bus-error.c src/libsystemd/sd-bus/bus-error.c index 5ca974a..af83c12 100644 --- src/libsystemd/sd-bus/bus-error.c +++ src/libsystemd/sd-bus/bus-error.c @@ -194,13 +194,10 @@ int bus_error_setfv(sd_bus_error *e, const char *name, const char *format, va_li return -ENOMEM; } - if (format) { - int r; - - r = vasprintf((char**) &e->message, format, ap); - if (r < 0) - return -ENOMEM; - } + /* Of we hit OOM on formatting the pretty message, we ignore + * this, since we at least managed to write the error name */ + if (format) + (void) vasprintf((char**) &e->message, format, ap); e->_need_free = 1; -- 1.7.9.2 ++++++ 0004-sd-bus-when-an-event-loop-terminates-explicitly-clos.patch ++++++
From 7bb4d371af5ec6b8c50b71d2a80c2866d8134d9a Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 2 Jul 2014 17:36:47 +0200 Subject: [PATCH] sd-bus: when an event loop terminates, explicitly close the bus
This makes sure we actually release the bus and all the messages it references. --- src/libsystemd/sd-bus/sd-bus.c | 1 + 1 file changed, 1 insertion(+) diff --git src/libsystemd/sd-bus/sd-bus.c src/libsystemd/sd-bus/sd-bus.c index d52afe8..eb267d4 100644 --- src/libsystemd/sd-bus/sd-bus.c +++ src/libsystemd/sd-bus/sd-bus.c @@ -2940,6 +2940,7 @@ static int quit_callback(sd_event_source *event, void *userdata) { assert(event); sd_bus_flush(bus); + sd_bus_close(bus); return 1; } -- 1.7.9.2 ++++++ 0004-sd-event-check-the-value-of-received-signal.patch ++++++
From 7057bd993110c1eff0cd3a8776902ca66417634e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 3 Oct 2014 18:49:45 -0400 Subject: [PATCH] sd-event: check the value of received signal
Appease coverity report #1237775. Also rename ss to n, to make it visually different from ss. --- src/libsystemd/sd-event/sd-event.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git src/libsystemd/sd-event/sd-event.c src/libsystemd/sd-event/sd-event.c index b56182d..4c67ee8 100644 --- src/libsystemd/sd-event/sd-event.c +++ src/libsystemd/sd-event/sd-event.c @@ -1973,20 +1973,22 @@ static int process_signal(sd_event *e, uint32_t events) { for (;;) { struct signalfd_siginfo si; - ssize_t ss; + ssize_t n; sd_event_source *s = NULL; - ss = read(e->signal_fd, &si, sizeof(si)); - if (ss < 0) { + n = read(e->signal_fd, &si, sizeof(si)); + if (n < 0) { if (errno == EAGAIN || errno == EINTR) return read_one; return -errno; } - if (_unlikely_(ss != sizeof(si))) + if (_unlikely_(n != sizeof(si))) return -EIO; + assert(si.ssi_signo < _NSIG); + read_one = true; if (si.ssi_signo == SIGCHLD) { -- 1.7.9.2 ++++++ 0004-sd-journal-verify-that-object-start-with-the-field-n.patch ++++++ Based on 0f99f74a14ef193c1ebde687c5cc76e1d67b85ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 26 Aug 2014 23:54:31 -0400 Subject: [PATCH] sd-journal: verify that object start with the field name If the journal is corrupted, we might return an object that does not start with the expected field name and/or is shorter than it should. --- src/journal/sd-journal.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git src/journal/sd-journal.c src/journal/sd-journal.c index 80ff8fe..693707c 100644 --- src/journal/sd-journal.c +++ src/journal/sd-journal.c @@ -2571,6 +2571,21 @@ _public_ int sd_journal_enumerate_unique(sd_journal *j, const void **data, size_ if (r < 0) return r; + /* Check if we have at least the field name and "=". */ + if (ol <= k) { + log_debug("%s:offset " OFSfmt ": object has size %zu, expected at least %zu", + j->unique_file->path, j->unique_offset, + ol, k + 1); + return -EBADMSG; + } + + if (memcmp(odata, j->unique_field, k) || ((const char*) odata)[k] != '=') { + log_debug("%s:offset " OFSfmt ": object does not start with \"%s=\"", + j->unique_file->path, j->unique_offset, + j->unique_field); + return -EBADMSG; + } + /* OK, now let's see if we already returned this data * object by checking if it exists in the earlier * traversed files. */ -- 1.7.9.2 ++++++ 0004-selinux-fix-potential-double-free-crash-in-child-pro.patch ++++++
From 5e78424f4a27c07be50e246308035c877f204038 Mon Sep 17 00:00:00 2001 From: Michal Sekletar <msekleta@redhat.com> Date: Mon, 13 Oct 2014 15:25:09 +0200 Subject: [PATCH] selinux: fix potential double free crash in child process
Before returning from function we should reset ret to NULL, thus cleanup function is nop. Also context_str() returns pointer to a string containing context but not a copy, hence we must make copy it explicitly. --- src/shared/label.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git src/shared/label.c src/shared/label.c index b6af38d..69d4616 100644 --- src/shared/label.c +++ src/shared/label.c @@ -334,7 +334,7 @@ int label_get_child_mls_label(int socket_fd, const char *exe, char **label) { } freecon(mycon); - mycon = context_str(bcon); + mycon = strdup(context_str(bcon)); if (!mycon) { r = -errno; goto out; @@ -348,6 +348,7 @@ int label_get_child_mls_label(int socket_fd, const char *exe, char **label) { } *label = ret; + ret = NULL; r = 0; out: -- 1.7.9.2 ++++++ 0004-shared-conf-parser.patch ++++++ Based on 83e341a637b75f7f592a5dc717c34d8b67ed4ffa Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Wed, 17 Sep 2014 22:17:53 +0200 Subject: [PATCH] shared: conf-parser Check memory allocation. Found by Coverity. Fixes CID #1237644. --- src/shared/conf-parser.h | 4 ++++ 1 file changed, 4 insertions(+) --- src/shared/conf-parser.h +++ src/shared/conf-parser.h 2014-09-18 13:07:07.314735514 +0000 @@ -181,6 +181,8 @@ int log_syntax_internal(const char *unit assert(data); \ \ xs = new0(type, 1); \ + if(!xs) \ + return -ENOMEM; \ *xs = invalid; \ \ FOREACH_WORD(w, l, rvalue, state) { \ @@ -213,6 +215,7 @@ int log_syntax_internal(const char *unit xs = realloc(xs, (++i + 1) * sizeof(type)); \ if (!xs) \ return -ENOMEM; \ + \ *(xs + i) = invalid; \ } \ \ ++++++ 0004-shared-wtmp-utmp-don-t-clear-store_wtmp-in-utmp_put_.patch ++++++
From 863f3ce0d050f005839f6aa41fe7bac5478a7b5e Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Fri, 19 Sep 2014 08:03:31 +0200 Subject: [PATCH] shared: wtmp-utmp - don't clear store_wtmp in utmp_put_dead_process()
Also modernize a few other things and add comments to explain CID #1237503 and CID #1237504. --- src/shared/utmp-wtmp.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git src/shared/utmp-wtmp.c src/shared/utmp-wtmp.c index 30a0c03..31f13ec 100644 --- src/shared/utmp-wtmp.c +++ src/shared/utmp-wtmp.c @@ -92,8 +92,6 @@ int utmp_get_runlevel(int *runlevel, int *previous) { static void init_timestamp(struct utmpx *store, usec_t t) { assert(store); - zero(*store); - if (t <= 0) t = now(CLOCK_REALTIME); @@ -143,7 +141,7 @@ static int write_entry_wtmp(const struct utmpx *store) { assert(store); /* wtmp is a simple append-only file where each entry is - simply appended to * the end; i.e. basically a log. */ + simply appended to the end; i.e. basically a log. */ errno = 0; updwtmpx(_PATH_WTMPX, store); @@ -172,7 +170,7 @@ static int write_entry_both(const struct utmpx *store) { } int utmp_put_shutdown(void) { - struct utmpx store; + struct utmpx store = {}; init_entry(&store, 0); @@ -183,7 +181,7 @@ int utmp_put_shutdown(void) { } int utmp_put_reboot(usec_t t) { - struct utmpx store; + struct utmpx store = {}; init_entry(&store, t); @@ -206,16 +204,17 @@ _pure_ static const char *sanitize_id(const char *id) { } int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line) { - struct utmpx store; + struct utmpx store = { + .ut_type = INIT_PROCESS, + .ut_pid = pid, + .ut_session = sid, + }; assert(id); init_timestamp(&store, 0); - store.ut_type = INIT_PROCESS; - store.ut_pid = pid; - store.ut_session = sid; - + /* ut_id needs only be nul-terminated if it is shorter than sizeof(ut_id) */ strncpy(store.ut_id, sanitize_id(id), sizeof(store.ut_id)); if (line) @@ -225,14 +224,15 @@ int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line } int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) { - struct utmpx lookup, store, store_wtmp, *found; + struct utmpx lookup = { + .ut_type = INIT_PROCESS /* looks for DEAD_PROCESS, LOGIN_PROCESS, USER_PROCESS, too */ + }, store, store_wtmp, *found; assert(id); setutxent(); - zero(lookup); - lookup.ut_type = INIT_PROCESS; /* looks for DEAD_PROCESS, LOGIN_PROCESS, USER_PROCESS, too */ + /* ut_id needs only be nul-terminated if it is shorter than sizeof(ut_id) */ strncpy(lookup.ut_id, sanitize_id(id), sizeof(lookup.ut_id)); found = getutxid(&lookup); @@ -260,7 +260,7 @@ int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) { int utmp_put_runlevel(int runlevel, int previous) { - struct utmpx store; + struct utmpx store = {}; int r; assert(runlevel > 0); -- 1.7.9.2 ++++++ 0004-socket-properly-handle-if-our-service-vanished-durin.patch ++++++
From 640ace4a8de907994a1b95f6d368c3e6a8fcf60f Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 22 May 2014 16:56:21 +0900 Subject: [PATCH] socket: properly handle if our service vanished during runtime
--- src/core/socket.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git src/core/socket.c src/core/socket.c index 05af8fe..aca20fd 100644 --- src/core/socket.c +++ src/core/socket.c @@ -1503,6 +1503,12 @@ static void socket_enter_running(Socket *s, int cfd) { } if (!pending) { + if (!UNIT_ISSET(s->service)) { + log_error_unit(UNIT(s)->id, "%s: service to activate vanished, refusing activation.", UNIT(s)->id); + r = -ENOENT; + goto fail; + } + r = manager_add_job(UNIT(s)->manager, JOB_START, UNIT_DEREF(s->service), JOB_REPLACE, true, &error, NULL); if (r < 0) goto fail; -- 1.7.9.2 ++++++ 0004-systemd-detect-virt-only-discover-Xen-domU.patch ++++++
From 37287585b6ba9a55065c8f94458f6db3c0abe0af Mon Sep 17 00:00:00 2001 From: Thomas Blume <Thomas.Blume@suse.com> Date: Fri, 6 Jun 2014 16:36:45 +0200 Subject: [PATCH] systemd-detect-virt: only discover Xen domU
The current vm detection lacks the distinction between Xen dom0 and Xen domU. Both, dom0 and domU are running inside the hypervisor. Therefore systemd-detect-virt and the ConditionVirtualization directive detect dom0 as a virtual machine. dom0 is not using virtual devices but is accessing the real hardware. Therefore dom0 should be considered the virtualisation host and not a virtual machine. https://bugs.freedesktop.org/show_bug.cgi?id=77271 --- src/shared/virt.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git src/shared/virt.c src/shared/virt.c index 1e227c5..774915f 100644 --- src/shared/virt.c +++ src/shared/virt.c @@ -148,7 +148,7 @@ static int detect_vm_dmi(const char **_id) { /* Returns a short identifier for the various VM implementations */ int detect_vm(const char **id) { - _cleanup_free_ char *hvtype = NULL, *cpuinfo_contents = NULL; + _cleanup_free_ char *domcap = NULL, *cpuinfo_contents = NULL; static thread_local int cached_found = -1; static thread_local const char *cached_id = NULL; const char *_id = NULL; @@ -162,17 +162,37 @@ int detect_vm(const char **id) { return cached_found; } - /* Try high-level hypervisor sysfs file first: + /* Try xen capabilities file first, if not found try high-level hypervisor sysfs file: * - * https://bugs.freedesktop.org/show_bug.cgi?id=61491 */ - r = read_one_line_file("/sys/hypervisor/type", &hvtype); + * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */ + r = read_one_line_file("/proc/xen/capabilities", &domcap); if (r >= 0) { - if (streq(hvtype, "xen")) { + char *cap, *i = domcap; + + while ((cap = strsep(&i, ","))) + if (streq(cap, "control_d")) + break; + + if (!i) { _id = "xen"; r = 1; - goto finish; } - } else if (r != -ENOENT) + + goto finish; + + } else if (r == -ENOENT) { + _cleanup_free_ char *hvtype = NULL; + + r = read_one_line_file("/sys/hypervisor/type", &hvtype); + if (r >= 0) { + if (streq(hvtype, "xen")) { + _id = "xen"; + r = 1; + goto finish; + } + } else if (r != -ENOENT) + return r; + } else return r; /* this will set _id to "other" and return 0 for unknown hypervisors */ -- 1.7.9.2 ++++++ 0004-systemd-python-use-.hex-instead-of-.get_hex.patch ++++++
From b532cf3722e04adb0bd075666eb9989a9390d0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 5 Apr 2014 13:23:25 -0400 Subject: [PATCH] systemd-python: use .hex instead of .get_hex()
It turns out the latter got removed in Python 3. https://bugs.freedesktop.org/show_bug.cgi?id=77086 --- src/python-systemd/journal.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git src/python-systemd/journal.py src/python-systemd/journal.py index 9c7e004..dd1f229 100644 --- src/python-systemd/journal.py +++ src/python-systemd/journal.py @@ -293,7 +293,7 @@ class Reader(_Reader): monotonic = monotonic.totalseconds() monotonic = int(monotonic * 1000000) if isinstance(bootid, _uuid.UUID): - bootid = bootid.get_hex() + bootid = bootid.hex return super(Reader, self).seek_monotonic(monotonic, bootid) def log_level(self, level): @@ -314,7 +314,7 @@ class Reader(_Reader): Equivalent to add_match(MESSAGE_ID=`messageid`). """ if isinstance(messageid, _uuid.UUID): - messageid = messageid.get_hex() + messageid = messageid.hex self.add_match(MESSAGE_ID=messageid) def this_boot(self, bootid=None): @@ -346,7 +346,7 @@ class Reader(_Reader): def get_catalog(mid): if isinstance(mid, _uuid.UUID): - mid = mid.get_hex() + mid = mid.hex return _get_catalog(mid) def _make_line(field, value): -- 1.7.9.2 ++++++ 0004-systemd-return-the-first-error-from-manager_startup.patch ++++++
From 1cd974edfd7cd91dcdf321e7202bd220bac50a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 18 Jul 2014 17:05:18 -0400 Subject: [PATCH] systemd: return the first error from manager_startup()
--- src/core/manager.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git src/core/manager.c src/core/manager.c index 2e63c5e..0653d7e 100644 --- src/core/manager.c +++ src/core/manager.c @@ -1005,11 +1005,8 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) { dual_timestamp_get(&m->units_load_finish_timestamp); /* Second, deserialize if there is something to deserialize */ - if (serialization) { - q = manager_deserialize(m, serialization, fds); - if (q < 0) - r = q; - } + if (serialization) + r = manager_deserialize(m, serialization, fds); /* Any fds left? Find some unit which wants them. This is * useful to allow container managers to pass some file @@ -1017,13 +1014,15 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) { * socket-based activation of entire containers. */ if (fdset_size(fds) > 0) { q = manager_distribute_fds(m, fds); - if (q < 0) + if (q < 0 && r == 0) r = q; } /* We might have deserialized the notify fd, but if we didn't * then let's create the bus now */ - manager_setup_notify(m); + q = manager_setup_notify(m); + if (q < 0 && r == 0) + r = q; /* We might have deserialized the kdbus control fd, but if we * didn't, then let's create the bus now. */ @@ -1033,7 +1032,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) { /* Third, fire things up! */ q = manager_coldplug(m); - if (q < 0) + if (q < 0 && r == 0) r = q; if (serialization) { -- 1.7.9.2 ++++++ 0004-util-ignore_file-should-not-allow-files-ending-with.patch ++++++
From 93f1a06374e335e8508d89e1bdaadf45be6ab777 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Sat, 31 May 2014 21:36:23 +0200 Subject: [PATCH] util: ignore_file should not allow files ending with '~'
ignore_file currently allows any file ending with '~' while it seems that the opposite was intended: a228a22fda4faa9ecb7c5a5e499980c8ae5d2a08 --- src/shared/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/shared/util.c src/shared/util.c index 0c27394..17b0ae1 100644 --- src/shared/util.c +++ src/shared/util.c @@ -1371,7 +1371,7 @@ bool ignore_file(const char *filename) { assert(filename); if (endswith(filename, "~")) - return false; + return true; return ignore_file_allow_backup(filename); } -- 1.7.9.2 ++++++ 0004-util-refuse-considering-UID-0xFFFF-and-0xFFFFFFFF-va.patch ++++++
From 306a55c86360a7ae7b2509771d5ea6ab0d166d85 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Sun, 29 Jun 2014 22:15:33 +0200 Subject: [PATCH] util: refuse considering UID 0xFFFF and 0xFFFFFFFF valid
--- src/shared/util.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git src/shared/util.c src/shared/util.c index e7ff0f8..1709bb7 100644 --- src/shared/util.c +++ src/shared/util.c @@ -280,6 +280,14 @@ int parse_uid(const char *s, uid_t* ret_uid) { if ((unsigned long) uid != ul) return -ERANGE; + /* Some libc APIs use (uid_t) -1 as special placeholder */ + if (uid == (uid_t) 0xFFFFFFFF) + return -EINVAL; + + /* A long time ago UIDs where 16bit, hence explicitly avoid the 16bit -1 too */ + if (uid == (uid_t) 0xFFFF) + return -EINVAL; + *ret_uid = uid; return 0; } -- 1.7.9.2 ++++++ 0005-Replace-var-run-with-run-in-remaining-places.patch ++++++
From 41a55c46ab8fb4ef6727434227071321fc762cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 25 Feb 2014 20:11:04 -0500 Subject: [PATCH] Replace /var/run with /run in remaining places
/run was already used almost everywhere, fix the remaining places for consistency. --- man/daemon.xml | 2 +- man/runlevel.xml | 2 +- man/tmpfiles.d.xml | 4 ++-- src/libsystemd/sd-bus/sd-bus.c | 4 ++-- src/systemctl/systemctl.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git man/daemon.xml man/daemon.xml index 88dd082..fd29ba7 100644 --- man/daemon.xml +++ man/daemon.xml @@ -149,7 +149,7 @@ write the daemon PID (as returned by <function>getpid()</function>) to a PID file, for example - <filename>/var/run/foobar.pid</filename> + <filename>/run/foobar.pid</filename> (for a hypothetical daemon "foobar") to ensure that the daemon cannot be started more than once. This must be diff --git man/runlevel.xml man/runlevel.xml index 976753a..4db06dc 100644 --- man/runlevel.xml +++ man/runlevel.xml @@ -124,7 +124,7 @@ <variablelist> <varlistentry> - <term><filename>/var/run/utmp</filename></term> + <term><filename>/run/utmp</filename></term> <listitem><para>The utmp database <command>runlevel</command> reads the diff --git man/tmpfiles.d.xml man/tmpfiles.d.xml index 812129f..0a006d1 100644 --- man/tmpfiles.d.xml +++ man/tmpfiles.d.xml @@ -441,8 +441,8 @@ r! /tmp/.X[0-9]*-lock</programlisting> <title>/etc/tmpfiles.d/screen.conf example</title> <para><command>screen</command> needs two directories created at boot with specific modes and ownership.</para> - <programlisting>d /var/run/screens 1777 root root 10d -d /var/run/uscreens 0755 root root 10d12h</programlisting> + <programlisting>d /run/screens 1777 root root 10d +d /run/uscreens 0755 root root 10d12h</programlisting> </example> <example> <title>/etc/tmpfiles.d/abrt.conf example</title> diff --git src/libsystemd/sd-bus/sd-bus.c src/libsystemd/sd-bus/sd-bus.c index 20f540d..1318272 100644 --- src/libsystemd/sd-bus/sd-bus.c +++ src/libsystemd/sd-bus/sd-bus.c @@ -794,8 +794,8 @@ static int parse_container_unix_address(sd_bus *b, const char **p, char **guid) machine = NULL; b->sockaddr.un.sun_family = AF_UNIX; - strncpy(b->sockaddr.un.sun_path, "/var/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path)); - b->sockaddr_size = offsetof(struct sockaddr_un, sun_path) + sizeof("/var/run/dbus/system_bus_socket") - 1; + strncpy(b->sockaddr.un.sun_path, "/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path)); + b->sockaddr_size = offsetof(struct sockaddr_un, sun_path) + strlen("/run/dbus/system_bus_socket"); return 0; } diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c index 34d7079..8692716 100644 --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c @@ -3758,8 +3758,8 @@ static int show_one( streq(verb, "status")) { /* According to LSB: "program not running" */ /* 0: program is running or service is OK - * 1: program is dead and /var/run pid file exists - * 2: program is dead and /var/lock lock file exists + * 1: program is dead and /run PID file exists + * 2: program is dead and /run/lock lock file exists * 3: program is not running * 4: program or service status is unknown */ -- 1.7.9.2 ++++++ 0005-backlight-Do-not-clamp-brightness-for-LEDs.patch ++++++
From 4cd2b2cf8ca585d15ebc859701b346658262b5bb Mon Sep 17 00:00:00 2001 From: Denis Tikhomirov <dvtikhomirov@gmail.com> Date: Thu, 5 Jun 2014 23:59:40 +0400 Subject: [PATCH] backlight: Do not clamp brightness for LEDs
https://bugs.freedesktop.org/show_bug.cgi?id=77092 On Thu, Jun 05, 2014 at 08:37:20AM +0200, Lennart Poettering wrote:
The patch is line-broken, please send an uncorrupted patch! I am very sorry, I forgot that my client limits line width. I will use mutt now on. clamp_brightness() clamps the brightness value to the range of the actual device. This is a recent addition that was added to deal with driver updates where the resolution is changed. I don't think this part should be dropped for LED devices. The clamp_brightness() call hence should be called unconditionally, however, internally it should use a different min_brightness value if something is an !backlight devices... Thank you for explanation, this sounds very reasonable to me. Please, see updated patch:
src/backlight/backlight.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git src/backlight/backlight.c src/backlight/backlight.c index 691472c..4d94ebf 100644 --- src/backlight/backlight.c +++ src/backlight/backlight.c @@ -225,11 +225,13 @@ static unsigned get_max_brightness(struct udev_device *device) { /* Some systems turn the backlight all the way off at the lowest levels. * clamp_brightness clamps the saved brightness to at least 1 or 5% of - * max_brightness. This avoids preserving an unreadably dim screen, which - * would otherwise force the user to disable state restoration. */ + * max_brightness in case of 'backlight' subsystem. This avoids preserving + * an unreadably dim screen, which would otherwise force the user to + * disable state restoration. */ static void clamp_brightness(struct udev_device *device, char **value, unsigned max_brightness) { int r; unsigned brightness, new_brightness, min_brightness; + const char *subsystem; r = safe_atou(*value, &brightness); if (r < 0) { @@ -237,7 +239,12 @@ static void clamp_brightness(struct udev_device *device, char **value, unsigned return; } - min_brightness = MAX(1U, max_brightness/20); + subsystem = udev_device_get_subsystem(device); + if (streq_ptr(subsystem, "backlight")) + min_brightness = MAX(1U, max_brightness/20); + else + min_brightness = 0; + new_brightness = CLAMP(brightness, min_brightness, max_brightness); if (new_brightness != brightness) { char *old_value = *value; -- 1.7.9.2 ++++++ 0005-backlight-handle-saved-brightness-exceeding-max-brig.patch ++++++
From 0c9d8f1d4b5018199cb5a9b57580dc1480a7f915 Mon Sep 17 00:00:00 2001 From: Jani Nikula <jani.nikula@intel.com> Date: Wed, 7 May 2014 12:01:01 +0300 Subject: [PATCH] backlight: handle saved brightness exceeding max brightness
If too high a brightness value has been saved (e.g. due to kernel mechanism changing from one kernel version to another, or booting the userspace on another system), the brightness update fails and the process exits. Clamp saved brightness between the policy minimum introduced in commit 7b909d7407965c03caaba30daae7aee113627a83 Author: Josh Triplett <josh@joshtriplett.org> Date: Tue Mar 11 21:16:33 2014 -0700 backlight: Avoid restoring brightness to an unreadably dim level and the absolute maximum. https://bugs.freedesktop.org/show_bug.cgi?id=78200 --- src/backlight/backlight.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git src/backlight/backlight.c src/backlight/backlight.c index c708391..691472c 100644 --- src/backlight/backlight.c +++ src/backlight/backlight.c @@ -229,7 +229,7 @@ static unsigned get_max_brightness(struct udev_device *device) { * would otherwise force the user to disable state restoration. */ static void clamp_brightness(struct udev_device *device, char **value, unsigned max_brightness) { int r; - unsigned brightness, new_brightness; + unsigned brightness, new_brightness, min_brightness; r = safe_atou(*value, &brightness); if (r < 0) { @@ -237,7 +237,8 @@ static void clamp_brightness(struct udev_device *device, char **value, unsigned return; } - new_brightness = MAX3(brightness, 1U, max_brightness/20); + min_brightness = MAX(1U, max_brightness/20); + new_brightness = CLAMP(brightness, min_brightness, max_brightness); if (new_brightness != brightness) { char *old_value = *value; @@ -247,7 +248,11 @@ static void clamp_brightness(struct udev_device *device, char **value, unsigned return; } - log_debug("Saved brightness %s too low; increasing to %s.", old_value, *value); + log_info("Saved brightness %s %s to %s.", old_value, + new_brightness > brightness ? + "too low; increasing" : "too high; decreasing", + *value); + free(old_value); } } -- 1.7.9.2 ++++++ 0005-bootchart-Do-not-try-to-access-data-for-non-existing.patch ++++++
From c119700c06b248b1c2a082b40b1a346f58d89da0 Mon Sep 17 00:00:00 2001 From: Philippe De Swert <philippe.deswert@jollamobile.com> Date: Sun, 28 Sep 2014 18:12:51 +0300 Subject: [PATCH] bootchart: Do not try to access data for non-existing CPU's
Cpu's are assigned normally, so starting at 0, so the MAX_CPU index will always be one smaller than the actual number. Found with Coverity. --- src/bootchart/store.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/bootchart/store.c src/bootchart/store.c index 3099ff1..9ea1b27 100644 --- src/bootchart/store.c +++ src/bootchart/store.c @@ -199,7 +199,7 @@ vmstat_next: if (strstr(key, "cpu")) { r = safe_atoi((const char*)(key+3), &c); - if (r < 0 || c > MAXCPUS) + if (r < 0 || c > MAXCPUS -1) /* Oops, we only have room for MAXCPUS data */ break; sampledata->runtime[c] = atoll(rt); -- 1.7.9.2 ++++++ 0005-bus-avoid-using-m-kdbus-after-freeing-it.patch ++++++ Based on fd989a0bc999d79719408ac28b126d9c9016bcb5 Mon Sep 17 00:00:00 2001 From: Philippe De Swert <philippedeswert@gmail.com> Date: Wed, 10 Sep 2014 12:20:38 +0300 Subject: [PATCH] bus: avoid using m->kdbus after freeing it m->kdbus could be freed before it is released. Changing the order fixes the issue. Found with Coverity. Fixes: CID#1237798 --- src/libsystemd/sd-bus/bus-message.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- src/libsystemd/sd-bus/bus-message.c +++ src/libsystemd/sd-bus/bus-message.c 2014-09-16 10:31:37.538735664 +0000 @@ -126,9 +126,6 @@ static void message_free(sd_bus_message message_reset_parts(m); - if (m->free_kdbus) - free(m->kdbus); - if (m->release_kdbus) { uint64_t off; @@ -136,6 +133,9 @@ static void message_free(sd_bus_message ioctl(m->bus->input_fd, KDBUS_CMD_FREE, &off); } + if (m->free_kdbus) + free(m->kdbus); + if (m->bus) sd_bus_unref(m->bus); ++++++ 0005-bus-close-a-bus-that-failed-to-connect.patch ++++++
From db9bb83fa5ec72da38eb5bd0c259ef8c76a71858 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 3 Jul 2014 01:19:21 +0200 Subject: [PATCH] bus: close a bus that failed to connect
--- src/libsystemd/sd-bus/sd-bus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git src/libsystemd/sd-bus/sd-bus.c src/libsystemd/sd-bus/sd-bus.c index c25375c..28fc19e 100644 --- src/libsystemd/sd-bus/sd-bus.c +++ src/libsystemd/sd-bus/sd-bus.c @@ -1033,8 +1033,10 @@ _public_ int sd_bus_start(sd_bus *bus) { else return -EINVAL; - if (r < 0) + if (r < 0) { + sd_bus_close(bus); return r; + } return bus_send_hello(bus); } -- 1.7.9.2 ++++++ 0005-core-Filter-by-state-behind-the-D-Bus-API-not-in-the.patch ++++++
From cdc06ed7b6120c1049305fa7033f228ee9d86043 Mon Sep 17 00:00:00 2001 From: David Strauss <david@davidstrauss.net> Date: Mon, 28 Apr 2014 12:08:32 -0700 Subject: [PATCH] core: Filter by state behind the D-Bus API, not in the systemctl client.
--- src/core/dbus-manager.c | 24 +++++++++++++++++++++++- src/core/org.freedesktop.systemd1.conf | 4 ++++ src/systemctl/systemctl.c | 24 +++++++++++++----------- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git src/core/dbus-manager.c src/core/dbus-manager.c index 58e484d..d5fab0a 100644 --- src/core/dbus-manager.c +++ src/core/dbus-manager.c @@ -728,7 +728,7 @@ static int method_reset_failed(sd_bus *bus, sd_bus_message *message, void *userd return sd_bus_reply_method_return(message, NULL); } -static int method_list_units(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { +static int list_units_filtered(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error, char **states) { _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; Manager *m = userdata; const char *k; @@ -761,6 +761,12 @@ static int method_list_units(sd_bus *bus, sd_bus_message *message, void *userdat following = unit_following(u); + if (!strv_isempty(states) && + !strv_contains(states, unit_load_state_to_string(u->load_state)) && + !strv_contains(states, unit_active_state_to_string(unit_active_state(u))) && + !strv_contains(states, unit_sub_state_to_string(u))) + continue; + unit_path = unit_dbus_path(u); if (!unit_path) return -ENOMEM; @@ -794,6 +800,21 @@ static int method_list_units(sd_bus *bus, sd_bus_message *message, void *userdat return sd_bus_send(bus, reply, NULL); } +static int method_list_units(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { + return list_units_filtered(bus, message, userdata, error, NULL); +} + +static int method_list_units_filtered(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { + _cleanup_strv_free_ char **states = NULL; + int r; + + r = sd_bus_message_read_strv(message, &states); + if (r < 0) + return r; + + return list_units_filtered(bus, message, userdata, error, states); +} + static int method_list_jobs(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; Manager *m = userdata; @@ -1670,6 +1691,7 @@ const sd_bus_vtable bus_manager_vtable[] = { SD_BUS_METHOD("ClearJobs", NULL, NULL, method_clear_jobs, 0), SD_BUS_METHOD("ResetFailed", NULL, NULL, method_reset_failed, 0), SD_BUS_METHOD("ListUnits", NULL, "a(ssssssouso)", method_list_units, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("ListUnitsFiltered", "as", "a(ssssssouso)", method_list_units_filtered, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("ListJobs", NULL, "a(usssoo)", method_list_jobs, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("Subscribe", NULL, NULL, method_subscribe, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("Unsubscribe", NULL, NULL, method_unsubscribe, SD_BUS_VTABLE_UNPRIVILEGED), diff --git src/core/org.freedesktop.systemd1.conf src/core/org.freedesktop.systemd1.conf index a375dce..9dfca81 100644 --- src/core/org.freedesktop.systemd1.conf +++ src/core/org.freedesktop.systemd1.conf @@ -64,6 +64,10 @@ <allow send_destination="org.freedesktop.systemd1" send_interface="org.freedesktop.systemd1.Manager" + send_member="ListUnitsFiltered"/> + + <allow send_destination="org.freedesktop.systemd1" + send_interface="org.freedesktop.systemd1.Manager" send_member="ListUnitFiles"/> <allow send_destination="org.freedesktop.systemd1" --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c 2014-05-20 12:39:27.058236843 +0000 @@ -308,12 +308,6 @@ static int compare_unit_info(const void static bool output_show_unit(const UnitInfo *u, char **patterns) { const char *dot; - if (!strv_isempty(arg_states)) - return - strv_contains(arg_states, u->load_state) || - strv_contains(arg_states, u->sub_state) || - strv_contains(arg_states, u->active_state); - if (!strv_isempty(patterns)) { char **pattern; @@ -467,6 +461,7 @@ static int get_unit_list( UnitInfo **_unit_infos, char **patterns) { + _cleanup_bus_message_unref_ sd_bus_message *m = NULL; _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; _cleanup_free_ UnitInfo *unit_infos = NULL; @@ -478,15 +473,22 @@ static int get_unit_list( assert(_reply); assert(_unit_infos); - r = sd_bus_call_method( + r = sd_bus_message_new_method_call( bus, + &m, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", - "ListUnits", - &error, - &reply, - NULL); + "ListUnitsFiltered"); + + if (r < 0) + return bus_log_create_error(r); + + r = sd_bus_message_append_strv(m, arg_states); + if (r < 0) + return bus_log_create_error(r); + + r = sd_bus_call(bus, m, 0, &error, &reply); if (r < 0) { log_error("Failed to list units: %s", bus_error_message(&error, r)); return r; -- 1.7.9.2 ++++++ 0005-core-only-set-the-kernel-s-timezone-when-the-RTC-run.patch ++++++ Based on c264aeab4b0e7b69f469e12e78d4a48b3ed7a66e Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Sun, 27 Jul 2014 00:11:08 +0200 Subject: [PATCH] core: only set the kernel's timezone when the RTC runs in local time We can not reliably manage any notion of local time. Every daylight saving time change or time zone change by traveling will make the time jump, and the local time might jump backwards which creates unsolvable problems with file timestamps. We will no longer tell the kernel our local time zone and leave everything set to UTC. This will effectively turn FAT timestamps into UTC timestamps. If and only if the machine is configured to read the RTC in local time mode, the kernel's time zone will be configured, but systemd-timesysnc will disable the kernel's system time to RTC syncing. In this mode, the RTC will not be managed, and external tools like Windows bootups are expected to manage the RTC's time. https://bugs.freedesktop.org/show_bug.cgi?id=81538 --- src/core/main.c | 23 +++++++++++++++-------- src/shared/hwclock.c | 15 ++++++++------- src/shared/hwclock.h | 2 +- 3 files changed, 24 insertions(+), 16 deletions(-) --- src/core/main.c +++ src/core/main.c 2014-07-28 09:59:35.778235585 +0000 @@ -1349,7 +1349,14 @@ int main(int argc, char *argv[]) { if (hwclock_is_localtime() > 0) { int min; - /* The first-time call to settimeofday() does a time warp in the kernel */ + /* + * The very first call of settimeofday() also does a time warp in the kernel. + * + * In the rtc-in-local time mode, we set the kernel's timezone, and rely on + * external tools to take care of maintaining the RTC and do all adjustments. + * This matches the behavior of Windows, which leaves the RTC alone if the + * registry tells that the RTC runs in UTC. + */ r = hwclock_set_timezone(&min); if (r < 0) log_error("Failed to apply local time delta, ignoring: %s", strerror(-r)); @@ -1357,19 +1364,19 @@ int main(int argc, char *argv[]) { log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min); } else if (!in_initrd()) { /* - * Do dummy first-time call to seal the kernel's time warp magic + * Do a dummy very first call to seal the kernel's time warp magic. * * Do not call this this from inside the initrd. The initrd might not * carry /etc/adjtime with LOCAL, but the real system could be set up * that way. In such case, we need to delay the time-warp or the sealing * until we reach the real system. + * + * Do no set the kernel's timezone. The concept of local time cannot + * be supported reliably, the time will jump or be incorrect at every daylight + * saving time change. All kernel local time concepts will be treated + * as UTC that way. */ - hwclock_reset_timezone(); - - /* Tell the kernel our timezone */ - r = hwclock_set_timezone(NULL); - if (r < 0) - log_error("Failed to set the kernel's timezone, ignoring: %s", strerror(-r)); + hwclock_reset_timewarp(); } } --- src/shared/hwclock.c +++ src/shared/hwclock.c 2014-07-28 09:59:12.914235566 +0000 @@ -124,9 +124,10 @@ int hwclock_set_timezone(int *min) { tz.tz_dsttime = 0; /* DST_NONE*/ /* - * If the hardware clock does not run in UTC, but in local time: - * The very first time we set the kernel's timezone, it will warp - * the clock so that it runs in UTC instead of local time. + * If the RTC does not run in UTC but in local time, the very first + * call to settimeofday() will set the kernel's timezone and will warp the + * system clock, so that it runs in UTC instead of the local time we + * have read from the RTC. */ if (settimeofday(tv_null, &tz) < 0) return -errno; @@ -135,7 +136,7 @@ int hwclock_set_timezone(int *min) { return 0; } -int hwclock_reset_timezone(void) { +int hwclock_reset_timewarp(void) { const struct timeval *tv_null = NULL; struct timezone tz; @@ -143,9 +144,9 @@ int hwclock_reset_timezone(void) { tz.tz_dsttime = 0; /* DST_NONE*/ /* - * The very first time we set the kernel's timezone, it will warp - * the clock. Do a dummy call here, so the time warping is sealed - * and we set only the timezone with next call. + * The very first call to settimeofday() does time warp magic. Do a + * dummy call here, so the time warping is sealed and all later calls + * behave as expected. */ if (settimeofday(tv_null, &tz) < 0) return -errno; --- src/shared/hwclock.h +++ src/shared/hwclock.h 2014-07-28 09:59:25.034736002 +0000 @@ -23,6 +23,6 @@ int hwclock_is_localtime(void); int hwclock_set_timezone(int *min); -int hwclock_reset_timezone(void); +int hwclock_reset_timewarp(void); int hwclock_get_time(struct tm *tm); int hwclock_set_time(const struct tm *tm); ++++++ 0005-cryptsetup-fix-an-OOM-check.patch ++++++
From 0e2f14014c65b4d8b30146e414579154cfa932da Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 23 Oct 2014 00:30:04 +0200 Subject: [PATCH] cryptsetup: fix an OOM check
--- src/cryptsetup/cryptsetup-generator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/cryptsetup/cryptsetup-generator.c src/cryptsetup/cryptsetup-generator.c index 137b787..c7f30f6 100644 --- src/cryptsetup/cryptsetup-generator.c +++ src/cryptsetup/cryptsetup-generator.c @@ -387,7 +387,7 @@ int main(int argc, char *argv[]) { if (k == 2 && streq(proc_uuid, device + 5)) { free(options); options = strdup(p); - if (!proc_options) { + if (!options) { log_oom(); goto cleanup; } -- 1.7.9.2 ++++++ 0005-hwdb-Update-database-of-Bluetooth-company-identifier.patch ++++++
From 24e29480bd800d3acdb3087e5863440bd0dd1d80 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann <marcel@holtmann.org> Date: Fri, 16 May 2014 15:57:35 -0700 Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
--- hwdb/20-bluetooth-vendor-product.hwdb | 53 ++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git hwdb/20-bluetooth-vendor-product.hwdb hwdb/20-bluetooth-vendor-product.hwdb index 28aa2a7..a65c7db 100644 --- hwdb/20-bluetooth-vendor-product.hwdb +++ hwdb/20-bluetooth-vendor-product.hwdb @@ -961,4 +961,55 @@ bluetooth:v013D* ID_VENDOR_FROM_DATABASE=WirelessWERX bluetooth:v013E* - ID_VENDOR_FROM_DATABASE=nimai + ID_VENDOR_FROM_DATABASE=Nod, Inc. + +bluetooth:v013F* + ID_VENDOR_FROM_DATABASE=B&B Manufacturing Company + +bluetooth:v0140* + ID_VENDOR_FROM_DATABASE=Alpine Electronics (China) Co., Ltd + +bluetooth:v0141* + ID_VENDOR_FROM_DATABASE=FedEx Services + +bluetooth:v0142* + ID_VENDOR_FROM_DATABASE=Grape Systems Inc. + +bluetooth:v0143* + ID_VENDOR_FROM_DATABASE=Bkon Connect + +bluetooth:v0144* + ID_VENDOR_FROM_DATABASE=Lintech GmbH + +bluetooth:v0145* + ID_VENDOR_FROM_DATABASE=Novatel Wireless + +bluetooth:v0146* + ID_VENDOR_FROM_DATABASE=Ciright + +bluetooth:v0147* + ID_VENDOR_FROM_DATABASE=Mighty Cast, Inc. + +bluetooth:v0148* + ID_VENDOR_FROM_DATABASE=Ambimat Electronics + +bluetooth:v0149* + ID_VENDOR_FROM_DATABASE=Perytons Ltd. + +bluetooth:v014A* + ID_VENDOR_FROM_DATABASE=Tivoli Audio, LLC + +bluetooth:v014B* + ID_VENDOR_FROM_DATABASE=Master Lock + +bluetooth:v014C* + ID_VENDOR_FROM_DATABASE=Mesh-Net Ltd + +bluetooth:v014D* + ID_VENDOR_FROM_DATABASE=HUIZHOU DESAY SV AUTOMOTIVE CO., LTD. + +bluetooth:v014E* + ID_VENDOR_FROM_DATABASE=Tangerine, Inc. + +bluetooth:v014F* + ID_VENDOR_FROM_DATABASE=B&W Group Ltd. -- 1.7.9.2 ++++++ 0005-hwdb-update.patch ++++++ ++++ 1560 lines (skipped) ++++++ 0005-job-always-add-waiting-jobs-to-run-queue-during-cold.patch ++++++ Based on 1727a595225132eb73ec134b6979d9c713b42e8c Mon Sep 17 00:00:00 2001 From: Michael Marineau <michael.marineau@coreos.com> Date: Mon, 12 May 2014 09:26:16 +0200 Subject: [PATCH] job: always add waiting jobs to run queue during coldplug commit 20a83d7bf was not equivalent to the original bug fix proposed by Michal Sekletar <msekleta@redhat.com>. The committed version only added the job to the run queue if the job had a timeout, which most jobs do not have. Just re-ordering the code gets us the intended functionality --- src/core/job.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- src/core/job.c +++ src/core/job.c 2014-05-12 13:11:24.918735646 +0000 @@ -1051,15 +1051,15 @@ int job_coldplug(Job *j) { assert(j); + if (j->state == JOB_WAITING) + job_add_to_run_queue(j); + if (j->begin_usec == 0 || j->unit->job_timeout == 0) return 0; if (j->timer_event_source) j->timer_event_source = sd_event_source_unref(j->timer_event_source); - if (j->state == JOB_WAITING) - job_add_to_run_queue(j); - r = sd_event_add_monotonic(j->manager->event, &j->timer_event_source, j->begin_usec + j->unit->job_timeout, 0, job_dispatch_timer, j); if (r < 0) log_debug("Failed to restart timeout for job: %s", strerror(-r)); ++++++ 0005-journalctl-correct-help-text-for-until.patch ++++++ Based on 7558251eef610e71595a0aa48952479906cb899a Mon Sep 17 00:00:00 2001 From: Santiago Vila <sanvila@unex.es> Date: Sat, 25 Oct 2014 10:40:30 -0400 Subject: [PATCH] journalctl: correct help text for --until http://bugs.debian.org/766598 --- src/journal/journalctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- src/journal/journalctl.c +++ src/journal/journalctl.c 2014-10-29 14:10:18.863838313 +0000 @@ -171,7 +171,7 @@ static int help(void) { " --user Show only the user journal for the current user\n" " -M --machine=CONTAINER Operate on local container\n" " --since=DATE Start showing entries on or newer than the specified date\n" - " --until=DATE Stop showing entries on or older than the specified date\n" + " --until=DATE Stop showing entries on or newer than the specified date\n" " -c --cursor=CURSOR Start showing entries from the specified cursor\n" " --after-cursor=CURSOR Start showing entries from after the specified cursor\n" " --show-cursor Print the cursor after all the entries\n" ++++++ 0005-login-fix-mem-leak.patch ++++++ Based on 13f493dc9ace9861c1f27c4d37e8cd6d52fe6a32 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Sun, 31 Aug 2014 23:34:01 +0200 Subject: [PATCH] login: fix mem leak --- src/login/logind-session.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- src/login/logind-session.c +++ src/login/logind-session.c 2014-09-01 12:59:27.870235647 +0000 @@ -1101,8 +1101,10 @@ int session_set_controller(Session *s, c * If logind crashes/restarts, we restore the controller during restart * or reset the VT in case it crashed/exited, too. */ r = session_mute_vt(s); - if (r < 0) + if (r < 0) { + free(t); return r; + } session_swap_controller(s, t); ++++++ 0005-logind-fix-policykit-checks.patch ++++++
From 055d406624cb9e01963558767420b71e5f75d2d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Mon, 10 Mar 2014 08:25:15 -0400 Subject: [PATCH] logind: fix policykit checks
--- src/login/logind-dbus.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git src/login/logind-dbus.c src/login/logind-dbus.c index c9c58f3..235b131 100644 --- src/login/logind-dbus.c +++ src/login/logind-dbus.c @@ -1480,6 +1480,8 @@ static int method_do_shutdown_or_sleep( action_multiple_sessions, interactive, error, method, m); if (r < 0) return r; + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ } if (blocked) { @@ -1487,6 +1489,8 @@ static int method_do_shutdown_or_sleep( action_ignore_inhibit, interactive, error, method, m); if (r < 0) return r; + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ } if (!multiple_sessions && !blocked) { @@ -1494,6 +1498,8 @@ static int method_do_shutdown_or_sleep( action, interactive, error, method, m); if (r < 0) return r; + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ } r = bus_manager_shutdown_or_sleep_now_or_later(m, unit_name, w, error); -- 1.7.9.2 ++++++ 0005-logind-fix-typo.patch ++++++
From 2b2332856bafe25c4aa17db2a90bdcddef1fec1a Mon Sep 17 00:00:00 2001 From: Ronny Chevalier <chevalier.ronny@gmail.com> Date: Wed, 17 Sep 2014 20:10:44 +0200 Subject: [PATCH] logind: fix typo
--- src/login/logind-session-dbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/login/logind-session-dbus.c src/login/logind-session-dbus.c index 7d81500..58836fc 100644 --- src/login/logind-session-dbus.c +++ src/login/logind-session-dbus.c @@ -249,7 +249,7 @@ static int method_set_idle_hint(sd_bus *bus, sd_bus_message *message, void *user return r; if (uid != 0 && uid != s->user->uid) - return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Only owner of session my set idle hint"); + return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Only owner of session may set idle hint"); session_set_idle_hint(s, b); -- 1.7.9.2 ++++++ 0005-logind-move-lid-switch-handling-from-logind-main-to-.patch ++++++
From b5d3e1688133077ca20542a20dcd8919147e72e1 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Tue, 11 Mar 2014 22:38:54 +0100 Subject: [PATCH] logind: move lid switch handling from logind-main to logind-core
../src/login/logind-dbus.c:1352: error: undefined reference to 'manager_set_lid_switch_ignore' collect2: error: ld returned 1 exit status make[2]: *** [test-login-tables] --- src/login/logind-dbus.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/login/logind.c | 40 ---------------------------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git src/login/logind-dbus.c src/login/logind-dbus.c index c5f9cb3..2ef87f7 100644 --- src/login/logind-dbus.c +++ src/login/logind-dbus.c @@ -1305,6 +1305,46 @@ static int bus_manager_log_shutdown( q, NULL); } +static int lid_switch_ignore_handler(sd_event_source *e, uint64_t usec, void *userdata) { + Manager *m = userdata; + + assert(e); + assert(m); + + m->lid_switch_ignore_event_source = sd_event_source_unref(m->lid_switch_ignore_event_source); + return 0; +} + +int manager_set_lid_switch_ignore(Manager *m, usec_t until) { + int r; + + assert(m); + + if (until <= now(CLOCK_MONOTONIC)) + return 0; + + /* We want to ignore the lid switch for a while after each + * suspend, and after boot-up. Hence let's install a timer for + * this. As long as the event source exists we ignore the lid + * switch. */ + + if (m->lid_switch_ignore_event_source) { + usec_t u; + + r = sd_event_source_get_time(m->lid_switch_ignore_event_source, &u); + if (r < 0) + return r; + + if (until <= u) + return 0; + + r = sd_event_source_set_time(m->lid_switch_ignore_event_source, until); + } else + r = sd_event_add_monotonic(m->event, &m->lid_switch_ignore_event_source, until, 0, lid_switch_ignore_handler, m); + + return r; +} + static int execute_shutdown_or_sleep( Manager *m, InhibitWhat w, diff --git src/login/logind.c src/login/logind.c index 03b7753..2d734ff 100644 --- src/login/logind.c +++ src/login/logind.c @@ -962,46 +962,6 @@ static int manager_dispatch_idle_action(sd_event_source *s, uint64_t t, void *us return 0; } -static int lid_switch_ignore_handler(sd_event_source *e, uint64_t usec, void *userdata) { - Manager *m = userdata; - - assert(e); - assert(m); - - m->lid_switch_ignore_event_source = sd_event_source_unref(m->lid_switch_ignore_event_source); - return 0; -} - -int manager_set_lid_switch_ignore(Manager *m, usec_t until) { - int r; - - assert(m); - - if (until <= now(CLOCK_MONOTONIC)) - return 0; - - /* We want to ignore the lid switch for a while after each - * suspend, and after boot-up. Hence let's install a timer for - * this. As long as the event source exists we ignore the lid - * switch. */ - - if (m->lid_switch_ignore_event_source) { - usec_t u; - - r = sd_event_source_get_time(m->lid_switch_ignore_event_source, &u); - if (r < 0) - return r; - - if (until <= u) - return 0; - - r = sd_event_source_set_time(m->lid_switch_ignore_event_source, until); - } else - r = sd_event_add_monotonic(m->event, &m->lid_switch_ignore_event_source, until, 0, lid_switch_ignore_handler, m); - - return r; -} - int manager_startup(Manager *m) { int r; Seat *seat; -- 1.7.9.2 ++++++ 0005-man-fix-path-in-crypttab-5.patch ++++++
From 9fcdf32294e66f91d2a177f73a77049832768311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Mon, 23 Jun 2014 23:07:53 -0400 Subject: [PATCH] man: fix path in crypttab(5)
https://bugs.freedesktop.org/show_bug.cgi?id=75816 --- man/crypttab.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git man/crypttab.xml man/crypttab.xml index 668e51d..9030015 100644 --- man/crypttab.xml +++ man/crypttab.xml @@ -369,7 +369,7 @@ <programlisting>luks UUID=2505567a-9e27-4efe-a4d5-15ad146c258b swap /dev/sda7 /dev/urandom swap truecrypt /dev/sda2 /etc/container_password tcrypt -hidden /mnt/tc_hidden /null tcrypt-hidden,tcrypt-keyfile=/etc/keyfile</programlisting> +hidden /mnt/tc_hidden /dev/null tcrypt-hidden,tcrypt-keyfile=/etc/keyfile</programlisting> </example> </refsect1> -- 1.7.9.2 ++++++ 0005-nspawn-block-open_by_handle_at-and-others-via-seccom.patch ++++++
From 28650077f36466d9c5ee27ef2006fae3171a2430 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 30 Jun 2014 16:22:12 +0200 Subject: [PATCH] nspawn: block open_by_handle_at() and others via seccomp
Let's protect ourselves against the recently reported docker security issue. Our man page makes clear that we do not make any security promises anyway, but well, this one is easy to mitigate, so let's do it. While we are at it block a couple of more syscalls that are no good in containers, too. --- src/nspawn/nspawn.c | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git src/nspawn/nspawn.c src/nspawn/nspawn.c index fd61d07..656c1bf 100644 --- src/nspawn/nspawn.c +++ src/nspawn/nspawn.c @@ -1864,22 +1864,25 @@ static int setup_macvlan(pid_t pid) { return 0; } -static int audit_still_doesnt_work_in_containers(void) { +static int setup_seccomp(void) { #ifdef HAVE_SECCOMP + static const int blacklist[] = { + SCMP_SYS(kexec_load), + SCMP_SYS(open_by_handle_at), + SCMP_SYS(init_module), + SCMP_SYS(finit_module), + SCMP_SYS(delete_module), + SCMP_SYS(iopl), + SCMP_SYS(ioperm), + SCMP_SYS(swapon), + SCMP_SYS(swapoff), + }; + scmp_filter_ctx seccomp; + unsigned i; int r; - /* - Audit is broken in containers, much of the userspace audit - hookup will fail if running inside a container. We don't - care and just turn off creation of audit sockets. - - This will make socket(AF_NETLINK, *, NETLINK_AUDIT) fail - with EAFNOSUPPORT which audit userspace uses as indication - that audit is disabled in the kernel. - */ - seccomp = seccomp_init(SCMP_ACT_ALLOW); if (!seccomp) return log_oom(); @@ -1890,6 +1893,26 @@ static int audit_still_doesnt_work_in_containers(void) { goto finish; } + for (i = 0; i < ELEMENTSOF(blacklist); i++) { + r = seccomp_rule_add(seccomp, SCMP_ACT_ERRNO(EPERM), blacklist[i], 0); + if (r == -EFAULT) + continue; /* unknown syscall */ + if (r < 0) { + log_error("Failed to block syscall: %s", strerror(-r)); + goto finish; + } + } + + /* + Audit is broken in containers, much of the userspace audit + hookup will fail if running inside a container. We don't + care and just turn off creation of audit sockets. + + This will make socket(AF_NETLINK, *, NETLINK_AUDIT) fail + with EAFNOSUPPORT which audit userspace uses as indication + that audit is disabled in the kernel. + */ + r = seccomp_rule_add( seccomp, SCMP_ACT_ERRNO(EAFNOSUPPORT), @@ -3050,7 +3073,7 @@ int main(int argc, char *argv[]) { dev_setup(arg_directory); - if (audit_still_doesnt_work_in_containers() < 0) + if (setup_seccomp() < 0) goto child_fail; if (setup_dev_console(arg_directory, console) < 0) -- 1.7.9.2 ++++++ 0005-po-add-Greek-translation.patch ++++++
From 3d89c35c2ae08c3fbf1a037c4df54c8e5ae56faf Mon Sep 17 00:00:00 2001 From: Dimitris Spingos <dmtrs32@gmail.com> Date: Wed, 7 May 2014 18:27:02 +0200 Subject: [PATCH] po: add Greek translation
https://bugs.freedesktop.org/show_bug.cgi?id=78064 --- po/LINGUAS | 3 +- po/el.po | 404 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 406 insertions(+), 1 deletion(-) create mode 100644 po/el.po diff --git po/LINGUAS po/LINGUAS index 0301751..820ca82 100644 --- po/LINGUAS +++ po/LINGUAS @@ -1,4 +1,5 @@ +el fr +it pl ru -it diff --git po/el.po po/el.po new file mode 100644 index 0000000..1570565 --- /dev/null +++ po/el.po @@ -0,0 +1,404 @@ +# Greek translation for systemd. +# Copyright (C) 2014 systemd's COPYRIGHT HOLDER +# This file is distributed under the same license as the systemd package. +# Dimitris Spingos <dmtrs32@gmail.com>, 2014. +# Dimitris Spingos (Δημήτρης Σπίγγος) <dmtrs32@gmail.com>, 2014. +msgid "" +msgstr "" +"Project-Id-Version: systemd master\n" +"Report-Msgid-Bugs-To: https://bugs.freedesktop.org/enter_bug.cgi?product=sys" +"temd&keywords=I18N+L10N&component=general\n" +"POT-Creation-Date: 2014-04-25 15:51+0000\n" +"PO-Revision-Date: 2014-04-29 09:17+0300\n" +"Last-Translator: Dimitris Spingos (Δημήτρης Σπίγγος) <dmtrs32@gmail.com>\n" +"Language-Team: team@lists.gnome.gr\n" +"Language: el\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Virtaal 0.7.0\n" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1 +msgid "Set host name" +msgstr "Ορισμός ονόματος οικοδεσπότη" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2 +msgid "Authentication is required to set the local host name." +msgstr "Απαιτείται πιστοποίηση για να ορίσετε τοπικά όνομα οικοδεσπότη." + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3 +msgid "Set static host name" +msgstr "Ορισμός στατικού ονόματος οικοδεσπότη" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4 +msgid "" +"Authentication is required to set the statically configured local host name, " +"as well as the pretty host name." +msgstr "" +"Απαιτείται πιστοποίηση για να ορίσετε το στατικά ρυθμισμένο όνομα τοπικού " +"οικοδεσπότη, καθώς και το pretty όνομα οικοδεσπότη." + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5 +msgid "Set machine information" +msgstr "Ορισμός πληροφοριών μηχανής" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6 +msgid "Authentication is required to set local machine information." +msgstr "Απαιτείται πιστοποίηση για να ορίσετε πληροφορίες τοπικής μηχανής." + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:1 +msgid "Set system locale" +msgstr "Ορισμός τοπικών ρυθμίσεων συστήματος" + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:2 +msgid "Authentication is required to set the system locale." +msgstr "" +"Απαιτείται πιστοποίηση για να ορίσετε τις τοπικές ρυθμίσεις του συστήματος." + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:3 +msgid "Set system keyboard settings" +msgstr "Ορισμός ρυθμίσεων πληκτρολογίου συστήματος" + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:4 +msgid "Authentication is required to set the system keyboard settings." +msgstr "" +"Απαιτείται πιστοποίηση για να ορίσετε τις ρυθμίσεις πληκτρολογίου του " +"συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:1 +msgid "Allow applications to inhibit system shutdown" +msgstr "" +"Να επιτρέπεται στις εφαρμογές να αποτρέπουν τον τερματισμό του συστήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:2 +msgid "" +"Authentication is required to allow an application to inhibit system " +"shutdown." +msgstr "" +"Απαιτείται πιστοποίηση για να επιτρέπεται σε μια εφαρμογή να αποτρέψει τον " +"τερματισμό του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:3 +msgid "Allow applications to delay system shutdown" +msgstr "" +"Να επιτρέπεται στις εφαρμογές να καθυστερούν τον τερματισμό του συστήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:4 +msgid "" +"Authentication is required to allow an application to delay system shutdown." +msgstr "" +"Απαιτείται πιστοποίηση για να επιτρέπεται σε μια εφαρμογή να καθυστερήσει " +"τον τερματισμό του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:5 +msgid "Allow applications to inhibit system sleep" +msgstr "Να επιτρέπεται στις εφαρμογές να αποτρέπουν την ύπνωση του συστήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:6 +msgid "" +"Authentication is required to allow an application to inhibit system sleep." +msgstr "" +"Απαιτείται πιστοποίηση για να επιτρέπεται σε μια εφαρμογή να αποτρέψει την " +"ύπνωση του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:7 +msgid "Allow applications to delay system sleep" +msgstr "Να επιτρέπεται στις εφαρμογές να καθυστερούν την ύπνωση του συστήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:8 +msgid "" +"Authentication is required to allow an application to delay system sleep." +msgstr "" +"Απαιτείται πιστοποίηση για να επιτρέπεται σε μια εφαρμογή να καθυστερήσει " +"την ύπνωση του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:9 +msgid "Allow applications to inhibit automatic system suspend" +msgstr "" +"Να επιτρέπεται στις εφαρμογές να αποτρέπουν την αυτόματη αναστολή του " +"συστήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:10 +msgid "" +"Authentication is required to allow an application to inhibit automatic " +"system suspend." +msgstr "" +"Απαιτείται πιστοποίηση για να επιτρέπεται σε μια εφαρμογή να αποτρέψει την " +"αυτόματη αναστολή του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:11 +msgid "Allow applications to inhibit system handling of the power key" +msgstr "" +"Να επιτρέπεται στις εφαρμογές να αποτρέπουν τη διαχείριση του πλήκτρου " +"ενεργοποίησης του συστήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:12 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the power key." +msgstr "" +"Απαιτείται πιστοποίηση για να επιτρέπεται σε μια εφαρμογή να αποτρέψει την " +"διαχείριση του πλήκτρου ενεργοποίησης του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:13 +msgid "Allow applications to inhibit system handling of the suspend key" +msgstr "" +"Να επιτρέπεται στις εφαρμογές να αποτρέπουν τη διαχείριση του πλήκτρου " +"αναστολής του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:14 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the suspend key." +msgstr "" +"Απαιτείται πιστοποίηση για να επιτρέπεται σε μια εφαρμογή να αποτρέψει την " +"διαχείριση του πλήκτρου αναστολής του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:15 +msgid "Allow applications to inhibit system handling of the hibernate key" +msgstr "" +"Να επιτρέπεται στις εφαρμογές να αποτρέπουν τη διαχείριση του πλήκτρου " +"αδρανοποίησης του συστήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:16 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the hibernate key." +msgstr "" +"Απαιτείται πιστοποίηση για να επιτρέπεται σε μια εφαρμογή να αποτρέψει την " +"διαχείριση του πλήκτρου αδρανοποίησης του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:17 +msgid "Allow applications to inhibit system handling of the lid switch" +msgstr "" +"Να επιτρέπεται στις εφαρμογές να αποτρέπουν τη διαχείριση του διακόπτη " +"καλύμματος του συστήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:18 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the lid switch." +msgstr "" +"Απαιτείται πιστοποίηση για να επιτρέπεται σε μια εφαρμογή να αποτρέψει την " +"διαχείριση του διακόπτη καλύμματος του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:19 +msgid "Allow non-logged-in users to run programs" +msgstr "Να επιτρέπεται σε μη συνδεμένους χρήστες να εκτελούν προγράμματα" + +#: ../src/login/org.freedesktop.login1.policy.in.h:20 +msgid "" +"Authentication is required to allow a non-logged-in user to run programs." +msgstr "" +"Απαιτείται πιστοποίηση για να επιτρέπεται σε μη συνδεμένους χρήστες να " +"εκτελούν προγράμματα." + +#: ../src/login/org.freedesktop.login1.policy.in.h:21 +msgid "Allow attaching devices to seats" +msgstr "Να επιτρέπεται η προσάρτηση συσκευών στους σταθμούς εργασίας" + +#: ../src/login/org.freedesktop.login1.policy.in.h:22 +msgid "Authentication is required for attaching a device to a seat." +msgstr "" +"Απαιτείται πιστοποίηση για προσάρτηση μιας συσκευής σε έναν σταθμό εργασίας." + +#: ../src/login/org.freedesktop.login1.policy.in.h:23 +msgid "Flush device to seat attachments" +msgstr "Αφαίρεση συσκευής από προσαρτήσεις σταθμού εργασίας" + +#: ../src/login/org.freedesktop.login1.policy.in.h:24 +msgid "" +"Authentication is required for resetting how devices are attached to seats." +msgstr "" +"Απαιτείται πιστοποίηση για επαναφορά του τρόπου που οι συσκευές προσαρτώνται " +"στους σταθμούς εργασίας." + +#: ../src/login/org.freedesktop.login1.policy.in.h:25 +msgid "Power off the system" +msgstr "Σβήσιμο του συστήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:26 +msgid "Authentication is required for powering off the system." +msgstr "Απαιτείται πιστοποίηση για την σβήσιμο του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:27 +msgid "Power off the system while other users are logged in" +msgstr "Σβήσιμο του συστήματος ενώ άλλοι χρήστες είναι συνδεμένοι" + +#: ../src/login/org.freedesktop.login1.policy.in.h:28 +msgid "" +"Authentication is required for powering off the system while other users are " +"logged in." +msgstr "" +"Απαιτείται πιστοποίηση για σβήσιμο του συστήματος ενώ άλλοι χρήστες είναι " +"συνδεμένοι." + +#: ../src/login/org.freedesktop.login1.policy.in.h:29 +msgid "Power off the system while an application asked to inhibit it" +msgstr "Απενεργοποίηση του συστήματος ενώ μια εφαρμογή ζήτησε να αποτραπεί." + +#: ../src/login/org.freedesktop.login1.policy.in.h:30 +msgid "" +"Authentication is required for powering off the system while an application " +"asked to inhibit it." +msgstr "" +"Απαιτείται πιστοποίηση για απενεργοποίηση του συστήματος ενώ μια εφαρμογή " +"ζήτησε να αποτραπεί." + +#: ../src/login/org.freedesktop.login1.policy.in.h:31 +msgid "Reboot the system" +msgstr "Επανεκκίνηση του συστήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:32 +msgid "Authentication is required for rebooting the system." +msgstr "Απαιτείται πιστοποίηση για επανεκκίνηση του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:33 +msgid "Reboot the system while other users are logged in" +msgstr "Επανεκκίνηση του συστήματος ενώ άλλοι χρήστες είναι συνδεμένοι" + +#: ../src/login/org.freedesktop.login1.policy.in.h:34 +msgid "" +"Authentication is required for rebooting the system while other users are " +"logged in." +msgstr "" +"Απαιτείται πιστοποίηση για επανεκκίνηση του συστήματος ενώ άλλοι χρήστες " +"είναι συνδεμένοι." + +#: ../src/login/org.freedesktop.login1.policy.in.h:35 +msgid "Reboot the system while an application asked to inhibit it" +msgstr "Επανεκκίνηση του συστήματος ενώ μια εφαρμογή ζήτησε να αποτραπεί" + +#: ../src/login/org.freedesktop.login1.policy.in.h:36 +msgid "" +"Authentication is required for rebooting the system while an application " +"asked to inhibit it." +msgstr "" +"Απαιτείται πιστοποίηση για επανεκκίνηση του συστήματος ενώ μια εφαρμογή " +"ζήτησε να αποτραπεί." + +#: ../src/login/org.freedesktop.login1.policy.in.h:37 +msgid "Suspend the system" +msgstr "Αναστολή του συστήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:38 +msgid "Authentication is required for suspending the system." +msgstr "Απαιτείται πιστοποίηση για την αναστολή του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:39 +msgid "Suspend the system while other users are logged in" +msgstr "Αναστολή του συστήματος ενώ άλλοι χρήστες είναι συνδεμένοι" + +#: ../src/login/org.freedesktop.login1.policy.in.h:40 +msgid "" +"Authentication is required for suspending the system while other users are " +"logged in." +msgstr "" +"Απαιτείται πιστοποίηση για αναστολή του συστήματος ενώ άλλοι χρήστες είναι " +"συνδεμένοι." + +#: ../src/login/org.freedesktop.login1.policy.in.h:41 +msgid "Suspend the system while an application asked to inhibit it" +msgstr "Αναστολή του συστήματος ενώ μια εφαρμογή ζήτησε να αποτραπεί" + +#: ../src/login/org.freedesktop.login1.policy.in.h:42 +msgid "" +"Authentication is required for suspending the system while an application " +"asked to inhibit it." +msgstr "" +"Απαιτείται πιστοποίηση για αναστολή του συστήματος ενώ μια εφαρμογή ζήτησε " +"να αποτραπεί." + +#: ../src/login/org.freedesktop.login1.policy.in.h:43 +msgid "Hibernate the system" +msgstr "Αδρανοποίηση του συτήματος" + +#: ../src/login/org.freedesktop.login1.policy.in.h:44 +msgid "Authentication is required for hibernating the system." +msgstr "Απαιτείται πιστοποίηση για αδρανοποίηση του συστήματος." + +#: ../src/login/org.freedesktop.login1.policy.in.h:45 +msgid "Hibernate the system while other users are logged in" +msgstr "Αδρανοποίηση του συστήματος ενώ άλλοι χρήστες είναι συνδεμένοι" + +#: ../src/login/org.freedesktop.login1.policy.in.h:46 +msgid "" +"Authentication is required for hibernating the system while other users are " +"logged in." +msgstr "" +"Απαιτείται πιστοποίηση για αδρανοποίηση του συστήματος ενώ άλλοι χρήστες " +"είναι συνδεμένοι." + +#: ../src/login/org.freedesktop.login1.policy.in.h:47 +msgid "Hibernate the system while an application asked to inhibit it" +msgstr "Αδρανοποίηση του συστήματος ενώ μια εφαρμογή ζήτησε να αποτραπεί" + +#: ../src/login/org.freedesktop.login1.policy.in.h:48 +msgid "" +"Authentication is required for hibernating the system while an application " +"asked to inhibit it." +msgstr "" +"Απαιτείται πιστοποίηση για αδρανοποίηση του συστήματος ενώ μια εφαρμογή " +"ζήτησε να αποτραπεί." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1 +msgid "Set system time" +msgstr "Ορισμός ώρας συστήματος" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:2 +msgid "Authentication is required to set the system time." +msgstr "Απαιτείται πιστοποίηση για να ορίσετε την ώρα του συστήματος." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:3 +msgid "Set system timezone" +msgstr "Ορισμός ζώνης ώρας συστήματος" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:4 +msgid "Authentication is required to set the system timezone." +msgstr "Απαιτείται πιστοποίηση για να ορίσετε την ώρα ζώνης του συστήματος." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:5 +msgid "Set RTC to local timezone or UTC" +msgstr "Ορισμός RTC στην τοπική ζώνη ώρας ή UTC" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:6 +msgid "" +"Authentication is required to control whether the RTC stores the local or " +"UTC time." +msgstr "" +"Απαιτείται πιστοποίηση για να ελέγξετε αν το RTC αποθηκεύει την τοπική ή την " +"ώρα UTC." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:7 +msgid "Turn network time synchronization on or off" +msgstr "Ενεργοποίηση/Απενεργοποίηση συγχρονισμού ώρας δικτύου" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:8 +msgid "" +"Authentication is required to control whether network time synchronization " +"shall be enabled." +msgstr "" +"Απαιτείται πιστοποίηση για να ελέγξετε αν ο συγχρονισμός ώρας δικτύου θα " +"ενεργοποιηθεί." + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1 +msgid "Send passphrase back to system" +msgstr "Αποστολή του συνθηματικού πίσω στο σύστημα" + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:2 +msgid "" +"Authentication is required to send the entered passphrase back to the system." +msgstr "" +"Απαιτείται πιστοποίηση για αποστολή του εισερχόμενου συνθηματικού πίσω στο " +"σύστημα." + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3 +msgid "Privileged system and service manager access" +msgstr "Προνομιούχος πρόσβαση διαχειριστή συστήματος και υπηρεσίας" + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4 +msgid "Authentication is required to access the system and service manager." +msgstr "" +"Απαιτείται πιστοποίηση για να προσπελάσετε τον διαχειριστή συστήματος και " +"υπηρεσιών." -- 1.7.9.2 ++++++ 0005-sd-daemon-fix-incorrect-variable-access.patch ++++++
From 56dc9aec21ab23f76fadf45585adf88e71aa8078 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 24 Mar 2014 23:54:14 +0100 Subject: [PATCH] sd-daemon: fix incorrect variable access
--- src/libsystemd/sd-daemon/sd-daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/libsystemd/sd-daemon/sd-daemon.c src/libsystemd/sd-daemon/sd-daemon.c index 21fb346..b013438 100644 --- src/libsystemd/sd-daemon/sd-daemon.c +++ src/libsystemd/sd-daemon/sd-daemon.c @@ -517,7 +517,7 @@ _public_ int sd_watchdog_enabled(int unset_environment, uint64_t *usec) { r = -errno; goto finish; } - if (!p || p == e || *p || l <= 0) { + if (!p || p == e || *p || ll <= 0) { r = -EINVAL; goto finish; } -- 1.7.9.2 ++++++ 0005-sd-id128-do-stricter-checking-of-random-boot-id.patch ++++++
From cef3566998fcae6936d781e678c309950a8a5787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 3 Oct 2014 20:57:30 -0400 Subject: [PATCH] sd-id128: do stricter checking of random boot id
If we are bothering to check whether the kernel is not feeding us bad data, we might as well do it properly. CID #1237692. --- src/libsystemd/sd-id128/sd-id128.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git src/libsystemd/sd-id128/sd-id128.c src/libsystemd/sd-id128/sd-id128.c index a1e44e6..233ffa0 100644 --- src/libsystemd/sd-id128/sd-id128.c +++ src/libsystemd/sd-id128/sd-id128.c @@ -183,11 +183,14 @@ _public_ int sd_id128_get_boot(sd_id128_t *ret) { for (j = 0, p = buf; j < 16; j++) { int a, b; - if (p >= buf + k) + if (p >= buf + k - 1) return -EIO; - if (*p == '-') + if (*p == '-') { p++; + if (p >= buf + k - 1) + return -EIO; + } a = unhexchar(p[0]); b = unhexchar(p[1]); -- 1.7.9.2 ++++++ 0005-sd-resolve-fix-allocation-if-query-ids-never-reuse-t.patch ++++++ Based on 85529c815b47c22839e0f148af67fd37e977cbfa Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 12 Aug 2014 19:29:27 +0200 Subject: [PATCH] sd-resolve: fix allocation if query ids, never reuse them --- src/libsystemd/sd-resolve/sd-resolve.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) --- src/libsystemd/sd-resolve/sd-resolve.c +++ src/libsystemd/sd-resolve/sd-resolve.c 2014-08-22 14:18:24.838235343 +0000 @@ -81,7 +81,7 @@ struct sd_resolve { pthread_t workers[WORKERS_MAX]; unsigned n_valid_workers; - unsigned current_id, current_index; + unsigned current_id; sd_resolve_query* queries[QUERIES_MAX]; unsigned n_queries; @@ -892,21 +892,17 @@ static int alloc_query(sd_resolve *resol if (r < 0) return r; - while (resolve->queries[resolve->current_index]) { - resolve->current_index++; + while (resolve->queries[resolve->current_id % QUERIES_MAX]) resolve->current_id++; - resolve->current_index %= QUERIES_MAX; - } - - q = resolve->queries[resolve->current_index] = new0(sd_resolve_query, 1); + q = resolve->queries[resolve->current_id % QUERIES_MAX] = new0(sd_resolve_query, 1); if (!q) return -ENOMEM; resolve->n_queries++; q->resolve = resolve; - q->id = resolve->current_id; + q->id = resolve->current_id++; *_q = q; return 0; ++++++ 0005-service-don-t-accept-negative-ERRNO-notification-mes.patch ++++++
From 2040ccf171404b709acb0ecf1d1f17b87c5d05f0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 7 Jul 2014 17:32:44 +0200 Subject: [PATCH] service: don't accept negative ERRNO= notification messages
--- src/core/service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/core/service.c src/core/service.c index 5c54a34..d5aff99 100644 --- src/core/service.c +++ src/core/service.c @@ -2637,7 +2637,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) { if (e) { int status_errno; - if (safe_atoi(e + 6, &status_errno) < 0) + if (safe_atoi(e + 6, &status_errno) < 0 || status_errno < 0) log_warning_unit(u->id, "Failed to parse ERRNO= field in notification message: %s", e); else { log_debug_unit(u->id, "%s: got %s", u->id, e); -- 1.7.9.2 ++++++ 0005-shared-label.h-add-missing-stdio.h-include.patch ++++++
From 45f15021e3524b04d574b9ff4e801cb3219daf3f Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing <systemd@esmil.dk> Date: Thu, 18 Sep 2014 15:24:42 +0200 Subject: [PATCH] shared/label.h: add missing stdio.h include
--- src/shared/label.h | 1 + 1 file changed, 1 insertion(+) diff --git src/shared/label.h src/shared/label.h index 7294820..cb2ec79 100644 --- src/shared/label.h +++ src/shared/label.h @@ -24,6 +24,7 @@ #include <sys/types.h> #include <stdbool.h> #include <sys/socket.h> +#include <stdio.h> int label_init(const char *prefix); void label_finish(void); -- 1.7.9.2 ++++++ 0005-systemd-python-fix-failing-assert.patch ++++++
From b65f24238b0627143916a9c7f8315483a9666676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 5 Apr 2014 13:29:50 -0400 Subject: [PATCH] systemd-python: fix failing assert
A parameter which was always null before, now get's set to the module. --- src/python-systemd/_reader.c | 1 - 1 file changed, 1 deletion(-) diff --git src/python-systemd/_reader.c src/python-systemd/_reader.c index 059b904..9a19a10 100644 --- src/python-systemd/_reader.c +++ src/python-systemd/_reader.c @@ -902,7 +902,6 @@ static PyObject* get_catalog(PyObject *self, PyObject *args) { sd_id128_t id; _cleanup_free_ char *msg = NULL; - assert(!self); assert(args); if (!PyArg_ParseTuple(args, "z:get_catalog", &id_)) -- 1.7.9.2 ++++++ 0005-systemd-run-add-some-extra-safety-checks.patch ++++++
From 1ac67edb7c4d31a287fa98c0b554ae98bd34e71b Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 5 Mar 2014 03:38:36 +0100 Subject: [PATCH] systemd-run: add some extra safety checks
--- src/run/run.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git src/run/run.c src/run/run.c index 81763c9..e71ca7d 100644 --- src/run/run.c +++ src/run/run.c @@ -37,7 +37,7 @@ static const char *arg_description = NULL; static const char *arg_slice = NULL; static bool arg_send_sighup = false; static BusTransport arg_transport = BUS_TRANSPORT_LOCAL; -static char *arg_host = NULL; +static const char *arg_host = NULL; static bool arg_user = false; static const char *arg_service_type = NULL; static const char *arg_exec_user = NULL; @@ -186,7 +186,7 @@ static int parse_argv(int argc, char *argv[]) { case ARG_NICE: r = safe_atoi(optarg, &arg_nice); - if (r < 0) { + if (r < 0 || arg_nice < PRIO_MIN || arg_nice >= PRIO_MAX) { log_error("Failed to parse nice value"); return -EINVAL; } -- 1.7.9.2 ++++++ 0005-units-order-sd-journal-flush-after-sd-remount-fs.patch ++++++ Based on 1f1926aa5e836caa3bd6df43704aecd606135103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sun, 2 Nov 2014 21:45:42 -0500 Subject: [PATCH] units: order sd-journal-flush after sd-remount-fs Otherwise we could attempt to flush the journal while /var/log/ was still ro, and silently skip journal flushing. The way that errors in flushing are handled should still be changed to be more transparent and robust. Based on 919699ec301ea507edce4a619141ed22e789ac0d Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 31 Oct 2014 16:22:36 +0100 Subject: [PATCH] units: don't order journal flushing afte remote-fs.target Instead, only depend on the actual file systems we need. This should solve dep loops on setups where remote-fs.target is moved into late boot. --- units/systemd-journal-flush.service.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- units/systemd-journal-flush.service.in +++ units/systemd-journal-flush.service.in 2014-11-10 11:46:22.885518923 +0000 @@ -10,8 +10,9 @@ Description=Trigger Flushing of Journal Documentation=man:systemd-journald.service(8) man:journald.conf(5) DefaultDependencies=no Requires=systemd-journald.service -After=systemd-journald.service local-fs.target remote-fs.target -Before=systemd-user-sessions.service +After=systemd-journald.service local-fs.target +After=systemd-remount-fs.service +Before=systemd-user-sessions.service systemd-tmpfiles-setup.service [Service] ExecStart=@rootbindir@/systemctl kill --kill-who=main --signal=SIGUSR1 systemd-journald.service ++++++ 0005-util-avoid-double-close-of-fd.patch ++++++ Based on 6f53e671aa7539cab02c9f739d84d28a343ca5bc Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Wed, 8 Oct 2014 23:57:32 +0200 Subject: [PATCH] util: avoid double close of fd We could end with a double close if we close the fd loop and flush_fd fails. That would make us goto fail and there we close the fd once again. This patch sets the fd to the return value for safe_close: -1 A fd with negative value will be ignored by the next call to safe_close. CID#996223 --- src/shared/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- src/shared/util.c +++ src/shared/util.c 2014-10-14 15:42:22.515839157 +0000 @@ -1969,7 +1969,8 @@ int acquire_terminal( * ended our handle will be dead. It's important that * we do this after sleeping, so that we don't enter * an endless loop. */ - close_nointr_nofail(fd); + if (fd >= 0) close_nointr_nofail(fd); + fd = -1; } if (notify >= 0) ++++++ 0006-Do-not-return-1-EINVAL-on-allocation-error.patch ++++++
From 315db1a8aed226a51a4cf700172249cfd10ae115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 14 Mar 2014 09:05:56 -0400 Subject: [PATCH] Do not return -1 (EINVAL) on allocation error
--- src/core/socket.c | 8 +++----- diff --git src/core/socket.c src/core/socket.c index 8ecc9f9..b39bec2 100644 --- src/core/socket.c +++ src/core/socket.c @@ -198,16 +198,14 @@ static int socket_instantiate_service(Socket *s) { assert(s->accept); - if (!(prefix = unit_name_to_prefix(UNIT(s)->id))) + prefix = unit_name_to_prefix(UNIT(s)->id); + if (!prefix) return -ENOMEM; - r = asprintf(&name, "%s@%u.service", prefix, s->n_accepted); - - if (r < 0) + if (asprintf(&name, "%s@%u.service", prefix, s->n_accepted) < 0) return -ENOMEM; r = manager_load_unit(UNIT(s)->manager, name, NULL, NULL, &u); - if (r < 0) return r; -- 1.7.9.2 ++++++ 0006-Revert-back-to-var-run-at-a-couple-of-problems.patch ++++++
From df1e02046144f41176c32ed011369fd8dba36b76 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 26 Feb 2014 02:47:43 +0100 Subject: [PATCH] Revert back to /var/run at a couple of problems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
This partially reverts 41a55c46ab8fb4ef6727434227071321fc762cce Some specifications we want to stay compatibility actually document /var/run, not /run, and we should stay compatible with that. In order to make sure our D-Bus implementation works on any system, regardless if running systemd or not, we should always use /var/run which is the only path mandated by the D-Bus spec. Similar, glibc hardcodes the utmp location to /var/run, and this is exposed in _UTMP_PATH in limits.h, hence let's stay in sync with this public API, too. We simply do not support systems where /var/run is not a symlink → /run. Hence both are equivalent. Staying compatible with upstream specifications hence weighs more than cleaning up superficial appearance. --- man/runlevel.xml | 2 +- src/libsystemd/sd-bus/sd-bus.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git man/runlevel.xml man/runlevel.xml index 4db06dc..976753a 100644 --- man/runlevel.xml +++ man/runlevel.xml @@ -124,7 +124,7 @@ <variablelist> <varlistentry> - <term><filename>/run/utmp</filename></term> + <term><filename>/var/run/utmp</filename></term> <listitem><para>The utmp database <command>runlevel</command> reads the diff --git src/libsystemd/sd-bus/sd-bus.c src/libsystemd/sd-bus/sd-bus.c index 1318272..636715f 100644 --- src/libsystemd/sd-bus/sd-bus.c +++ src/libsystemd/sd-bus/sd-bus.c @@ -794,8 +794,8 @@ static int parse_container_unix_address(sd_bus *b, const char **p, char **guid) machine = NULL; b->sockaddr.un.sun_family = AF_UNIX; - strncpy(b->sockaddr.un.sun_path, "/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path)); - b->sockaddr_size = offsetof(struct sockaddr_un, sun_path) + strlen("/run/dbus/system_bus_socket"); + strncpy(b->sockaddr.un.sun_path, "/var/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path)); + b->sockaddr_size = offsetof(struct sockaddr_un, sun_path) + strlen("/var/run/dbus/system_bus_socket"); return 0; } -- 1.7.9.2 ++++++ 0006-bus-unref-buscreds-on-failure.patch ++++++
From 2b347169b9046ff2d735ef23e62a8c74f5151600 Mon Sep 17 00:00:00 2001 From: Philippe De Swert <philippedeswert@gmail.com> Date: Wed, 10 Sep 2014 12:20:42 +0300 Subject: [PATCH] bus: unref buscreds on failure
Actually unref the buscreds when we are not going to return a pointer to them. As when bus_creds_add_more fails we immediately return the error code otherwise and leak the new buscreds. Found with coverity. Fixes: CID#1237761 --- src/libsystemd/sd-bus/sd-bus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git src/libsystemd/sd-bus/sd-bus.c src/libsystemd/sd-bus/sd-bus.c index 78e91b9..83b3aa1 100644 --- src/libsystemd/sd-bus/sd-bus.c +++ src/libsystemd/sd-bus/sd-bus.c @@ -3339,8 +3339,10 @@ _public_ int sd_bus_get_peer_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **re } r = bus_creds_add_more(c, mask, pid, 0); - if (r < 0) + if (r < 0) { + sd_bus_creds_unref(c); return r; + } *ret = c; return 0; -- 1.7.9.2 ++++++ 0006-calendarspec-fix-typo-in-annually.patch ++++++
From e90efc70900f8e69cfbafd9e9508bdeb4d40dad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 25 Oct 2014 11:59:36 -0400 Subject: [PATCH] calendarspec: fix typo in "annually"
https://bugs.freedesktop.org/show_bug.cgi?id=85447 --- src/shared/calendarspec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git src/shared/calendarspec.c src/shared/calendarspec.c index 4ac74ab..64d0dec 100644 --- src/shared/calendarspec.c +++ src/shared/calendarspec.c @@ -688,7 +688,8 @@ int calendar_spec_from_string(const char *p, CalendarSpec **spec) { if (r < 0) goto fail; - } else if (strcaseeq(p, "anually") || strcaseeq(p, "yearly")) { + } else if (strcaseeq(p, "annually") || strcaseeq(p, "yearly") + || strcaseeq(p, "anually") /* backwards compatibility */ ) { r = const_chain(1, &c->month); if (r < 0) goto fail; -- 1.7.9.2 ++++++ 0006-hwdb-Update-database-of-Bluetooth-company-identifier.patch ++++++
From 7cfa80f07e94c3e48703d145ef03a73dd6e7b983 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann <marcel@holtmann.org> Date: Wed, 18 Jun 2014 13:55:32 +0200 Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
--- hwdb/20-bluetooth-vendor-product.hwdb | 42 ++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git hwdb/20-bluetooth-vendor-product.hwdb hwdb/20-bluetooth-vendor-product.hwdb index a65c7db..377748a 100644 --- hwdb/20-bluetooth-vendor-product.hwdb +++ hwdb/20-bluetooth-vendor-product.hwdb @@ -115,7 +115,7 @@ bluetooth:v0024* ID_VENDOR_FROM_DATABASE=Alcatel bluetooth:v0025* - ID_VENDOR_FROM_DATABASE=Philips Semiconductors + ID_VENDOR_FROM_DATABASE=NXP Semiconductors (formerly Philips Semiconductors) bluetooth:v0026* ID_VENDOR_FROM_DATABASE=C Technologies @@ -427,7 +427,7 @@ bluetooth:v008B* ID_VENDOR_FROM_DATABASE=Topcorn Positioning Systems, LLC bluetooth:v008C* - ID_VENDOR_FROM_DATABASE=Qualcomm Retail Solutions, Inc. (formerly Qualcomm Labs, Inc.) + ID_VENDOR_FROM_DATABASE=Gimbal Inc. (formerly Qualcomm Labs, Inc. and Qualcomm Retail Solutions, Inc.) bluetooth:v008D* ID_VENDOR_FROM_DATABASE=Zscan Software @@ -1006,10 +1006,46 @@ bluetooth:v014C* ID_VENDOR_FROM_DATABASE=Mesh-Net Ltd bluetooth:v014D* - ID_VENDOR_FROM_DATABASE=HUIZHOU DESAY SV AUTOMOTIVE CO., LTD. + ID_VENDOR_FROM_DATABASE=Huizhou Desay SV Automotive CO., LTD. bluetooth:v014E* ID_VENDOR_FROM_DATABASE=Tangerine, Inc. bluetooth:v014F* ID_VENDOR_FROM_DATABASE=B&W Group Ltd. + +bluetooth:v0150* + ID_VENDOR_FROM_DATABASE=Pioneer Corporation + +bluetooth:v0151* + ID_VENDOR_FROM_DATABASE=OnBeep + +bluetooth:v0152* + ID_VENDOR_FROM_DATABASE=Vernier Software & Technology + +bluetooth:v0153* + ID_VENDOR_FROM_DATABASE=ROL Ergo + +bluetooth:v0154* + ID_VENDOR_FROM_DATABASE=Pebble Technology + +bluetooth:v0155* + ID_VENDOR_FROM_DATABASE=NETATMO + +bluetooth:v0156* + ID_VENDOR_FROM_DATABASE=Accumulate AB + +bluetooth:v0157* + ID_VENDOR_FROM_DATABASE=Anhui Huami Information Technology Co., Ltd. + +bluetooth:v0158* + ID_VENDOR_FROM_DATABASE=Inmite s.r.o. + +bluetooth:v0159* + ID_VENDOR_FROM_DATABASE=ChefSteps, Inc. + +bluetooth:v015A* + ID_VENDOR_FROM_DATABASE=micus AG + +bluetooth:v015B* + ID_VENDOR_FROM_DATABASE=Biomedical Research Ltd. -- 1.7.9.2 ++++++ 0006-hwdb-update.patch ++++++ ++++ 4392 lines (skipped) ++++++ 0006-journal-assume-that-next-entry-is-after-previous-ent.patch ++++++
From fb099c8d2af6620db2709e826a258089d10cdfe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Thu, 27 Feb 2014 00:07:29 -0500 Subject: [PATCH] journal: assume that next entry is after previous entry
With a corrupted file, we can get in a situation where two entries in the entry array point to the same object. Then journal_file_next_entry will find the first one using generic_arrray_bisect, and try to move to the second one, but since the address is the same, generic_array_get will return the first one. journal_file_next_entry ends up in an infinite loop. https://bugzilla.redhat.com/show_bug.cgi?id=1047039 --- src/journal/journal-file.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git src/journal/journal-file.c src/journal/journal-file.c index 5876733..0e1fc7f 100644 --- src/journal/journal-file.c +++ src/journal/journal-file.c @@ -1359,7 +1359,7 @@ int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const st } typedef struct ChainCacheItem { - uint64_t first; /* the array at the begin of the chain */ + uint64_t first; /* the array at the beginning of the chain */ uint64_t array; /* the cached array */ uint64_t begin; /* the first item in the cached array */ uint64_t total; /* the total number of items in all arrays before this one in the chain */ @@ -1945,7 +1945,7 @@ int journal_file_next_entry( direction_t direction, Object **ret, uint64_t *offset) { - uint64_t i, n; + uint64_t i, n, ofs; int r; assert(f); @@ -1986,10 +1986,24 @@ int journal_file_next_entry( } /* And jump to it */ - return generic_array_get(f, - le64toh(f->header->entry_array_offset), - i, - ret, offset); + r = generic_array_get(f, + le64toh(f->header->entry_array_offset), + i, + ret, &ofs); + if (r <= 0) + return r; + + if (p > 0 && + (direction == DIRECTION_DOWN ? ofs <= p : ofs >= p)) { + log_debug("%s: entry array corrupted at entry %"PRIu64, + f->path, i); + return -EBADMSG; + } + + if (offset) + *offset = ofs; + + return 1; } int journal_file_skip_entry( -- 1.7.9.2 ++++++ 0006-journald-fix-minor-memory-leak.patch ++++++
From 99d0966e75a984bed4f117c888ecc93e16e7b7b6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 3 Nov 2014 21:11:16 +0100 Subject: [PATCH] journald: fix minor memory leak
--- src/journal/journald-server.c | 1 + 1 file changed, 1 insertion(+) diff --git src/journal/journald-server.c src/journal/journald-server.c index e062427..cf6bbcc 100644 --- src/journal/journald-server.c +++ src/journal/journald-server.c @@ -1690,6 +1690,7 @@ void server_done(Server *s) { free(s->buffer); free(s->tty_path); free(s->cgroup_root); + free(s->hostname_field); if (s->mmap) mmap_cache_unref(s->mmap); -- 1.7.9.2 ++++++ 0006-log-honour-the-kernel-s-quiet-cmdline-argument.patch ++++++
From e683212f049ac5d3f95fb17300cfa2fd971f78f3 Mon Sep 17 00:00:00 2001 From: Ronny Chevalier <chevalier.ronny@gmail.com> Date: Tue, 3 Jun 2014 19:44:03 +0200 Subject: [PATCH] log: honour the kernel's quiet cmdline argument
It was forgotten in b1e90ec515408aec2702522f6f68c4920b56375b See https://bugs.freedesktop.org/show_bug.cgi?id=79582 --- src/shared/log.c | 3 +++ 1 file changed, 3 insertions(+) diff --git src/shared/log.c src/shared/log.c index 9039db3..6f17705 100644 --- src/shared/log.c +++ src/shared/log.c @@ -878,6 +878,9 @@ void log_parse_environment(void) { if (l == 5 && startswith(w, "debug")) { log_set_max_level(LOG_DEBUG); break; + } else if (l == 5 && startswith(w, "quiet")) { + log_set_max_level(LOG_WARNING); + break; } } } -- 1.7.9.2 ++++++ 0006-login-add-mir-to-the-list-of-session-types.patch ++++++
From 9541666b8d97f107335dd7e3cb93b4d2cfbf19c9 Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Wed, 9 Apr 2014 21:22:48 +0200 Subject: [PATCH] login: add 'mir' to the list of session types
Add Mir to the list of session types. This is implemented for LightDM in lp:~robert-ancell/lightdm/xdg-session-desktop [1]. [1] https://code.launchpad.net/~robert-ancell/lightdm/xdg-session-desktop/+merge... (david: adjusted commit-header and fixed whitespace issues) --- man/pam_systemd.xml | 5 +++-- man/sd_session_is_active.xml | 6 +++--- src/login/logind-session.c | 1 + src/login/logind-session.h | 1 + src/systemd/sd-login.h | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git man/pam_systemd.xml man/pam_systemd.xml index 3022cdb..f973899 100644 --- man/pam_systemd.xml +++ man/pam_systemd.xml @@ -145,8 +145,9 @@ variable takes precedence. One of <literal>unspecified</literal>, <literal>tty</literal>, - <literal>x11</literal> or - <literal>wayland</literal>. See + <literal>x11</literal>, + <literal>wayland</literal> or + <literal>mir</literal>. See <citerefentry><refentrytitle>sd_session_get_type</refentrytitle><manvolnum>3</manvolnum></citerefentry> for details about the session type.</para></listitem> </varlistentry> diff --git man/sd_session_is_active.xml man/sd_session_is_active.xml index ddb2bee..31a6119 100644 --- man/sd_session_is_active.xml +++ man/sd_session_is_active.xml @@ -201,9 +201,9 @@ be used to determine the type of the session identified by the specified session identifier. The returned string is one of <literal>x11</literal>, - <literal>wayland</literal>, <literal>tty</literal> or - <literal>unspecified</literal> and needs to be freed - with the libc + <literal>wayland</literal>, <literal>tty</literal>, + <literal>mir</literal> or <literal>unspecified</literal> and + needs to be freed with the libc <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry> call after use.</para> --- src/login/logind-session.c +++ src/login/logind-session.c 2014-05-20 12:49:07.150236121 +0000 @@ -1124,6 +1124,7 @@ static const char* const session_type_ta [SESSION_TTY] = "tty", [SESSION_X11] = "x11", [SESSION_WAYLAND] = "wayland", + [SESSION_MIR] = "mir", [SESSION_UNSPECIFIED] = "unspecified", }; diff --git src/login/logind-session.h src/login/logind-session.h index c9af5eb..7ecc9f0 100644 --- src/login/logind-session.h +++ src/login/logind-session.h @@ -55,6 +55,7 @@ typedef enum SessionType { SESSION_TTY, SESSION_X11, SESSION_WAYLAND, + SESSION_MIR, _SESSION_TYPE_MAX, _SESSION_TYPE_INVALID = -1 } SessionType; diff --git src/systemd/sd-login.h src/systemd/sd-login.h index a4ca231..776733a 100644 --- src/systemd/sd-login.h +++ src/systemd/sd-login.h @@ -138,7 +138,7 @@ int sd_session_get_seat(const char *session, char **seat); /* Determine the (PAM) service name this session was registered by. */ int sd_session_get_service(const char *session, char **service); -/* Determine the type of this session, i.e. one of "tty", "x11" or "unspecified". */ +/* Determine the type of this session, i.e. one of "tty", "x11", "wayland", "mir" or "unspecified". */ int sd_session_get_type(const char *session, char **type); /* Determine the class of this session, i.e. one of "user", "greeter" or "lock-screen". */ -- 1.7.9.2 ++++++ 0006-login-share-VT-signal-handler-between-sessions.patch ++++++ Based on 92683ad2e28c79891e4123d9a421b018dc58870c Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Mon, 11 Aug 2014 18:17:54 +0200 Subject: [PATCH] login: share VT-signal handler between sessions sd-event does not allow multiple handlers for a single signal. However, logind sets up signal handlers for each session with VT_PROCESS set (that is, it has an active controller). Therefore, registering multiple such controllers will fail. Lets make the VT-handler global, as it's mostly trivial, anyway. This way, the sessions don't have to take care of that and we can simply acknowledge all VT-switch requests as we always did. --- src/libsystemd/sd-event/sd-event.c | 5 +- src/login/logind-session.c | 26 +------------ src/login/logind-session.h | 1 src/login/logind.c | 70 +++++++++++++++++++++++++++++++++++++ src/shared/util.c | 18 +++++++++ src/shared/util.h | 1 6 files changed, 94 insertions(+), 27 deletions(-) --- src/libsystemd/sd-event/sd-event.c +++ src/libsystemd/sd-event/sd-event.c 2014-08-26 11:02:54.500683967 +0000 @@ -839,7 +839,6 @@ _public_ int sd_event_add_signal( assert_return(sig > 0, -EINVAL); assert_return(sig < _NSIG, -EINVAL); assert_return(callback, -EINVAL); - assert_return(ret, -EINVAL); assert_return(e->state != SD_EVENT_FINISHED, -ESTALE); assert_return(!event_pid_changed(e), -ECHILD); @@ -877,7 +876,9 @@ _public_ int sd_event_add_signal( } } - *ret = s; + if (ret) + *ret = s; + return 0; } --- src/login/logind-session.c +++ src/login/logind-session.c 2014-08-25 17:22:46.000000000 +0000 @@ -153,8 +153,6 @@ void session_free(Session *s) { hashmap_remove(s->manager->sessions, s->id); - s->vt_source = sd_event_source_unref(s->vt_source); - free(s->state_file); free(s); } @@ -966,19 +964,9 @@ static int session_open_vt(Session *s) { return s->vtfd; } -static int session_vt_fn(sd_event_source *source, const struct signalfd_siginfo *si, void *data) { - Session *s = data; - - if (s->vtfd >= 0) - ioctl(s->vtfd, VT_RELDISP, 1); - - return 0; -} - int session_mute_vt(Session *s) { int vt, r; struct vt_mode mode = { 0 }; - sigset_t mask; if (s->vtnr < 1) return 0; @@ -1008,20 +996,12 @@ int session_mute_vt(Session *s) { goto error; } - sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); - sigprocmask(SIG_BLOCK, &mask, NULL); - - r = sd_event_add_signal(s->manager->event, &s->vt_source, SIGUSR1, session_vt_fn, s); - if (r < 0) - goto error; - /* Oh, thanks to the VT layer, VT_AUTO does not work with KD_GRAPHICS. * So we need a dummy handler here which just acknowledges *all* VT * switch requests. */ mode.mode = VT_PROCESS; - mode.relsig = SIGUSR1; - mode.acqsig = SIGUSR1; + mode.relsig = SIGRTMIN; + mode.acqsig = SIGRTMIN + 1; r = ioctl(vt, VT_SETMODE, &mode); if (r < 0) { r = -errno; @@ -1045,8 +1025,6 @@ void session_restore_vt(Session *s) { if (vt < 0) return; - s->vt_source = sd_event_source_unref(s->vt_source); - ioctl(vt, KDSETMODE, KD_TEXT); if (read_one_line_file("/sys/module/vt/parameters/default_utf8", &utf8) >= 0 && *utf8 == '1') --- src/login/logind-session.h +++ src/login/logind-session.h 2014-08-25 00:00:00.000000000 +0000 @@ -98,7 +98,6 @@ struct Session { Seat *seat; unsigned int vtnr; int vtfd; - sd_event_source *vt_source; pid_t leader; uint32_t audit_id; --- src/login/logind.c +++ src/login/logind.c 2014-08-26 11:18:41.422235366 +0000 @@ -25,6 +25,7 @@ #include <string.h> #include <unistd.h> #include <linux/vt.h> +#include <sys/ioctl.h> #include <sys/timerfd.h> #include "sd-daemon.h" @@ -714,6 +715,47 @@ static int manager_connect_bus(Manager * return 0; } +static int manager_vt_switch(sd_event_source *src, const struct signalfd_siginfo *si, void *data) { + Manager *m = data; + Session *active, *iter; + + /* + * We got a VT-switch signal and we have to acknowledge it immediately. + * Preferably, we'd just use m->seat0->active->vtfd, but unfortunately, + * old user-space might run multiple sessions on a single VT, *sigh*. + * Therefore, we have to iterate all sessions and find one with a vtfd + * on the requested VT. + * As only VTs with active controllers have VT_PROCESS set, our current + * notion of the active VT might be wrong (for instance if the switch + * happens while we setup VT_PROCESS). Therefore, read the current VT + * first and then use s->active->vtnr as reference. Note that this is + * not racy, as no further VT-switch can happen as long as we're in + * synchronous VT_PROCESS mode. + */ + + assert(m->seat0); + seat_read_active_vt(m->seat0); + + active = m->seat0->active; + if (!active || active->vtnr < 1) { + log_warning("Received VT_PROCESS signal without a registered session on that VT."); + return 0; + } + + if (active->vtfd >= 0) { + ioctl(active->vtfd, VT_RELDISP, 1); + } else { + LIST_FOREACH(sessions_by_seat, iter, m->seat0->sessions) { + if (iter->vtnr == active->vtnr && iter->vtfd >= 0) { + ioctl(iter->vtfd, VT_RELDISP, 1); + break; + } + } + } + + return 0; +} + static int manager_connect_console(Manager *m) { int r; @@ -744,6 +786,34 @@ static int manager_connect_console(Manag return r; } + /* + * SIGRTMIN is used as global VT-release signal, SIGRTMIN + 1 is used + * as VT-acquire signal. We ignore any acquire-events (yes, we still + * have to provide a valid signal-number for it!) and acknowledge all + * release events immediately. + */ + + if (SIGRTMIN + 1 > SIGRTMAX) { + log_error("Not enough real-time signals available: %u-%u", SIGRTMIN, SIGRTMAX); + return -EINVAL; + } + + r = ignore_signals(SIGRTMIN + 1, -1); + if (r < 0) { + log_error("Cannot ignore SIGRTMIN + 1: %s", strerror(-r)); + return r; + } + + r = sigprocmask_many(SIG_BLOCK, SIGRTMIN, -1); + if (r < 0) { + log_error("Cannot block SIGRTMIN: %s", strerror(-r)); + return r; + } + + r = sd_event_add_signal(m->event, NULL, SIGRTMIN, manager_vt_switch, m); + if (r < 0) + return r; + return 0; } --- src/shared/util.c +++ src/shared/util.c 2014-08-26 10:20:14.000000000 +0000 @@ -2434,6 +2434,24 @@ void sigset_add_many(sigset_t *ss, ...) va_end(ap); } +int sigprocmask_many(int how, ...) { + va_list ap; + sigset_t ss; + int sig; + + assert_se(sigemptyset(&ss) == 0); + + va_start(ap, how); + while ((sig = va_arg(ap, int)) > 0) + assert_se(sigaddset(&ss, sig) == 0); + va_end(ap); + + if (sigprocmask(how, &ss, NULL) < 0) + return -errno; + + return 0; +} + char* gethostname_malloc(void) { struct utsname u; --- src/shared/util.h +++ src/shared/util.h 2014-08-26 10:21:08.000000000 +0000 @@ -390,6 +390,7 @@ char* dirname_malloc(const char *path); void rename_process(const char name[8]); void sigset_add_many(sigset_t *ss, ...); +int sigprocmask_many(int how, ...); bool hostname_is_set(void); ++++++ 0006-man-clarify-that-the-ExecReload-command-should-be-sy.patch ++++++
From 33169701b0640d3629d4c36cf8c71dc26d2cb7e1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 16 May 2014 01:33:22 +0200 Subject: [PATCH] man: clarify that the ExecReload= command should be synchronous
http://lists.freedesktop.org/archives/systemd-devel/2014-May/019054.html --- man/systemd.service.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git man/systemd.service.xml man/systemd.service.xml index af32ccb..364ad7d 100644 --- man/systemd.service.xml +++ man/systemd.service.xml @@ -519,6 +519,20 @@ ExecStart=/bin/echo $ONE $TWO ${TWO}</programlisting> following:</para> <programlisting>/bin/kill -HUP $MAINPID</programlisting> + + <para>Note however that reloading a + daemon by sending a signal (as with + the example line above) is usually not + a good choice, because this is an + asynchronous operation and hence not + suitable to order reloads of multiple + services against each other. It is + strongly recommended to set + <varname>ExecReload=</varname> to a + command that no only triggers a + configuration reload of the daemon, + but also synchronously waits for it + complete.</para> </listitem> </varlistentry> -- 1.7.9.2 ++++++ 0006-parse_boolean-require-exact-matches.patch ++++++
From 0f625d0b87139fc18cd565c9b6da05c53a0eb7ab Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt <ansgar@debian.org> Date: Sun, 27 Jul 2014 15:19:00 +0200 Subject: [PATCH] parse_boolean: require exact matches
Require exact matches in all cases instead of treating strings starting with 't' ('f') as true (false). This is required for config_parse_protect_system to parse ProtectSystem=full correctly: it uses parse_boolean and only tries a more specific parsing function if that did not return a valid result. Thus "full" was treated as "false" before. --- src/shared/util.c | 4 ++-- src/test/test-util.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git src/shared/util.c src/shared/util.c index 4fda31c..49c17ef 100644 --- src/shared/util.c +++ src/shared/util.c @@ -231,9 +231,9 @@ int unlink_noerrno(const char *path) { int parse_boolean(const char *v) { assert(v); - if (streq(v, "1") || v[0] == 'y' || v[0] == 'Y' || v[0] == 't' || v[0] == 'T' || strcaseeq(v, "on")) + if (streq(v, "1") || strcaseeq(v, "yes") || strcaseeq(v, "y") || strcaseeq(v, "true") || strcaseeq(v, "t") || strcaseeq(v, "on")) return 1; - else if (streq(v, "0") || v[0] == 'n' || v[0] == 'N' || v[0] == 'f' || v[0] == 'F' || strcaseeq(v, "off")) + else if (streq(v, "0") || strcaseeq(v, "no") || strcaseeq(v, "n") || strcaseeq(v, "false") || strcaseeq(v, "f") || strcaseeq(v, "off")) return 0; return -EINVAL; diff --git src/test/test-util.c src/test/test-util.c index ed91a67..9a28ef9 100644 --- src/test/test-util.c +++ src/test/test-util.c @@ -129,6 +129,7 @@ static void test_parse_boolean(void) { assert_se(parse_boolean("garbage") < 0); assert_se(parse_boolean("") < 0); + assert_se(parse_boolean("full") < 0); } static void test_parse_pid(void) { -- 1.7.9.2 ++++++ 0006-rules-mark-loop-device-as-SYSTEMD_READY-0-if-no-file.patch ++++++
From ebc54302d7fc70927d5dc119e178ff03f6a911ed Mon Sep 17 00:00:00 2001 From: Peter Rajnoha <prajnoha@redhat.com> Date: Mon, 10 Mar 2014 22:58:14 +0100 Subject: [PATCH] rules: mark loop device as SYSTEMD_READY=0 if no file is attached
Check existence of loop/backing_file in sysfs and mark loop devices with SYSTEMD_READY if missing. Such loop files is uninitialized and it's not ready for use yet (there's no file attached). --- rules/99-systemd.rules.in | 3 +++ 1 file changed, 3 insertions(+) diff --git rules/99-systemd.rules.in rules/99-systemd.rules.in index 021359a..04a59c4 100644 --- rules/99-systemd.rules.in +++ rules/99-systemd.rules.in @@ -22,6 +22,9 @@ SUBSYSTEM=="block", KERNEL!="ram*", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_TABLE_T SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", TEST!="md/array_state", ENV{SYSTEMD_READY}="0" SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0" +# Ignore loop devices that don't have any file attached +SUBSYSTEM=="block", KERNEL=="loop[0-9]*", TEST!="loop/backing_file", ENV{SYSTEMD_READY}="0" + # Ignore nbd devices in the "add" event, with "change" the nbd is ready ACTION=="add", SUBSYSTEM=="block", KERNEL=="nbd*", ENV{SYSTEMD_READY}="0" -- 1.7.9.2 ++++++ 0006-sd-event-initialization-perturbation-value-right-bef.patch ++++++
From 52444dc478fe38b5b69a771923ab429a41927aa5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 24 Mar 2014 23:54:21 +0100 Subject: [PATCH] sd-event: initialization perturbation value right before we use it
That way, we don't forget to initialize it when the watchdog is initialized before all event sources. --- src/libsystemd/sd-event/sd-event.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) --- src/libsystemd/sd-event/sd-event.c +++ src/libsystemd/sd-event/sd-event.c 2014-03-28 12:44:05.652327044 +0000 @@ -648,13 +648,31 @@ _public_ int sd_event_add_io( return 0; } +static void initialize_perturb(sd_event *e) { + sd_id128_t bootid = {}; + + /* When we sleep for longer, we try to realign the wakeup to + the same time wihtin each minute/second/250ms, so that + events all across the system can be coalesced into a single + CPU wakeup. However, let's take some system-specific + randomness for this value, so that in a network of systems + with synced clocks timer events are distributed a + bit. Here, we calculate a perturbation usec offset from the + boot ID. */ + + if (_likely_(e->perturb != (usec_t) -1)) + return; + + if (sd_id128_get_boot(&bootid) >= 0) + e->perturb = (bootid.qwords[0] ^ bootid.qwords[1]) % USEC_PER_MINUTE; +} + static int event_setup_timer_fd( sd_event *e, EventSourceType type, int *timer_fd, clockid_t id) { - sd_id128_t bootid = {}; struct epoll_event ev = {}; int r, fd; @@ -677,18 +695,6 @@ static int event_setup_timer_fd( return -errno; } - /* When we sleep for longer, we try to realign the wakeup to - the same time wihtin each minute/second/250ms, so that - events all across the system can be coalesced into a single - CPU wakeup. However, let's take some system-specific - randomness for this value, so that in a network of systems - with synced clocks timer events are distributed a - bit. Here, we calculate a perturbation usec offset from the - boot ID. */ - - if (sd_id128_get_boot(&bootid) >= 0) - e->perturb = (bootid.qwords[0] ^ bootid.qwords[1]) % USEC_PER_MINUTE; - *timer_fd = fd; return 0; } @@ -1506,6 +1512,8 @@ static usec_t sleep_between(sd_event *e, if (b <= a + 1) return a; + initialize_perturb(e); + /* Find a good time to wake up again between times a and b. We have two goals here: ++++++ 0006-shared-sparse-endian.h-add-missing-byteswap.h-includ.patch ++++++
From 8e8af4cfc7fa373504a22e58966909161acfb72f Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing <systemd@esmil.dk> Date: Thu, 18 Sep 2014 15:24:43 +0200 Subject: [PATCH] shared/sparse-endian.h: add missing byteswap.h include
--- src/shared/sparse-endian.h | 1 + 1 file changed, 1 insertion(+) diff --git src/shared/sparse-endian.h src/shared/sparse-endian.h index eb4dbf3..c913fda 100644 --- src/shared/sparse-endian.h +++ src/shared/sparse-endian.h @@ -21,6 +21,7 @@ #ifndef SPARSE_ENDIAN_H #define SPARSE_ENDIAN_H +#include <byteswap.h> #include <endian.h> #include <stdint.h> -- 1.7.9.2 ++++++ 0006-systemctl-fix-resource-leak-CID-1237747.patch ++++++
From 48a2900c6612052149a1d0dd88aeacb99b49ce4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org> Date: Wed, 17 Sep 2014 21:56:25 -0300 Subject: [PATCH] systemctl: fix resource leak CID #1237747
..by simply moving the declaration of "unit" into the STRV_FOREACH loop as suggested by Andreas. --- src/systemctl/systemctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c index 88be871..9012128 100644 --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c @@ -4449,7 +4449,6 @@ static int show(sd_bus *bus, char **args) { } static int cat(sd_bus *bus, char **args) { - _cleanup_free_ char *unit = NULL; _cleanup_strv_free_ char **names = NULL; char **name; bool first = true; @@ -4468,6 +4467,8 @@ static int cat(sd_bus *bus, char **args) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_strv_free_ char **dropin_paths = NULL; _cleanup_free_ char *fragment_path = NULL; + _cleanup_free_ char *unit = NULL; + char **path; unit = unit_dbus_path_from_name(*name); -- 1.7.9.2 ++++++ 0006-systemctl-show-StatusErrno-value-in-systemctl-status.patch ++++++ Based on b4af5a803aa71a57733ca46fef29b7afb20a626c Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 7 Jul 2014 17:33:26 +0200 Subject: [PATCH] systemctl: show StatusErrno value in "systemctl status" --- src/systemctl/systemctl.c | 5 +++++ 1 file changed, 5 insertions(+) --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c 2014-07-08 10:57:30.170735691 +0000 @@ -2710,6 +2710,7 @@ typedef struct UnitStatusInfo { const char *status_text; const char *pid_file; bool running:1; + int status_errno; usec_t start_timestamp; usec_t exit_timestamp; @@ -2982,6 +2983,8 @@ static void print_status_info( if (i->status_text) printf(" Status: \"%s\"\n", i->status_text); + if (i->status_errno > 0) + printf(" Error: %i (%s)\n", i->status_errno, strerror(i->status_errno)); if (i->control_group && (i->main_pid > 0 || i->control_pid > 0 || cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, i->control_group, false) == 0)) { @@ -3203,6 +3206,8 @@ static int status_property(const char *n i->exit_code = (int) j; else if (streq(name, "ExecMainStatus")) i->exit_status = (int) j; + else if (streq(name, "StatusErrno")) + i->status_errno = (int) j; break; } ++++++ 0006-tmpfiles-don-t-do-automatic-cleanup-in-XDG_RUNTIME_D.patch ++++++ Based on 6fc27667950fe153033f0f49cb5b57e8954c3e54 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 30 Jun 2014 19:06:18 +0200 Subject: [PATCH] tmpfiles: don't do automatic cleanup in $XDG_RUNTIME_DIR Now that logind will clean up all IPC resources of a user we should really consider $XDG_RUNTIME_DIR as just another kind of IPC with the same life-cycle logic as the other IPC resources. This should be safe now to do since every user gets his own $XDG_RUNTIME_DIR tmpfs instance with a fixed size limit, so that flooding of it will more effectively be averted. --- tmpfiles.d/systemd.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- tmpfiles.d/systemd.conf +++ tmpfiles.d/systemd.conf 2014-07-01 12:31:01.858735866 +0000 @@ -7,7 +7,7 @@ # See tmpfiles.d(5) for details -d /run/user 0755 root root ~10d +d /run/user 0755 root root - F! /run/utmp 0664 root utmp - f /var/log/wtmp 0664 root utmp - ++++++ 0006-tty-ask-password-agent-Do-tell-what-directory-we-fai.patch ++++++
From 267b3e41df5a2181f2911433539f81de2fa1511a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org> Date: Thu, 29 May 2014 14:17:37 -0400 Subject: [PATCH] tty-ask-password-agent: Do tell what directory we failed to open
--- .../tty-ask-password-agent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/tty-ask-password-agent/tty-ask-password-agent.c src/tty-ask-password-agent/tty-ask-password-agent.c index 3203474..55a2215 100644 --- src/tty-ask-password-agent/tty-ask-password-agent.c +++ src/tty-ask-password-agent/tty-ask-password-agent.c @@ -501,7 +501,7 @@ static int show_passwords(void) { if (errno == ENOENT) return 0; - log_error("opendir(): %m"); + log_error("opendir(/run/systemd/ask-password): %m"); return -errno; } -- 1.7.9.2 ++++++ 0007-README-document-that-var-run-must-be-a-symlink-run.patch ++++++
From 47bc23c18cbc87471dc832534c8565625e4a9d16 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 26 Feb 2014 02:54:37 +0100 Subject: [PATCH] =?UTF-8?q?README:=20document=20that=20/var/run=20must=20be=20?= =?UTF-8?q?a=20symlink=20=E2=86=92=20/run?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
--- README | 3 +++ 1 file changed, 3 insertions(+) diff --git README README index b918132..7a227e7 100644 --- README +++ README @@ -190,6 +190,9 @@ WARNINGS: about this, since this kind of file system setup is not really supported anymore by the basic set of Linux OS components. + systemd requires that the /run mount point exists. systemd also + requires that /var/run is a a symlink → /run. + For more information on this issue consult http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken -- 1.7.9.2 ++++++ 0007-core-fix-a-potential-mem-leak.patch ++++++ Based on 4d5e13a125cf8d77d432225ab69826caa1d1cf59 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Sat, 13 Sep 2014 12:35:06 +0200 Subject: [PATCH] core: fix a potential mem leak Found with Coverity. Fixes: CID#996438 --- src/core/load-fragment.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- src/core/load-fragment.c +++ src/core/load-fragment.c 2014-09-16 10:35:13.354235607 +0000 @@ -1294,8 +1294,11 @@ int config_parse_timer(const char *unit, } v = new0(TimerValue, 1); - if (!v) + if (!v) { + if (c) + free(c); return log_oom(); + } v->base = b; v->clock_id = id; ++++++ 0007-dbus-suppress-duplicate-and-misleading-messages.patch ++++++
From fe7f06f142cf42928e419d8578afd75bf1439672 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 11 Mar 2014 04:10:19 +0100 Subject: [PATCH] dbus: suppress duplicate and misleading messages
When we try to send a signal on a connection we didn't hae the time to process the Disconnected message yet, don't generate multiple warning messages, but only a single debug message. https://bugs.freedesktop.org/show_bug.cgi?id=75874 --- src/core/dbus-manager.c | 7 +++++-- src/core/dbus-unit.c | 12 ++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git src/core/dbus-manager.c src/core/dbus-manager.c index 34ef1f5..30f28b6 100644 --- src/core/dbus-manager.c +++ src/core/dbus-manager.c @@ -1357,8 +1357,11 @@ static int reply_unit_file_changes_and_f unsigned i; int r; - if (n_changes > 0) - bus_manager_foreach_client(m, send_unit_files_changed, NULL); + if (n_changes > 0) { + r = bus_manager_foreach_client(m, send_unit_files_changed, NULL); + if (r < 0) + log_debug("Failed to send UnitFilesChanged signal: %s", strerror(-r)); + } r = sd_bus_message_new_method_return(message, &reply); if (r < 0) diff --git src/core/dbus-unit.c src/core/dbus-unit.c index 515ac8b..07e7f20 100644 --- src/core/dbus-unit.c +++ src/core/dbus-unit.c @@ -638,21 +638,13 @@ static int send_changed_signal(sd_bus *bus, void *userdata) { bus, p, UNIT_VTABLE(u)->bus_interface, NULL); - if (r < 0) { - log_warning("Failed to send out specific PropertiesChanged signal for %s: %s", u->id, strerror(-r)); + if (r < 0) return r; - } - r = sd_bus_emit_properties_changed_strv( + return sd_bus_emit_properties_changed_strv( bus, p, "org.freedesktop.systemd1.Unit", NULL); - if (r < 0) { - log_warning("Failed to send out generic PropertiesChanged signal for %s: %s", u->id, strerror(-r)); - return r; - } - - return 0; } void bus_unit_send_change_signal(Unit *u) { -- 1.7.9.2 --- src/core/dbus-manager.c +++ src/core/dbus-manager.c 2014-03-11 11:05:44.350235568 +0000 ++++++ 0007-drop_duplicates-copy-full-BindMount-struct.patch ++++++
From e2d7c1a0758ce80d7cb439745deefefdffd67655 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt <ansgar@debian.org> Date: Sun, 27 Jul 2014 16:32:13 +0200 Subject: [PATCH] drop_duplicates: copy full BindMount struct
At least t->ignore = f->ignore; is missing here. Just copy the full struct to be sure. --- src/core/namespace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git src/core/namespace.c src/core/namespace.c index 5466b7b..fe95377 100644 --- src/core/namespace.c +++ src/core/namespace.c @@ -124,8 +124,7 @@ static void drop_duplicates(BindMount *m, unsigned *n) { if (previous && path_equal(f->path, previous->path)) continue; - t->path = f->path; - t->mode = f->mode; + *t = *f; previous = t; -- 1.7.9.2 ++++++ 0007-hwdb-Update-database-of-Bluetooth-company-identifier.patch ++++++
From 063e36db8aed7b54100b33089deb6d2e86d516b9 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann <marcel@holtmann.org> Date: Thu, 3 Jul 2014 16:13:48 +0200 Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
--- hwdb/20-bluetooth-vendor-product.hwdb | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git hwdb/20-bluetooth-vendor-product.hwdb hwdb/20-bluetooth-vendor-product.hwdb index 377748a..9f3136a 100644 --- hwdb/20-bluetooth-vendor-product.hwdb +++ hwdb/20-bluetooth-vendor-product.hwdb @@ -1045,7 +1045,31 @@ bluetooth:v0159* ID_VENDOR_FROM_DATABASE=ChefSteps, Inc. bluetooth:v015A* - ID_VENDOR_FROM_DATABASE=micus AG + ID_VENDOR_FROM_DATABASE=micas AG bluetooth:v015B* ID_VENDOR_FROM_DATABASE=Biomedical Research Ltd. + +bluetooth:v015C* + ID_VENDOR_FROM_DATABASE=Pitius Tec S.L. + +bluetooth:v015D* + ID_VENDOR_FROM_DATABASE=Estimote, Inc. + +bluetooth:v015E* + ID_VENDOR_FROM_DATABASE=Unikey Technologies, Inc. + +bluetooth:v015F* + ID_VENDOR_FROM_DATABASE=Timer Cap Co. + +bluetooth:v0160* + ID_VENDOR_FROM_DATABASE=AwoX + +bluetooth:v0161* + ID_VENDOR_FROM_DATABASE=yikes + +bluetooth:v0162* + ID_VENDOR_FROM_DATABASE=MADSGlobal NZ Ltd. + +bluetooth:v0163* + ID_VENDOR_FROM_DATABASE=PCH International -- 1.7.9.2 ++++++ 0007-hwdb-update.patch ++++++ ++++ 1910 lines (skipped) ++++++ 0007-journal-forget-file-after-encountering-an-error.patch ++++++
From a9a245c128af6c0418085062c60251bc51fa4a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Thu, 27 Feb 2014 00:11:54 -0500 Subject: [PATCH] journal: forget file after encountering an error
If we encounter an inconsistency in a file, let's just ignore it. Otherwise, after previous patch, we would try, and fail, to use this file in every invocation of sd_journal_next or sd_journal_previous that happens afterwards. --- src/journal/sd-journal.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git src/journal/sd-journal.c src/journal/sd-journal.c index ef455e9..b54bc21 100644 --- src/journal/sd-journal.c +++ src/journal/sd-journal.c @@ -51,6 +51,8 @@ #define DEFAULT_DATA_THRESHOLD (64*1024) +static void remove_file_real(sd_journal *j, JournalFile *f); + static bool journal_pid_changed(sd_journal *j) { assert(j); @@ -885,6 +887,7 @@ static int real_journal_next(sd_journal *j, direction_t direction) { r = next_beyond_location(j, f, direction, &o, &p); if (r < 0) { log_debug("Can't iterate through %s, ignoring: %s", f->path, strerror(-r)); + remove_file_real(j, f); continue; } else if (r == 0) continue; @@ -1339,7 +1342,7 @@ static int add_file(sd_journal *j, const char *prefix, const char *filename) { } static int remove_file(sd_journal *j, const char *prefix, const char *filename) { - char *path; + _cleanup_free_ char *path; JournalFile *f; assert(j); @@ -1351,10 +1354,17 @@ static int remove_file(sd_journal *j, const char *prefix, const char *filename) return -ENOMEM; f = hashmap_get(j->files, path); - free(path); if (!f) return 0; + remove_file_real(j, f); + return 0; +} + +static void remove_file_real(sd_journal *j, JournalFile *f) { + assert(j); + assert(f); + hashmap_remove(j->files, f->path); log_debug("File %s removed.", f->path); @@ -1372,8 +1382,6 @@ static int remove_file(sd_journal *j, const char *prefix, const char *filename) journal_file_close(f); j->current_invalidate_counter ++; - - return 0; } static int add_directory(sd_journal *j, const char *prefix, const char *dirname) { -- 1.7.9.2 ++++++ 0007-journald-also-check-journal-file-size-to-deduce-if-i.patch ++++++
From 332076b45b8a78f018ade2dfdc7e4279a56d49cc Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 3 Nov 2014 23:10:21 +0100 Subject: [PATCH] journald: also check journal file size to deduce if it is empty
--- src/journal/journal-vacuum.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git src/journal/journal-vacuum.c src/journal/journal-vacuum.c index dbf5d22..d141fe0 100644 --- src/journal/journal-vacuum.c +++ src/journal/journal-vacuum.c @@ -121,22 +121,30 @@ static void patch_realtime( } static int journal_file_empty(int dir_fd, const char *name) { - int r; - le64_t n_entries; _cleanup_close_ int fd; + struct stat st; + le64_t n_entries; + ssize_t n; fd = openat(dir_fd, name, O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK); if (fd < 0) return -errno; - if (lseek(fd, offsetof(Header, n_entries), SEEK_SET) < 0) + if (fstat(fd, &st) < 0) return -errno; - r = read(fd, &n_entries, sizeof(n_entries)); - if (r != sizeof(n_entries)) - return r == 0 ? -EINVAL : -errno; + /* If an offline file doesn't even have a header we consider it empty */ + if (st.st_size < (off_t) sizeof(Header)) + return 1; + + /* If the number of entries is empty, we consider it empty, too */ + n = pread(fd, &n_entries, sizeof(n_entries), offsetof(Header, n_entries)); + if (n < 0) + return -errno; + if (n != sizeof(n_entries)) + return -EIO; - return le64toh(n_entries) == 0; + return le64toh(n_entries) <= 0; } int journal_directory_vacuum( -- 1.7.9.2 ++++++ 0007-journald-also-increase-the-SendBuffer-of-dev-log-to-.patch ++++++ Based on 5e8b767df6e18444d5aff2987b5e5603361ed528 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 13 Aug 2014 18:53:05 +0200 Subject: [PATCH] journald: also increase the SendBuffer of /dev/log to 8M http://lists.freedesktop.org/archives/systemd-devel/2014-August/021825.html --- units/systemd-journald.socket | 6 ++++++ 1 file changed, 6 insertions(+) --- units/systemd-journald.socket +++ units/systemd-journald.socket 2014-08-22 14:31:11.022236471 +0000 @@ -23,4 +23,10 @@ ListenDatagram=/dev/log SocketMode=0666 PassCredentials=yes PassSecurity=yes + +# Increase both the send and receive buffer, so that things don't +# block early. Note that journald internally uses the this socket both +# for receiving syslog messages, and for forwarding them to any other +# syslog, hence we bump both values. ReceiveBuffer=8M +SendBuffer=8M ++++++ 0007-keyboard-add-Plantronics-.Audio-mute-button.patch ++++++
From 9e3dbf6b2b99d0e16989d9cedb458729db5a60c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sun, 1 Jun 2014 14:01:23 -0400 Subject: [PATCH] keyboard: add Plantronics .Audio mute button
https://bugs.freedesktop.org/show_bug.cgi?id=79495 --- hwdb/60-keyboard.hwdb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb index 05e6a04..d053766 100644 --- hwdb/60-keyboard.hwdb +++ hwdb/60-keyboard.hwdb @@ -866,6 +866,14 @@ keyboard:dmi:bvn*:bvr*:bd*:svnOQO*Inc.*:pnOQO*Model*2*:pvr* KEYBOARD_KEY_f3=volumeup ########################################################### +# Plantronics +########################################################### + +# Plantronics .Audio 626 DSP +keyboard:usb:v047fpC006* + KEYBOARD_KEY_b002f=f20 # Microphone mute button; should be micmute + +########################################################### # Quanta ########################################################### -- 1.7.9.2 ++++++ 0007-libudev-monitor-warn-if-we-fail-to-request-SO_PASSCR.patch ++++++
From 9dedfe7f667a8cb22ba85d0223556c69c4fd0e9a Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 18 Sep 2014 09:20:46 +0200 Subject: [PATCH] libudev: monitor - warn if we fail to request SO_PASSCRED
The function still succeeds, so there is no functional change. This fixes CID #996288. --- src/libudev/libudev-monitor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git src/libudev/libudev-monitor.c src/libudev/libudev-monitor.c index 186e5e1..59698b8 100644 --- src/libudev/libudev-monitor.c +++ src/libudev/libudev-monitor.c @@ -412,7 +412,10 @@ _public_ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) } /* enable receiving of sender credentials */ - setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + if (err < 0) + udev_err(udev_monitor->udev, "setting SO_PASSCRED failed: %m\n"); + return 0; } -- 1.7.9.2 ++++++ 0007-logind-fix-Display-property-of-user-objects.patch ++++++
From 952d32609f9bceee444fa2690afb4d28539b4b92 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 19 May 2014 09:03:20 +0900 Subject: [PATCH] logind: fix Display property of user objects
When we dropped support for creating a per-user to the "main" X11 display we stopped returning useful data in the "Display" user property. With this change this is fixed and we again expose an appropriate (graphical session) in the property that is useful as the "main" one, if one is needed. --- src/login/logind-session.c | 8 ++++++-- src/login/logind-session.h | 2 ++ src/login/logind-user-dbus.c | 2 +- src/login/logind-user.c | 37 +++++++++++++++++++++++++++++++++++++ src/login/logind-user.h | 1 + 5 files changed, 47 insertions(+), 3 deletions(-) diff --git src/login/logind-session.c src/login/logind-session.c index 4fb229e..9a54101 100644 --- src/login/logind-session.c +++ src/login/logind-session.c @@ -545,6 +545,8 @@ int session_start(Session *s) { s->started = true; + user_elect_display(s->user); + /* Save data */ session_save(s); user_save(s->user); @@ -553,7 +555,7 @@ int session_start(Session *s) { /* Send signals */ session_send_signal(s, true); - user_send_changed(s->user, "Sessions", NULL); + user_send_changed(s->user, "Sessions", "Display", NULL); if (s->seat) { if (s->seat->active == s) seat_send_changed(s->seat, "Sessions", "ActiveSession", NULL); @@ -612,6 +614,8 @@ int session_stop(Session *s, bool force) { s->stopping = true; + user_elect_display(s->user); + session_save(s); user_save(s->user); @@ -660,7 +664,7 @@ int session_finalize(Session *s) { } user_save(s->user); - user_send_changed(s->user, "Sessions", NULL); + user_send_changed(s->user, "Sessions", "Display", NULL); return r; } diff --git src/login/logind-session.h src/login/logind-session.h index f78f309..81957df 100644 --- src/login/logind-session.h +++ src/login/logind-session.h @@ -60,6 +60,8 @@ typedef enum SessionType { _SESSION_TYPE_INVALID = -1 } SessionType; +#define SESSION_TYPE_IS_GRAPHICAL(type) IN_SET(type, SESSION_X11, SESSION_WAYLAND, SESSION_MIR) + enum KillWho { KILL_LEADER, KILL_ALL, diff --git src/login/logind-user-dbus.c src/login/logind-user-dbus.c index 6266ccb..51793f6 100644 --- src/login/logind-user-dbus.c +++ src/login/logind-user-dbus.c @@ -220,7 +220,7 @@ const sd_bus_vtable user_vtable[] = { SD_BUS_PROPERTY("RuntimePath", "s", NULL, offsetof(User, runtime_path), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Service", "s", NULL, offsetof(User, service), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Slice", "s", NULL, offsetof(User, slice), SD_BUS_VTABLE_PROPERTY_CONST), - SD_BUS_PROPERTY("Display", "(so)", property_get_display, 0, SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("Display", "(so)", property_get_display, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("State", "s", property_get_state, 0, 0), SD_BUS_PROPERTY("Sessions", "a(so)", property_get_sessions, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("IdleHint", "b", property_get_idle_hint, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), diff --git src/login/logind-user.c src/login/logind-user.c index 5fffa65..fdbccb3 100644 --- src/login/logind-user.c +++ src/login/logind-user.c @@ -713,6 +713,43 @@ int user_kill(User *u, int signo) { return manager_kill_unit(u->manager, u->slice, KILL_ALL, signo, NULL); } +void user_elect_display(User *u) { + Session *graphical = NULL, *text = NULL, *s; + + assert(u); + + /* This elects a primary session for each user, which we call + * the "display". We try to keep the assignment stable, but we + * "upgrade" to better choices. */ + + LIST_FOREACH(sessions_by_user, s, u->sessions) { + + if (s->class != SESSION_USER) + continue; + + if (s->stopping) + continue; + + if (SESSION_TYPE_IS_GRAPHICAL(s->type)) + graphical = s; + else + text = s; + } + + if (graphical && + (!u->display || + u->display->class != SESSION_USER || + u->display->stopping || + !SESSION_TYPE_IS_GRAPHICAL(u->display->type))) + u->display = graphical; + + if (text && + (!u->display || + u->display->class != SESSION_USER || + u->display->stopping)) + u->display = text; +} + static const char* const user_state_table[_USER_STATE_MAX] = { [USER_OFFLINE] = "offline", [USER_OPENING] = "opening", diff --git src/login/logind-user.h src/login/logind-user.h index f237d2a..4e0568f 100644 --- src/login/logind-user.h +++ src/login/logind-user.h @@ -80,6 +80,7 @@ int user_save(User *u); int user_load(User *u); int user_kill(User *u, int signo); int user_check_linger_file(User *u); +void user_elect_display(User *u); extern const sd_bus_vtable user_vtable[]; int user_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error); -- 1.7.9.2 ++++++ 0007-man-readahead-fix-cmdline-switch-inconsistency-betwe.patch ++++++
From 332bc31992acffc6f32e194c0122e01607bd0e27 Mon Sep 17 00:00:00 2001 From: Alison Chaiken <alison_chaiken@mentor.com> Date: Fri, 16 May 2014 09:25:53 +0200 Subject: [PATCH] man: readahead: fix cmdline switch inconsistency between readahead.c and docs
Source code has "files-max" and XML has --max-files. --- man/systemd-readahead-replay.service.xml | 2 +- src/readahead/readahead.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git man/systemd-readahead-replay.service.xml man/systemd-readahead-replay.service.xml index 67b41f5..669fe78 100644 --- man/systemd-readahead-replay.service.xml +++ man/systemd-readahead-replay.service.xml @@ -117,7 +117,7 @@ <variablelist> <varlistentry> - <term><option>--max-files=</option></term> + <term><option>--files-max=</option></term> <listitem><para>Maximum number of files to read ahead. Only valid diff --git src/readahead/readahead.c src/readahead/readahead.c index d6729ec..73cf538 100644 --- src/readahead/readahead.c +++ src/readahead/readahead.c @@ -42,7 +42,7 @@ static int help(void) { "Collect read-ahead data on early boot.\n\n" " -h --help Show this help\n" " --version Show package version\n" - " --max-files=INT Maximum number of files to read ahead\n" + " --files-max=INT Maximum number of files to read ahead\n" " --file-size-max=BYTES Maximum size of files to read ahead\n" " --timeout=USEC Maximum time to spend collecting data\n\n\n", program_invocation_short_name); -- 1.7.9.2 ++++++ 0007-networkd-fix-typo.patch ++++++
From eed0eee85ac34abd81cd9e81fdb6a19f47b6c8a3 Mon Sep 17 00:00:00 2001 From: Michael Olbrich <m.olbrich@pengutronix.de> Date: Fri, 14 Mar 2014 18:19:29 +0100 Subject: [PATCH] networkd: fix typo
It's HAVE_SPLIT_USR not HAVE_SPLIT_USER --- src/network/networkd-manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/network/networkd-manager.c src/network/networkd-manager.c index c730e71..ea414b1 100644 --- src/network/networkd-manager.c +++ src/network/networkd-manager.c @@ -33,7 +33,7 @@ const char* const network_dirs[] = { "/etc/systemd/network", "/run/systemd/network", "/usr/lib/systemd/network", -#ifdef HAVE_SPLIT_USER +#ifdef HAVE_SPLIT_USR "/lib/systemd/network", #endif NULL}; -- 1.7.9.2 ++++++ 0007-po-add-German-translation.patch ++++++
From 351e57652a7d9a51f9064c089794d13801eaee73 Mon Sep 17 00:00:00 2001 From: Benjamin Steinwender <b@stbe.at> Date: Sun, 8 Jun 2014 18:39:50 +0200 Subject: [PATCH] po: add German translation
https://bugs.freedesktop.org/show_bug.cgi?id=79430 --- po/LINGUAS | 1 + po/de.po | 418 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 419 insertions(+) create mode 100644 po/de.po diff --git po/LINGUAS po/LINGUAS index 820ca82..2cb0f30 100644 --- po/LINGUAS +++ po/LINGUAS @@ -1,3 +1,4 @@ +de el fr it diff --git po/de.po po/de.po new file mode 100644 index 0000000..a41e33d --- /dev/null +++ po/de.po @@ -0,0 +1,418 @@ +# German translation for systemd. +# Copyright (C) 2014 systemd's COPYRIGHT HOLDER +# This file is distributed under the same license as the systemd package. +# Christian Kirbach <Christian.Kirbach@gmail.com>, 2014. +# Benjamin Steinwender <b@stbe.at>, 2014. +# +msgid "" +msgstr "" +"Project-Id-Version: systemd master\n" +"Report-Msgid-Bugs-To: https://bugs.freedesktop.org/enter_bug.cgi?" +"product=systemd&keywords=I18N+L10N&component=general\n" +"POT-Creation-Date: 2014-06-02 10:25+0000\n" +"PO-Revision-Date: 2014-06-02 22:43+0100\n" +"Last-Translator: Benjamin Steinwender <b@stbe.at>\n" +"Language-Team: German <gnome-de@gnome.org>\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.6.5\n" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1 +msgid "Set host name" +msgstr "Rechnername festlegen" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2 +msgid "Authentication is required to set the local host name." +msgstr "Legitimierung ist zum Festlegen des lokalen Rechnernamens notwendig" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3 +msgid "Set static host name" +msgstr "Statischen Rechnernamen festlegen" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4 +msgid "" +"Authentication is required to set the statically configured local host name, " +"as well as the pretty host name." +msgstr "" +"Authentifizierung ist erforderlich, um den statisch geänderten, lokalen " +"Rechnernamen, sowie den beschönigten Rechnernamen festzulegen." + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5 +msgid "Set machine information" +msgstr "Maschinen-Information festlegen" + +#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6 +msgid "Authentication is required to set local machine information." +msgstr "" +"Legitimierung ist zum Festlegen der lokalen Maschinen-Information " +"erforderlich." + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:1 +msgid "Set system locale" +msgstr "Die lokale Sprachumgebung festlegen" + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:2 +msgid "Authentication is required to set the system locale." +msgstr "" +"Legitimierung ist zum Festlegen der systemweiten Spracheinstellungen " +"erforderlich." + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:3 +msgid "Set system keyboard settings" +msgstr "Tastatureinstellungen des Systems festlegen" + +#: ../src/locale/org.freedesktop.locale1.policy.in.h:4 +msgid "Authentication is required to set the system keyboard settings." +msgstr "" +"Legitimierung ist zum Festlegen der Tastatureinstellungen des Systems " +"erforderlich." + +#: ../src/login/org.freedesktop.login1.policy.in.h:1 +msgid "Allow applications to inhibit system shutdown" +msgstr "Anwendungen dürfen das Herunterfahren des Systems unterbinden" + +#: ../src/login/org.freedesktop.login1.policy.in.h:2 +msgid "" +"Authentication is required to allow an application to inhibit system " +"shutdown." +msgstr "" +"Legitimierung ist notwendig, um Anwendungen das Herunterfahren des Systems " +"zu erlauben." + +#: ../src/login/org.freedesktop.login1.policy.in.h:3 +msgid "Allow applications to delay system shutdown" +msgstr "Anwendungen dürfen das Herunterfahren des Systems verzögern" + +#: ../src/login/org.freedesktop.login1.policy.in.h:4 +msgid "" +"Authentication is required to allow an application to delay system shutdown." +msgstr "" +"Legitimierung ist notwendig, um Anwendungen das Verzögern des Herunterfahren " +"des Systems zu erlauben." + +#: ../src/login/org.freedesktop.login1.policy.in.h:5 +msgid "Allow applications to inhibit system sleep" +msgstr "Anwendungen dürfen den Bereitschaftsmodus unterbinden" + +#: ../src/login/org.freedesktop.login1.policy.in.h:6 +msgid "" +"Authentication is required to allow an application to inhibit system sleep." +msgstr "" +"Legitimierung ist erforderlich, um Anwendungen das Unterbinden des " +"Bereitschaftsmodus zu erlauben." + +#: ../src/login/org.freedesktop.login1.policy.in.h:7 +msgid "Allow applications to delay system sleep" +msgstr "Anwendungen dürfen den Bereitschaftsmodus verzögern" + +#: ../src/login/org.freedesktop.login1.policy.in.h:8 +msgid "" +"Authentication is required to allow an application to delay system sleep." +msgstr "" +"Legitimierung ist erforderlich, um Anwendungen das Verzögern des " +"Bereitschaftsmodus zu erlauben." + +#: ../src/login/org.freedesktop.login1.policy.in.h:9 +msgid "Allow applications to inhibit automatic system suspend" +msgstr "Anwendungen dürfen den automatischen Bereitschaftsmodus unterbinden" + +#: ../src/login/org.freedesktop.login1.policy.in.h:10 +msgid "" +"Authentication is required to allow an application to inhibit automatic " +"system suspend." +msgstr "" +"Legitimierung ist notwendig, um Anwendungen das Unterbinden des " +"automatischen Bereitschaftsmodus zu erlauben." + +#: ../src/login/org.freedesktop.login1.policy.in.h:11 +msgid "Allow applications to inhibit system handling of the power key" +msgstr "" +"Anwendungen dürfen das Auswerten des Ein-/Ausschaltknopfs des Systems " +"unterbinden" + +#: ../src/login/org.freedesktop.login1.policy.in.h:12 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the power key." +msgstr "" +"Legitmierung ist erforderlich, um Anwendungen das Unterbinden der Auswertung " +"der Ein-/Ausschaltknopfs des Systems zu erlauben." + +#: ../src/login/org.freedesktop.login1.policy.in.h:13 +msgid "Allow applications to inhibit system handling of the suspend key" +msgstr "" +"Anwendungen dürfen das Auswerten des Bereitschaftsknopfs des Systems " +"unterbinden" + +#: ../src/login/org.freedesktop.login1.policy.in.h:14 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the suspend key." +msgstr "" +"Legitimierung ist erforderlich, um Anwendungen das Unterbinden der " +"Auswertung des Bereitschaftsknopfes des Systems zu erlauben." + +#: ../src/login/org.freedesktop.login1.policy.in.h:15 +msgid "Allow applications to inhibit system handling of the hibernate key" +msgstr "" +"Anwendungen dürfen das Auswerten des Knopfs für den Ruhezustand unterbinden" + +#: ../src/login/org.freedesktop.login1.policy.in.h:16 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the hibernate key." +msgstr "" +"Legitimierung ist erforderlich, um Anwendungen das Unterbinden der " +"Auswertung des Knopfs für den Ruhezustand zu erlauben." + +#: ../src/login/org.freedesktop.login1.policy.in.h:17 +msgid "Allow applications to inhibit system handling of the lid switch" +msgstr "" +"Anwendungen dürfen das Auswerten des Notebookdeckelschalters unterbinden" + +#: ../src/login/org.freedesktop.login1.policy.in.h:18 +msgid "" +"Authentication is required to allow an application to inhibit system " +"handling of the lid switch." +msgstr "" +"Legitimierung ist erforderlich, um Anwendungen das Unterbinden der " +"Auswertung des Notebookdeckelschalters des Systems zu erlauben." + +#: ../src/login/org.freedesktop.login1.policy.in.h:19 +msgid "Allow non-logged-in users to run programs" +msgstr "Nicht angemeldete Benutzer dürfen Programme ausführen" + +#: ../src/login/org.freedesktop.login1.policy.in.h:20 +msgid "" +"Authentication is required to allow a non-logged-in user to run programs." +msgstr "" +"Legitimierung ist erforderlich, damit nicht angemeldete Benutzer Programme " +"ausführen dürfen." + +# www.freedesktop.org/wiki/Software/systemd/multiseat/ +#: ../src/login/org.freedesktop.login1.policy.in.h:21 +msgid "Allow attaching devices to seats" +msgstr "Das Anschließen von Geräten an Arbeitsstationen erlauben" + +# www.freedesktop.org/wiki/Software/systemd/multiseat/ +#: ../src/login/org.freedesktop.login1.policy.in.h:22 +msgid "Authentication is required for attaching a device to a seat." +msgstr "" +"Legitimierung ist zum Anschließen eines Geräts an eine Arbeitsstation " +"notwendig." + +# www.freedesktop.org/wiki/Software/systemd/multiseat/ +#: ../src/login/org.freedesktop.login1.policy.in.h:23 +msgid "Flush device to seat attachments" +msgstr "Zurücksetzen der an eine Arbeitsstation angeschlossenen Geräte" + +# www.freedesktop.org/wiki/Software/systemd/multiseat/ +#: ../src/login/org.freedesktop.login1.policy.in.h:24 +msgid "" +"Authentication is required for resetting how devices are attached to seats." +msgstr "" +"Legitimierung ist zum Zurücksetzen notwendig, wie Geräte an eine " +"Arbeitsstation angeschlossen werden." + +#: ../src/login/org.freedesktop.login1.policy.in.h:25 +msgid "Power off the system" +msgstr "Das System ausschalten" + +#: ../src/login/org.freedesktop.login1.policy.in.h:26 +msgid "Authentication is required for powering off the system." +msgstr "Legitimierung ist zum Ausschalten des Systems notwendig." + +#: ../src/login/org.freedesktop.login1.policy.in.h:27 +msgid "Power off the system while other users are logged in" +msgstr "Das System herunter fahren, während andere Benutzer angemeldet sind" + +#: ../src/login/org.freedesktop.login1.policy.in.h:28 +msgid "" +"Authentication is required for powering off the system while other users are " +"logged in." +msgstr "" +"Legitimierung ist zum Herunterfahren des Systems notwendig, während andere " +"Benutzer angemeldet sind." + +#: ../src/login/org.freedesktop.login1.policy.in.h:29 +msgid "Power off the system while an application asked to inhibit it" +msgstr "" +"Das System ausschalten, während eine Anwendung anfordert es zu unterbinden" + +#: ../src/login/org.freedesktop.login1.policy.in.h:30 +msgid "" +"Authentication is required for powering off the system while an application " +"asked to inhibit it." +msgstr "" +"Legitimierung ist zum Ausschalten des Systems notwendig, während eine " +"Anwendung anfordert es zu unterbinden." + +#: ../src/login/org.freedesktop.login1.policy.in.h:31 +msgid "Reboot the system" +msgstr "Das System neu starten" + +#: ../src/login/org.freedesktop.login1.policy.in.h:32 +msgid "Authentication is required for rebooting the system." +msgstr "Legitimierung ist zum Neustart des Systems notwendig." + +#: ../src/login/org.freedesktop.login1.policy.in.h:33 +msgid "Reboot the system while other users are logged in" +msgstr "Das Systems neu starten, während andere Benutzer angemeldet sind" + +#: ../src/login/org.freedesktop.login1.policy.in.h:34 +msgid "" +"Authentication is required for rebooting the system while other users are " +"logged in." +msgstr "" +"Legitimierung ist zum Neustart des Systems notwendig, während andere " +"Benutzer angemeldet sind." + +#: ../src/login/org.freedesktop.login1.policy.in.h:35 +msgid "Reboot the system while an application asked to inhibit it" +msgstr "" +"Das System neu starten, während eine Anwendung anfordert es zu unterbinden" + +#: ../src/login/org.freedesktop.login1.policy.in.h:36 +msgid "" +"Authentication is required for rebooting the system while an application " +"asked to inhibit it." +msgstr "" +"Legitimierung ist zum Neustart des Systems notwendig, während eine Anwendung " +"anforderte es zu unterbinden." + +#: ../src/login/org.freedesktop.login1.policy.in.h:37 +msgid "Suspend the system" +msgstr "Das System in Bereitschaft versetzen" + +#: ../src/login/org.freedesktop.login1.policy.in.h:38 +msgid "Authentication is required for suspending the system." +msgstr "Legitimierung ist zum Versetzen des Systems in Bereitschaft notwendig." + +#: ../src/login/org.freedesktop.login1.policy.in.h:39 +msgid "Suspend the system while other users are logged in" +msgstr "" +"Das System in Bereitschaft versetzen, während andere Benutzer angemeldet " +"sind." + +#: ../src/login/org.freedesktop.login1.policy.in.h:40 +msgid "" +"Authentication is required for suspending the system while other users are " +"logged in." +msgstr "" +"Legitimierung ist zum Versetzen des Systems in Bereitschaft notwendig, " +"während andere Benutzer angemeldet sind." + +#: ../src/login/org.freedesktop.login1.policy.in.h:41 +msgid "Suspend the system while an application asked to inhibit it" +msgstr "" +"Das System in Bereitschaft versetzen, während eine Anwendung anfordert dies " +"zu unterbinden" + +#: ../src/login/org.freedesktop.login1.policy.in.h:42 +msgid "" +"Authentication is required for suspending the system while an application " +"asked to inhibit it." +msgstr "" +"Legitimierung ist zum Versetzen des Systems in Bereitschaft notwendig, " +"während eine Anwendung anfordert dies zu unterbinden." + +#: ../src/login/org.freedesktop.login1.policy.in.h:43 +msgid "Hibernate the system" +msgstr "Den Ruhezustand des Systems aktivieren" + +#: ../src/login/org.freedesktop.login1.policy.in.h:44 +msgid "Authentication is required for hibernating the system." +msgstr "" +"Legitimierung ist zum Aktivieren des Ruhezustands des Systems notwendig." + +#: ../src/login/org.freedesktop.login1.policy.in.h:45 +msgid "Hibernate the system while other users are logged in" +msgstr "" +"Den Ruhezustand des Systems aktivieren, während andere Benutzer angemeldet " +"sind" + +#: ../src/login/org.freedesktop.login1.policy.in.h:46 +msgid "" +"Authentication is required for hibernating the system while other users are " +"logged in." +msgstr "" +"Legitimierung ist zum Aktivieren des Ruhezustands des Systems notwendig, " +"während andere Benutzer angemeldet sind." + +#: ../src/login/org.freedesktop.login1.policy.in.h:47 +msgid "Hibernate the system while an application asked to inhibit it" +msgstr "" +"Das System in den Ruhezustand versetzen, während eine Anwendung wünscht dies " +"zu verhindern" + +#: ../src/login/org.freedesktop.login1.policy.in.h:48 +msgid "" +"Authentication is required for hibernating the system while an application " +"asked to inhibit it." +msgstr "" +"Legitimierung ist zum Versetzen des System in den Ruhezustand notwendig, " +"während eine Anwendung wünscht dies zu verhindern." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1 +msgid "Set system time" +msgstr "Die Systemzeit festlegen" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:2 +msgid "Authentication is required to set the system time." +msgstr "Legitimierung ist zum Festlegen der Systemzeit notwendig." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:3 +msgid "Set system timezone" +msgstr "Die Systemzeitzone festlegen" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:4 +msgid "Authentication is required to set the system timezone." +msgstr "Legitimierung ist zum Festlegen der Systemzeitzone notwendig." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:5 +msgid "Set RTC to local timezone or UTC" +msgstr "Echtzeituhr auf lokale Zeitzone oder UTC setzen" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:6 +msgid "" +"Authentication is required to control whether the RTC stores the local or " +"UTC time." +msgstr "" +"Legitimierung ist notwendig zum Festlegen, ob die Echtzeituhr auf lokale " +"Zeitzone oder UTC eingestellt ist." + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:7 +msgid "Turn network time synchronization on or off" +msgstr "Netzwerkzeitabgeich ein- oder ausschalten" + +#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:8 +msgid "" +"Authentication is required to control whether network time synchronization " +"shall be enabled." +msgstr "" +"Legitimierung ist zum Festlegen, ob Netzwerkzeitabgeich eingeschaltet sein " +"soll, erforderlich." + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1 +msgid "Send passphrase back to system" +msgstr "Passphrase zurück an das System senden" + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:2 +msgid "" +"Authentication is required to send the entered passphrase back to the system." +msgstr "" +"Legitimierung ist zum Senden des eingegebenen Kennworts zurück an das System " +"notwendig." + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3 +msgid "Privileged system and service manager access" +msgstr "Privilegierter Zugriff auf die System- und Dienstverwaltung" + +#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4 +msgid "Authentication is required to access the system and service manager." +msgstr "" +"Legitimierung ist notwendig für den Zugriff auf die System- und " +"Dienstverwaltung." -- 1.7.9.2 ++++++ 0007-sd-event-don-t-accidentally-turn-of-watchdog-timer-e.patch ++++++
From 75145780813957ecbe6835f2c8bc20113a3605d2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 25 Mar 2014 00:01:51 +0100 Subject: [PATCH] sd-event: don't accidentally turn of watchdog timer event if we determine 0
--- src/libsystemd/sd-event/sd-event.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git src/libsystemd/sd-event/sd-event.c src/libsystemd/sd-event/sd-event.c index d6a3d1c..4aabec1 100644 --- src/libsystemd/sd-event/sd-event.c +++ src/libsystemd/sd-event/sd-event.c @@ -2087,6 +2087,11 @@ static int arm_watchdog(sd_event *e) { timespec_store(&its.it_value, t); + /* Make sure we never set the watchdog to 0, which tells the + * kernel to disable it. */ + if (its.it_value.tv_sec == 0 && its.it_value.tv_nsec == 0) + its.it_value.tv_nsec = 1; + r = timerfd_settime(e->watchdog_fd, TFD_TIMER_ABSTIME, &its, NULL); if (r < 0) return -errno; -- 1.7.9.2 ++++++ 0007-service-flush-status-text-and-errno-values-each-time.patch ++++++
From 8cfdb077b8e3da1c47fc1d735d051f21f33144c1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 7 Jul 2014 17:33:46 +0200 Subject: [PATCH] service: flush status text and errno values each time a service is started
We shouldn't show status texts from previous service starts --- src/core/service.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git src/core/service.c src/core/service.c index d5aff99..0f542ed 100644 --- src/core/service.c +++ src/core/service.c @@ -1699,6 +1699,10 @@ static int service_start(Unit *u) { s->main_pid_alien = false; s->forbid_restart = false; + free(s->status_text); + s->status_text = NULL; + s->status_errno = 0; + service_enter_start_pre(s); return 0; } -- 1.7.9.2 ++++++ 0007-systemctl-do-not-ignore-errors-in-symlink-removal.patch ++++++
From e95c98378ac2d34df864de4a9b785fd17defb77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 25 Oct 2014 15:15:28 -0400 Subject: [PATCH] systemctl: do not ignore errors in symlink removal
On an ro fs, systemctl disable ... would fail silently. --- src/shared/install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/shared/install.c src/shared/install.c index 0d7c30e..035b44c 100644 --- src/shared/install.c +++ src/shared/install.c @@ -1679,7 +1679,7 @@ int unit_file_disable( r = install_context_mark_for_removal(&c, &paths, &remove_symlinks_to, config_path, root_dir); q = remove_marked_symlinks(remove_symlinks_to, config_path, changes, n_changes, files); - if (r == 0) + if (r >= 0) r = q; return r; -- 1.7.9.2 ++++++ 0007-units-skip-mounting-tmp-if-it-is-a-symlink.patch ++++++
From 8ebf02d6f382ce1ac7e0d44a713b8795a07b08cd Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 30 Jun 2014 21:44:05 +0200 Subject: [PATCH] units: skip mounting /tmp if it is a symlink
We shouldn't get confused if people have symlinked /tmp somewhere, so let's simply skip the mount then. --- units/tmp.mount | 1 + 1 file changed, 1 insertion(+) diff --git units/tmp.mount units/tmp.mount index 99a3ba3..00a0d28 100644 --- units/tmp.mount +++ units/tmp.mount @@ -9,6 +9,7 @@ Description=Temporary Directory Documentation=man:hier(7) Documentation=http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems +ConditionPathIsSymbolicLink=!/tmp DefaultDependencies=no Conflicts=umount.target Before=local-fs.target umount.target -- 1.7.9.2 ++++++ 0008-Reset-signal-mask-on-re-exec-to-init.patch ++++++
From 5a85ca1cb622fda4a39c8a6f00dccea7f8a1e82a Mon Sep 17 00:00:00 2001 From: Ruediger Oertel <ro@suse.de> Date: Fri, 13 Jun 2014 16:41:06 +0200 Subject: [PATCH] Reset signal-mask on re-exec to init=..
Process 1 (aka init) needs to be started with an empty signal mask. That includes the process 1 that's started after the initrd is finished. When the initrd is using systemd (as it does with dracut based initrds) then it is systemd that calls the real init. Normally this is systemd again, except when the user uses for instance "init=/bin/bash" on the kernel command line. --- src/core/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git src/core/main.c src/core/main.c index 3aac5d1..3e57f07 100644 --- src/core/main.c +++ src/core/main.c @@ -1843,6 +1843,7 @@ finish: if (reexecute) { const char **args; unsigned i, args_size; + sigset_t ss, o_ss; /* Close and disarm the watchdog, so that the new * instance can reinitialize it, but doesn't get @@ -1926,6 +1927,11 @@ finish: args[i++] = NULL; assert(i <= args_size); + /* reenable any blocked signals, especially important + * if we switch from initial ramdisk to init=... */ + sigemptyset(&ss); + sigprocmask(SIG_SETMASK, &ss, &o_ss); + if (switch_root_init) { args[0] = switch_root_init; execv(args[0], (char* const*) args); @@ -1944,6 +1950,8 @@ finish: log_error("Failed to execute /bin/sh, giving up: %m"); } else log_warning("Failed to execute /sbin/init, giving up: %m"); + + sigprocmask(SIG_SETMASK, &o_ss, NULL); } if (arg_serialization) { -- 1.7.9.2 ++++++ 0008-Use-var-run-dbus-system_bus_socket-for-the-D-Bus-soc.patch ++++++
From 1ae383a8a3ae4824453e297352fda603d2d3fd5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Tue, 25 Feb 2014 21:26:31 -0500 Subject: [PATCH] Use /var/run/dbus/system_bus_socket for the D-Bus socket
--- man/systemd-bus-proxyd@.service.xml | 2 +- src/shared/def.h | 2 +- units/systemd-bus-proxyd.socket | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git man/systemd-bus-proxyd@.service.xml man/systemd-bus-proxyd@.service.xml index 75a3c8b..3a5930d 100644 --- man/systemd-bus-proxyd@.service.xml +++ man/systemd-bus-proxyd@.service.xml @@ -59,7 +59,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. <para><filename>systemd-bus-proxyd.socket</filename> will launch <filename>systemd-bus-proxyd@.service</filename> for connections to the classic D-Bus socket in - <filename>/run/dbus/system_bus_socket</filename>.</para> + <filename>/var/run/dbus/system_bus_socket</filename>.</para> <para><filename>systemd-bus-proxyd@.service</filename> is launched for an existing D-Bus connection and will use diff --git src/shared/def.h src/shared/def.h index 7777756..aa489d8 100644 --- src/shared/def.h +++ src/shared/def.h @@ -61,7 +61,7 @@ "/usr/lib/kbd/keymaps/\0" #endif -#define UNIX_SYSTEM_BUS_PATH "unix:path=/run/dbus/system_bus_socket" +#define UNIX_SYSTEM_BUS_PATH "unix:path=/var/run/dbus/system_bus_socket" #define KERNEL_SYSTEM_BUS_PATH "kernel:path=/dev/kdbus/0-system/bus" #ifdef ENABLE_KDBUS diff --git units/systemd-bus-proxyd.socket units/systemd-bus-proxyd.socket index 406e15b..6c42d38 100644 --- units/systemd-bus-proxyd.socket +++ units/systemd-bus-proxyd.socket @@ -9,5 +9,5 @@ Description=Legacy D-Bus Protocol Compatibility Socket [Socket] -ListenStream=/run/dbus/system_bus_socket +ListenStream=/var/run/dbus/system_bus_socket Accept=yes -- 1.7.9.2 ++++++ 0008-core-correctly-unregister-PIDs-from-PID-hashtables.patch ++++++
From bd44e61b0480712ec5585ff7b0295362a5f9dd36 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 6 Mar 2014 02:19:42 +0100 Subject: [PATCH] core: correctly unregister PIDs from PID hashtables
--- src/core/unit.c | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git src/core/unit.c src/core/unit.c index 2437ee3..85250ca 100644 --- src/core/unit.c +++ src/core/unit.c @@ -1704,11 +1704,11 @@ int unit_watch_pid(Unit *u, pid_t pid) { /* Watch a specific PID. We only support one or two units * watching each PID for now, not more. */ - r = hashmap_ensure_allocated(&u->manager->watch_pids1, trivial_hash_func, trivial_compare_func); + r = set_ensure_allocated(&u->pids, trivial_hash_func, trivial_compare_func); if (r < 0) return r; - r = set_ensure_allocated(&u->pids, trivial_hash_func, trivial_compare_func); + r = hashmap_ensure_allocated(&u->manager->watch_pids1, trivial_hash_func, trivial_compare_func); if (r < 0) return r; @@ -1737,7 +1737,17 @@ void unit_unwatch_pid(Unit *u, pid_t pid) { set_remove(u->pids, LONG_TO_PTR(pid)); } -static int watch_pids_in_path(Unit *u, const char *path) { +void unit_unwatch_all_pids(Unit *u) { + assert(u); + + while (!set_isempty(u->pids)) + unit_unwatch_pid(u, PTR_TO_LONG(set_first(u->pids))); + + set_free(u->pids); + u->pids = NULL; +} + +static int unit_watch_pids_in_path(Unit *u, const char *path) { _cleanup_closedir_ DIR *d = NULL; _cleanup_fclose_ FILE *f = NULL; int ret = 0, r; @@ -1775,7 +1785,7 @@ static int watch_pids_in_path(Unit *u, const char *path) { if (!p) return -ENOMEM; - r = watch_pids_in_path(u, p); + r = unit_watch_pids_in_path(u, p); if (r < 0 && ret >= 0) ret = r; } @@ -1788,31 +1798,15 @@ static int watch_pids_in_path(Unit *u, const char *path) { return ret; } - int unit_watch_all_pids(Unit *u) { assert(u); - if (!u->cgroup_path) - return -ENOENT; - /* Adds all PIDs from our cgroup to the set of PIDs we watch */ - return watch_pids_in_path(u, u->cgroup_path); -} - -void unit_unwatch_all_pids(Unit *u) { - Iterator i; - void *e; - - assert(u); - - SET_FOREACH(e, u->pids, i) { - hashmap_remove_value(u->manager->watch_pids1, e, u); - hashmap_remove_value(u->manager->watch_pids2, e, u); - } + if (!u->cgroup_path) + return -ENOENT; - set_free(u->pids); - u->pids = NULL; + return unit_watch_pids_in_path(u, u->cgroup_path); } void unit_tidy_watch_pids(Unit *u, pid_t except1, pid_t except2) { @@ -1830,7 +1824,7 @@ void unit_tidy_watch_pids(Unit *u, pid_t except1, pid_t except2) { continue; if (!pid_is_unwaited(pid)) - set_remove(u->pids, e); + unit_unwatch_pid(u, pid); } } -- 1.7.9.2 ++++++ 0008-core-smack-setup-Actually-allow-for-succesfully-load.patch ++++++
From b9289d4c6e13ec5fb67bfce69c826d93b004da6a Mon Sep 17 00:00:00 2001 From: Philippe De Swert <philippedeswert@gmail.com> Date: Fri, 12 Sep 2014 16:49:48 +0300 Subject: [PATCH] core: smack-setup: Actually allow for succesfully loading CIPSO policy
The line under the last switch statement *loaded_policy = true; would never be executed. As all switch cases return 0. Thus the policy would never be marked as loaded. Found with Coverity. Fixes: CID#1237785 --- src/core/smack-setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/core/smack-setup.c src/core/smack-setup.c index 5f6dabf..5d8a26c 100644 --- src/core/smack-setup.c +++ src/core/smack-setup.c @@ -158,7 +158,7 @@ int smack_setup(bool *loaded_policy) { return 0; case 0: log_info("Successfully loaded Smack/CIPSO policies."); - return 0; + break; default: log_warning("Failed to load Smack/CIPSO access rules: %s, ignoring.", strerror(abs(r))); -- 1.7.9.2 ++++++ 0008-hwdb-Update-database-of-Bluetooth-company-identifier.patch ++++++
From de68938a2cb3ab535ebd9198723a651753c1a1df Mon Sep 17 00:00:00 2001 From: Marcel Holtmann <marcel@holtmann.org> Date: Mon, 8 Sep 2014 05:06:18 +0200 Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
--- hwdb/20-bluetooth-vendor-product.hwdb | 77 ++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git hwdb/20-bluetooth-vendor-product.hwdb hwdb/20-bluetooth-vendor-product.hwdb index 9f3136a..14aee74 100644 --- hwdb/20-bluetooth-vendor-product.hwdb +++ hwdb/20-bluetooth-vendor-product.hwdb @@ -184,7 +184,7 @@ bluetooth:v003B* ID_VENDOR_FROM_DATABASE=Gennum Corporation bluetooth:v003C* - ID_VENDOR_FROM_DATABASE=Research In Motion + ID_VENDOR_FROM_DATABASE=BlackBerry Limited (formerly Research In Motion) bluetooth:v003D* ID_VENDOR_FROM_DATABASE=IPextreme, Inc. @@ -1073,3 +1073,78 @@ bluetooth:v0162* bluetooth:v0163* ID_VENDOR_FROM_DATABASE=PCH International + +bluetooth:v0164* + ID_VENDOR_FROM_DATABASE=Qingdao Yeelink Information Technology Co., Ltd. + +bluetooth:v0165* + ID_VENDOR_FROM_DATABASE=Milwaukee Tool (formerly Milwaukee Electric Tools) + +bluetooth:v0166* + ID_VENDOR_FROM_DATABASE=MISHIK Pte Ltd + +bluetooth:v0167* + ID_VENDOR_FROM_DATABASE=Bayer HealthCare + +bluetooth:v0168* + ID_VENDOR_FROM_DATABASE=Spicebox LLC + +bluetooth:v0169* + ID_VENDOR_FROM_DATABASE=emberlight + +bluetooth:v016A* + ID_VENDOR_FROM_DATABASE=Cooper-Atkins Corporation + +bluetooth:v016B* + ID_VENDOR_FROM_DATABASE=Qblinks + +bluetooth:v016C* + ID_VENDOR_FROM_DATABASE=MYSPHERA + +bluetooth:v016D* + ID_VENDOR_FROM_DATABASE=LifeScan Inc + +bluetooth:v016E* + ID_VENDOR_FROM_DATABASE=Volantic AB + +bluetooth:v016F* + ID_VENDOR_FROM_DATABASE=Podo Labs, Inc + +bluetooth:v0170* + ID_VENDOR_FROM_DATABASE=Roche Diabetes Care AG + +bluetooth:v0171* + ID_VENDOR_FROM_DATABASE=Amazon Fulfillment Service + +bluetooth:v0172* + ID_VENDOR_FROM_DATABASE=Connovate Technology Private Limited + +bluetooth:v0173* + ID_VENDOR_FROM_DATABASE=Kocomojo, LLC + +bluetooth:v0174* + ID_VENDOR_FROM_DATABASE=Everykey LLC + +bluetooth:v0175* + ID_VENDOR_FROM_DATABASE=Dynamic Controls + +bluetooth:v0176* + ID_VENDOR_FROM_DATABASE=SentriLock + +bluetooth:v0177* + ID_VENDOR_FROM_DATABASE=I-SYST inc. + +bluetooth:v0178* + ID_VENDOR_FROM_DATABASE=CASIO COMPUTER CO., LTD. + +bluetooth:v0179* + ID_VENDOR_FROM_DATABASE=LAPIS Semiconductor Co., Ltd. + +bluetooth:v017A* + ID_VENDOR_FROM_DATABASE=Telemonitor, Inc. + +bluetooth:v017B* + ID_VENDOR_FROM_DATABASE=taskit GmbH + +bluetooth:v017C* + ID_VENDOR_FROM_DATABASE=Daimler AG -- 1.7.9.2 ++++++ 0008-hwdb-update.patch ++++++ ++++ 1425 lines (skipped) ++++++ 0008-journald-fix-memory-leak-on-error-path.patch ++++++
From 26d8ff04914a5208d029e899682cd314b7714bf0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 3 Nov 2014 23:10:34 +0100 Subject: [PATCH] journald: fix memory leak on error path
--- src/journal/journal-vacuum.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git src/journal/journal-vacuum.c src/journal/journal-vacuum.c index d141fe0..80723c4 100644 --- src/journal/journal-vacuum.c +++ src/journal/journal-vacuum.c @@ -283,7 +283,11 @@ int journal_directory_vacuum( patch_realtime(directory, p, &st, &realtime); - GREEDY_REALLOC(list, n_allocated, n_list + 1); + if (!GREEDY_REALLOC(list, n_allocated, n_list + 1)) { + free(p); + r = -ENOMEM; + goto finish; + } list[n_list].filename = p; list[n_list].usage = 512UL * (uint64_t) st.st_blocks; -- 1.7.9.2 ++++++ 0008-man-multiple-sleep-modes-are-to-be-separated-by-whit.patch ++++++
From 252094eb05c58270a0bc35b14ad30a126ddbb3bb Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 11 Mar 2014 05:23:39 +0100 Subject: [PATCH] man: multiple sleep modes are to be separated by whitespace, not commas
As pointed out by Jason A. Donenfeld. --- man/systemd-sleep.conf.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git man/systemd-sleep.conf.xml man/systemd-sleep.conf.xml index a917f4d..d0ea6d8 100644 --- man/systemd-sleep.conf.xml +++ man/systemd-sleep.conf.xml @@ -128,7 +128,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. <citerefentry><refentrytitle>systemd-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, or <citerefentry><refentrytitle>systemd-hybrid-sleep.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. More than one value can be specified by separating - multiple values with commas. They will be tried + multiple values with whitespace. They will be tried in turn, until one is written without error. If neither succeeds, the operation will be aborted. </para></listitem> @@ -146,7 +146,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. <citerefentry><refentrytitle>systemd-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, or <citerefentry><refentrytitle>systemd-hybrid-sleep.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. More than one value can be specified by separating - multiple values with commas. They will be tried + multiple values with whitespace. They will be tried in turn, until one is written without error. If neither succeeds, the operation will be aborted. </para></listitem> -- 1.7.9.2 ++++++ 0008-man-update-journald-rate-limit-defaults.patch ++++++
From 8f18f550e7023948f199616fdfbb0f09711fd615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com> Date: Wed, 30 Apr 2014 19:53:13 +0300 Subject: [PATCH] man: update journald rate limit defaults
This brings the man page back into sync with the actual code. --- man/journald.conf.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git man/journald.conf.xml man/journald.conf.xml index 239a2ec..5cd09a2 100644 --- man/journald.conf.xml +++ man/journald.conf.xml @@ -190,8 +190,8 @@ limiting is applied per-service, so that two services which log do not interfere with each other's - limits. Defaults to 200 messages in - 10s. The time specification for + limits. Defaults to 1000 messages in + 30s. The time specification for <varname>RateLimitInterval=</varname> may be specified in the following units: <literal>s</literal>, -- 1.7.9.2 ++++++ 0008-mount-setup-fix-counting-of-early-mounts-without-SMA.patch ++++++
From 7c96ab1d2484ab2df3c6a84f1a1d2e076f469085 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 13 Aug 2014 20:01:19 +0200 Subject: [PATCH] mount-setup: fix counting of early mounts without SMACK
http://lists.freedesktop.org/archives/systemd-devel/2014-August/021772.html --- src/core/mount-setup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git src/core/mount-setup.c src/core/mount-setup.c index 206f89a..cc2633e 100644 --- src/core/mount-setup.c +++ src/core/mount-setup.c @@ -63,8 +63,13 @@ typedef struct MountPoint { /* The first three entries we might need before SELinux is up. The * fourth (securityfs) is needed by IMA to load a custom policy. The - * other ones we can delay until SELinux and IMA are loaded. */ + * other ones we can delay until SELinux and IMA are loaded. When + * SMACK is enabled we need smackfs, too, so it's a fifth one. */ +#ifdef HAVE_SMACK #define N_EARLY_MOUNT 5 +#else +#define N_EARLY_MOUNT 4 +#endif static const MountPoint mount_table[] = { { "sysfs", "/sys", "sysfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, -- 1.7.9.2 ++++++ 0008-sd-bus-don-t-access-invalid-memory-if-a-signal-match.patch ++++++
From bbb6ff0216a7c081a2e63e01b1f121592b0165bb Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 14 Mar 2014 21:12:36 +0100 Subject: [PATCH] sd-bus: don't access invalid memory if a signal matcher was freed from its own callback
--- src/libsystemd/sd-bus/bus-match.c | 3 +++ 1 file changed, 3 insertions(+) diff --git src/libsystemd/sd-bus/bus-match.c src/libsystemd/sd-bus/bus-match.c index 8280488..c54ca8d 100644 --- src/libsystemd/sd-bus/bus-match.c +++ src/libsystemd/sd-bus/bus-match.c @@ -293,6 +293,9 @@ int bus_match_run( r = bus_maybe_reply_error(m, r, &error_buffer); if (r != 0) return r; + + if (bus && bus->match_callbacks_modified) + return 0; } return bus_match_run(bus, node->next, m); -- 1.7.9.2 ++++++ 0008-shared-conf-parser-don-t-leak-memory-on-error-in-DEF.patch ++++++ Based on 77c10205bb337585c320e91af4b416f2dcc6faba Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 18 Sep 2014 13:47:00 +0200 Subject: [PATCH] shared: conf-parser - don't leak memory on error in DEFINE_CONFIG_PARSE_ENUMV Found by Coverity. Fixes CID #1237746. --- src/shared/conf-parser.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- src/shared/conf-parser.h +++ src/shared/conf-parser.h 2014-09-18 13:14:43.730234764 +0000 @@ -171,7 +171,8 @@ int log_syntax_internal(const char *unit void *data, \ void *userdata) { \ \ - type **enums = data, *xs, x, *ys; \ + type **enums = data, x, *ys; \ + _cleanup_free_ type *xs = NULL; \ char *w, *state; \ size_t l, i = 0; \ \ @@ -187,6 +188,7 @@ int log_syntax_internal(const char *unit \ FOREACH_WORD(w, l, rvalue, state) { \ _cleanup_free_ char *en = NULL; \ + type *new_xs; \ \ en = strndup(w, l); \ if (!en) \ @@ -212,8 +214,10 @@ int log_syntax_internal(const char *unit continue; \ \ *(xs + i) = x; \ - xs = realloc(xs, (++i + 1) * sizeof(type)); \ - if (!xs) \ + new_xs = realloc(xs, (++i + 1) * sizeof(type)); \ + if (new_xs) \ + xs = new_xs; \ + else \ return -ENOMEM; \ \ *(xs + i) = invalid; \ @@ -221,5 +225,7 @@ int log_syntax_internal(const char *unit \ free(*enums); \ *enums = xs; \ + xs = NULL; \ + \ return 0; \ } ++++++ 0008-shell-completion-prevent-mangling-unit-names-bash.patch ++++++ Based on c317a1a19cd9584e07ee43f1b6fafc26c2c75cca Mon Sep 17 00:00:00 2001 From: Eric Cook <llua@gmx.com> Date: Sun, 27 Jul 2014 15:07:03 -0400 Subject: [PATCH] shell-completion: prevent mangling unit names (bash) This fixes the issue noted by Zbigniew in most cases. if a unit's name is enclosed in single quotes completion still will not happen after the first `\'. https://bugs.freedesktop.org/show_bug.cgi?id=78388 --- shell-completion/bash/systemctl.in | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git shell-completion/bash/systemctl.in shell-completion/bash/systemctl.in index 69ef04b..64b15df 100644 --- shell-completion/bash/systemctl +++ shell-completion/bash/systemctl @@ -158,20 +158,25 @@ _systemctl () { elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then comps=$( __get_all_units $mode ) + compopt -o filenames elif __contains_word "$verb" ${VERBS[ENABLED_UNITS]}; then comps=$( __get_enabled_units $mode ) + compopt -o filenames elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then comps=$( __get_disabled_units $mode ) + compopt -o filenames elif __contains_word "$verb" ${VERBS[REENABLABLE_UNITS]}; then comps=$( __get_disabled_units $mode; __get_enabled_units $mode ) + compopt -o filenames elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then comps=$( __filter_units_by_property $mode CanStart yes \ $( __get_startable_units $mode)) + compopt -o filenames elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then comps=$( __filter_units_by_property $mode CanStart yes \ @@ -179,24 +184,30 @@ _systemctl () { | while read -r line; do \ [[ "$line" =~ \.(device|snapshot|socket|timer)$ ]] || echo " $line"; \ done )) + compopt -o filenames elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then comps=$( __filter_units_by_property $mode CanStop yes \ $( __get_active_units $mode ) ) + compopt -o filenames elif __contains_word "$verb" ${VERBS[RELOADABLE_UNITS]}; then comps=$( __filter_units_by_property $mode CanReload yes \ $( __get_active_units $mode ) ) + compopt -o filenames elif __contains_word "$verb" ${VERBS[ISOLATABLE_UNITS]}; then comps=$( __filter_units_by_property $mode AllowIsolate yes \ $( __get_all_units $mode ) ) + compopt -o filenames elif __contains_word "$verb" ${VERBS[FAILED_UNITS]}; then comps=$( __get_failed_units $mode ) + compopt -o filenames elif __contains_word "$verb" ${VERBS[MASKED_UNITS]}; then comps=$( __get_masked_units $mode ) + compopt -o filenames elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[NAME]}; then comps='' @@ -221,7 +232,7 @@ _systemctl () { | { while read -r a b; do echo " $a"; done; } ) fi - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + COMPREPLY=( $(compgen -o filenames -W '$comps' -- "$cur") ) return 0 } -- 1.7.9.2 ++++++ 0008-systemctl-kill-mode-is-long-long-gone-don-t-mention-.patch ++++++
From 0088d63151e088d62104d88f866e9eb049091c22 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 25 Mar 2014 00:31:48 +0100 Subject: [PATCH] systemctl: --kill-mode is long long gone, don't mention it in the man page
--- man/systemctl.xml | 5 ++--- shell-completion/bash/systemctl | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git man/systemctl.xml man/systemctl.xml index 77447dd..b4727d9 100644 --- man/systemctl.xml +++ man/systemctl.xml @@ -664,9 +664,8 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service <listitem> <para>Send a signal to one or more processes of the unit. Use <option>--kill-who=</option> to select which - process to kill. Use <option>--kill-mode=</option> to select - the kill mode and <option>--signal=</option> to select the - signal to send.</para> + process to kill. Use <option>--signal=</option> to select + the signal to send.</para> </listitem> </varlistentry> <varlistentry> diff --git shell-completion/bash/systemctl shell-completion/bash/systemctl index dc7ef66..0dfc868 100644 --- shell-completion/bash/systemctl +++ shell-completion/bash/systemctl @@ -74,7 +74,7 @@ _systemctl () { [STANDALONE]='--all -a --reverse --after --before --defaults --fail --ignore-dependencies --failed --force -f --full -l --global --help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall --quiet -q --privileged -P --system --user --version --runtime' - [ARG]='--host -H --kill-mode --kill-who --property -p --signal -s --type -t --state --root' + [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root' ) if __contains_word "--user" ${COMP_WORDS[*]}; then @@ -99,9 +99,6 @@ _systemctl () { --kill-who) comps='all control main' ;; - --kill-mode) - comps='control-group process' - ;; --root) comps=$(compgen -A directory -- "$cur" ) compopt -o filenames -- 1.7.9.2 ++++++ 0008-util-introduce-sethostname_idempotent.patch ++++++ Based on 605f81a8968b2df8a28cca2cf11db99ab948a2af Mon Sep 17 00:00:00 2001 From: Michal Sekletar <msekleta@redhat.com> Date: Tue, 21 Oct 2014 18:17:54 +0200 Subject: [PATCH] util: introduce sethostname_idempotent Function queries system hostname and applies changes only when necessary. Also, migrate all client of sethostname to sethostname_idempotent while at it. --- src/core/hostname-setup.c | 2 +- src/hostname/hostnamed.c | 2 +- src/nspawn/nspawn.c | 2 +- src/shared/util.c | 20 ++++++++++++++++++++ src/shared/util.h | 2 ++ 5 files changed, 25 insertions(+), 3 deletions(-) --- src/core/hostname-setup.c +++ src/core/hostname-setup.c 2014-10-29 00:00:00.000000000 +0000 @@ -99,7 +99,7 @@ int hostname_setup(void) { hn = "localhost"; } - if (sethostname(hn, strlen(hn)) < 0) { + if (sethostname_idempotent(hn) < 0) { log_warning("Failed to set hostname to <%s>: %m", hn); return -errno; } --- src/hostname/hostnamed.c +++ src/hostname/hostnamed.c 2014-10-29 14:13:26.124337751 +0000 @@ -244,7 +244,7 @@ static int context_write_data_hostname(C else hn = c->data[PROP_HOSTNAME]; - if (sethostname(hn, strlen(hn)) < 0) + if (sethostname_idempotent(hn) < 0) return -errno; return 0; --- src/nspawn/nspawn.c +++ src/nspawn/nspawn.c 2014-10-29 00:00:00.000000000 +0000 @@ -981,7 +981,7 @@ static int setup_hostname(void) { if (arg_share_system) return 0; - if (sethostname(arg_machine, strlen(arg_machine)) < 0) + if (sethostname_idempotent(arg_machine) < 0) return -errno; return 0; --- src/shared/util.c +++ src/shared/util.c 2014-10-29 00:00:00.000000000 +0000 @@ -6451,6 +6451,26 @@ int fd_warn_permissions(const char *path return 0; } +int sethostname_idempotent(const char *s) { + int r; + char buf[HOST_NAME_MAX + 1] = {}; + + assert(s); + + r = gethostname(buf, sizeof(buf)); + if (r < 0) + return -errno; + + if (streq(buf, s)) + return 0; + + r = sethostname(buf, strlen(buf)); + if (r < 0) + return -errno; + + return 1; +} + unsigned long personality_from_string(const char *p) { /* Parse a personality specifier. We introduce our own --- src/shared/util.h +++ src/shared/util.h 2014-10-29 14:14:15.764337717 +0000 @@ -899,3 +899,5 @@ union file_handle_union { }; int umount_recursive(const char *target, int flags); + +int sethostname_idempotent(const char *s); ++++++ 0009-ask-password-when-the-user-types-a-overly-long-passw.patch ++++++
From 036eeac5a1799fa2c0ae11a14d8c667b5d303189 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Tue, 25 Mar 2014 01:27:05 +0100 Subject: [PATCH] ask-password: when the user types a overly long password, beep and refuse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
Based on a similar patch from David Härdeman. --- src/shared/ask-password-api.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git src/shared/ask-password-api.c src/shared/ask-password-api.c index 117f0c6..96f16cc 100644 --- src/shared/ask-password-api.c +++ src/shared/ask-password-api.c @@ -207,6 +207,11 @@ int ask_password_tty( if (ttyfd >= 0) loop_write(ttyfd, "(no echo) ", 10, false); } else { + if (p >= sizeof(passphrase)-1) { + loop_write(ttyfd, "\a", 1, false); + continue; + } + passphrase[p++] = c; if (!silent_mode && ttyfd >= 0) -- 1.7.9.2 ++++++ 0009-bus-fix-bus_print_property-to-use-int-for-booleans.patch ++++++
From c2fa048c4a70c8386c6d8fe939e5ea9edecf1e98 Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Thu, 18 Sep 2014 13:28:28 +0200 Subject: [PATCH] bus: fix bus_print_property() to use "int" for booleans
We always use "int" if we retrieve boolean values from sd-bus, as "bool" is only a single byte, but full int on va-args. Thanks to Werner Fink for the report! --- src/libsystemd/sd-bus/bus-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/libsystemd/sd-bus/bus-util.c src/libsystemd/sd-bus/bus-util.c index 7c6da60..9018bce 100644 --- src/libsystemd/sd-bus/bus-util.c +++ src/libsystemd/sd-bus/bus-util.c @@ -631,7 +631,7 @@ int bus_print_property(const char *name, sd_bus_message *property, bool all) { } case SD_BUS_TYPE_BOOLEAN: { - bool b; + int b; r = sd_bus_message_read_basic(property, type, &b); if (r < 0) -- 1.7.9.2 ++++++ 0009-core-clean-up-signal-reset-logic-when-reexec.patch ++++++
From 9bfcda9528636914aef3e0ab91191bb81654c83d Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 20 Jun 2014 16:58:21 +0200 Subject: [PATCH] core: clean-up signal reset logic when reexec
There's no need to save the old sigmask, if we are going to die. Let's simplify this. Also, reset all the signal handlers, so that we don't leave SIG_IGN set for some of them across reexec. --- src/core/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git src/core/main.c src/core/main.c index 863ba52..6981e72 100644 --- src/core/main.c +++ src/core/main.c @@ -1824,7 +1824,7 @@ finish: if (reexecute) { const char **args; unsigned i, args_size; - sigset_t ss, o_ss; + sigset_t ss; /* Close and disarm the watchdog, so that the new * instance can reinitialize it, but doesn't get @@ -1910,8 +1910,10 @@ finish: /* reenable any blocked signals, especially important * if we switch from initial ramdisk to init=... */ - sigemptyset(&ss); - sigprocmask(SIG_SETMASK, &ss, &o_ss); + reset_all_signal_handlers(); + + assert_se(sigemptyset(&ss) == 0); + assert_se(sigprocmask(SIG_SETMASK, &ss, NULL) == 0); if (switch_root_init) { args[0] = switch_root_init; @@ -1931,8 +1933,6 @@ finish: log_error("Failed to execute /bin/sh, giving up: %m"); } else log_warning("Failed to execute /sbin/init, giving up: %m"); - - sigprocmask(SIG_SETMASK, &o_ss, NULL); } if (arg_serialization) { -- 1.7.9.2 ++++++ 0009-hwdb-Update-database-of-Bluetooth-company-identifier.patch ++++++
From 2e3390ea4684b954edce66b7758b5371d3338a9f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann <marcel@holtmann.org> Date: Thu, 2 Oct 2014 07:53:15 +0200 Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
--- hwdb/20-bluetooth-vendor-product.hwdb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git hwdb/20-bluetooth-vendor-product.hwdb hwdb/20-bluetooth-vendor-product.hwdb index 14aee74..ee2efdf 100644 --- hwdb/20-bluetooth-vendor-product.hwdb +++ hwdb/20-bluetooth-vendor-product.hwdb @@ -1148,3 +1148,21 @@ bluetooth:v017B* bluetooth:v017C* ID_VENDOR_FROM_DATABASE=Daimler AG + +bluetooth:v017D* + ID_VENDOR_FROM_DATABASE=BatAndCat + +bluetooth:v017E* + ID_VENDOR_FROM_DATABASE=BluDotz Ltd + +bluetooth:v017F* + ID_VENDOR_FROM_DATABASE=XTel ApS + +bluetooth:v0180* + ID_VENDOR_FROM_DATABASE=Gigaset Communications GmbH + +bluetooth:v0181* + ID_VENDOR_FROM_DATABASE=Gecko Health Innovations, Inc. + +bluetooth:v0182* + ID_VENDOR_FROM_DATABASE=HOP Ubiquitous -- 1.7.9.2 ++++++ 0009-hwdb-update.patch ++++++ ++++ 3363 lines (skipped) ++++++ 0009-journal-do-not-leak-mmaps-on-OOM.patch ++++++
From b67ddc7bbe31cde7f69f9814204d9bb1d4623c47 Mon Sep 17 00:00:00 2001 From: Philippe De Swert <philippedeswert@gmail.com> Date: Wed, 10 Sep 2014 12:20:41 +0300 Subject: [PATCH] journal: do not leak mmaps on OOM
After a section of memory is succesfully allocated, some of the following actions can still fail due to lack of memory. In this case -ENOMEM is returned without actually freeing the already mapped memory. Found with coverity. Fixes: CID#1237762 --- src/journal/mmap-cache.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git src/journal/mmap-cache.c src/journal/mmap-cache.c index 7dbbb5e..908562d 100644 --- src/journal/mmap-cache.c +++ src/journal/mmap-cache.c @@ -496,15 +496,15 @@ static int add_mmap( c = context_add(m, context); if (!c) - return -ENOMEM; + goto outofmem; f = fd_add(m, fd); if (!f) - return -ENOMEM; + goto outofmem; w = window_add(m); if (!w) - return -ENOMEM; + goto outofmem; w->keep_always = keep_always; w->ptr = d; @@ -522,6 +522,10 @@ static int add_mmap( if (ret) *ret = (uint8_t*) w->ptr + (offset - w->offset); return 1; + +outofmem: + munmap(d, wsize); + return -ENOMEM; } int mmap_cache_get( -- 1.7.9.2 ++++++ 0009-journald-Fix-off-by-one-error-in-Missed-X-kernel-mes.patch ++++++
From b9c488f60050248b35640f28e4d00958702ba1c3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra <eelco.dolstra@logicblox.com> Date: Wed, 6 Aug 2014 13:14:51 +0200 Subject: [PATCH] journald: Fix off-by-one error in "Missed X kernel messages" warning
On receiving a message, "kernel_seqnum" is set to "serial + 1". So subtracting 1 will cause messages like "Missed 0 kernel messages", which should be "Missed 1 kernel messages". --- src/journal/journald-kmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/journal/journald-kmsg.c src/journal/journald-kmsg.c index 9935986..fb8ea08 100644 --- src/journal/journald-kmsg.c +++ src/journal/journald-kmsg.c @@ -152,7 +152,7 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) { /* Did we lose any? */ if (serial > *s->kernel_seqnum) server_driver_message(s, SD_MESSAGE_JOURNAL_MISSED, "Missed %"PRIu64" kernel messages", - serial - *s->kernel_seqnum - 1); + serial - *s->kernel_seqnum); /* Make sure we never read this one again. Note that * we always store the next message serial we expect -- 1.7.9.2 ++++++ 0009-journald-always-add-syslog-facility-for-messages-com.patch ++++++
From 36dd072cdf03dcac0fcd2d6b42f261444dc7ac88 Mon Sep 17 00:00:00 2001 From: Michal Sekletar <msekleta@redhat.com> Date: Fri, 25 Jul 2014 14:38:22 +0200 Subject: [PATCH] journald: always add syslog facility for messages coming from kmsg
Set SYSLOG_FACILITY field for kernel log messages too. Setting only SYSLOG_IDENTIFIER="kernel" is not sufficient and tools reading journal maybe confused by missing SYSLOG_FACILITY field for kernel log messages. --- src/journal/journald-kmsg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git src/journal/journald-kmsg.c src/journal/journald-kmsg.c index 12992e7..bb62a76 100644 --- src/journal/journald-kmsg.c +++ src/journal/journald-kmsg.c @@ -274,6 +274,9 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) { if (asprintf(&syslog_priority, "PRIORITY=%i", priority & LOG_PRIMASK) >= 0) IOVEC_SET_STRING(iovec[n++], syslog_priority); + if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0) + IOVEC_SET_STRING(iovec[n++], syslog_facility); + if ((priority & LOG_FACMASK) == LOG_KERN) IOVEC_SET_STRING(iovec[n++], "SYSLOG_IDENTIFIER=kernel"); else { @@ -295,9 +298,6 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) { if (syslog_pid) IOVEC_SET_STRING(iovec[n++], syslog_pid); } - - if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0) - IOVEC_SET_STRING(iovec[n++], syslog_facility); } message = cunescape_length_with_prefix(p, pl, "MESSAGE="); -- 1.7.9.2 ++++++ 0009-logind-fix-reference-to-systemd-user-sessions.servic.patch ++++++
From 646e392e10924454576f10b072f78d7676422816 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 6 Mar 2014 04:52:31 +0100 Subject: [PATCH] logind: fix reference to systemd-user-sessions.service
--- src/login/logind-session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/login/logind-session.c src/login/logind-session.c index 548f049..3700522 100644 --- src/login/logind-session.c +++ src/login/logind-session.c @@ -490,7 +490,7 @@ static int session_start_scope(Session *s) { if (!scope) return log_oom(); - r = manager_start_scope(s->manager, scope, s->leader, s->user->slice, description, "systemd-logind.service", "systemd-user-session.service", &error, &job); + r = manager_start_scope(s->manager, scope, s->leader, s->user->slice, description, "systemd-logind.service", "systemd-user-sessions.service", &error, &job); if (r < 0) { log_error("Failed to start session scope %s: %s %s", scope, bus_error_message(&error, r), error.name); -- 1.7.9.2 ++++++ 0009-mount-don-t-send-out-PropertiesChanged-message-if-ac.patch ++++++
From ff5f34d08c191c326c41a083745522383ac86cae Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 26 Feb 2014 04:27:50 +0100 Subject: [PATCH] mount: don't send out PropertiesChanged message if actually nothing got changed
--- src/core/mount.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git src/core/mount.c src/core/mount.c index b35e507..98812c9 100644 --- src/core/mount.c +++ src/core/mount.c @@ -1390,7 +1390,7 @@ static int mount_add_one( _cleanup_free_ char *e = NULL, *w = NULL, *o = NULL, *f = NULL; bool load_extras = false; MountParameters *p; - bool delete; + bool delete, changed = false; Unit *u; int r; @@ -1458,6 +1458,7 @@ static int mount_add_one( } unit_add_to_load_queue(u); + changed = true; } else { delete = false; @@ -1476,6 +1477,7 @@ static int mount_add_one( /* Load in the extras later on, after we * finished initialization of the unit */ load_extras = true; + changed = true; } } @@ -1488,10 +1490,16 @@ static int mount_add_one( } p = &MOUNT(u)->parameters_proc_self_mountinfo; + + changed = changed || + !streq_ptr(p->options, options) || + !streq_ptr(p->what, what) || + !streq_ptr(p->fstype, fstype); + if (set_flags) { MOUNT(u)->is_mounted = true; MOUNT(u)->just_mounted = !MOUNT(u)->from_proc_self_mountinfo; - MOUNT(u)->just_changed = !streq_ptr(p->options, o); + MOUNT(u)->just_changed = changed; } MOUNT(u)->from_proc_self_mountinfo = true; @@ -1514,7 +1522,8 @@ static int mount_add_one( goto fail; } - unit_add_to_dbus_queue(u); + if (changed) + unit_add_to_dbus_queue(u); return 0; -- 1.7.9.2 ++++++ 0009-nspawn-properly-format-container_uuid-in-UUID-format.patch ++++++
From 9f24adc288de142d6606fde3c5a5971613f3b6b9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 16 May 2014 19:37:19 +0200 Subject: [PATCH] nspawn: properly format container_uuid in UUID format
http://lists.freedesktop.org/archives/systemd-devel/2014-April/018971.html --- src/nspawn/nspawn.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git src/nspawn/nspawn.c src/nspawn/nspawn.c index 0bd52da..6be4dca 100644 --- src/nspawn/nspawn.c +++ src/nspawn/nspawn.c @@ -769,6 +769,15 @@ static int setup_resolv_conf(const char *dest) { return 0; } +static char* id128_format_as_uuid(sd_id128_t id, char s[37]) { + + snprintf(s, 37, + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + SD_ID128_FORMAT_VAL(id)); + + return s; +} + static int setup_boot_id(const char *dest) { _cleanup_free_ char *from = NULL, *to = NULL; sd_id128_t rnd = {}; @@ -794,10 +803,7 @@ static int setup_boot_id(const char *dest) { return r; } - snprintf(as_uuid, sizeof(as_uuid), - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - SD_ID128_FORMAT_VAL(rnd)); - char_array_0(as_uuid); + id128_format_as_uuid(rnd, as_uuid); r = write_string_file(from, as_uuid); if (r < 0) { @@ -2954,7 +2960,9 @@ int main(int argc, char *argv[]) { } if (!sd_id128_equal(arg_uuid, SD_ID128_NULL)) { - if (asprintf((char**)(envp + n_env++), "container_uuid=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(arg_uuid)) < 0) { + char as_uuid[37]; + + if (asprintf((char**)(envp + n_env++), "container_uuid=%s", id128_format_as_uuid(arg_uuid, as_uuid)) < 0) { log_oom(); goto child_fail; } -- 1.7.9.2 ++++++ 0009-sd-bus-don-t-choke-if-somebody-sends-us-a-message-wi.patch ++++++
From 5a4d665ad679a8436f1210ba67d713a8f0b91b96 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Fri, 14 Mar 2014 21:15:32 +0100 Subject: [PATCH] sd-bus: don't choke if somebody sends us a message with a unix fd count of 0
It's kinda pointless to include a unix fd header field in messages if it carries the value 0, but let's do this anyway... --- src/libsystemd/sd-bus/bus-message.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git src/libsystemd/sd-bus/bus-message.c src/libsystemd/sd-bus/bus-message.c index 97ab0e3..b9d7f6d 100644 --- src/libsystemd/sd-bus/bus-message.c +++ src/libsystemd/sd-bus/bus-message.c @@ -4885,6 +4885,7 @@ int bus_message_parse_fields(sd_bus_message *m) { size_t ri; int r; uint32_t unix_fds = 0; + bool unix_fds_set = false; void *offsets = NULL; unsigned n_offsets = 0; size_t sz = 0; @@ -5097,7 +5098,7 @@ int bus_message_parse_fields(sd_bus_message *m) { } case BUS_MESSAGE_HEADER_UNIX_FDS: - if (unix_fds != 0) + if (unix_fds_set) return -EBADMSG; if (!streq(signature, "u")) @@ -5107,9 +5108,7 @@ int bus_message_parse_fields(sd_bus_message *m) { if (r < 0) return -EBADMSG; - if (unix_fds == 0) - return -EBADMSG; - + unix_fds_set = true; break; default: -- 1.7.9.2 ++++++ 0009-units-make-systemd-journald.service-Type-notify.patch ++++++ Based on a87a38c20196a4aeb56b6ba71d688eefd0b21c30 Mon Sep 17 00:00:00 2001 From: Michal Schmidt <mschmidt@redhat.com> Date: Tue, 4 Nov 2014 20:28:08 +0100 Subject: [PATCH] units: make systemd-journald.service Type=notify It already calls sd_notify(), so it looks like an oversight. Without it, its ordering to systemd-journal-flush.service is non-deterministic and the SIGUSR1 from flushing may kill journald before it has its signal handlers set up. https://bugs.freedesktop.org/show_bug.cgi?id=85871 https://bugzilla.redhat.com/show_bug.cgi?id=1159641 --- units/systemd-journald.service.in | 1 + 1 file changed, 1 insertion(+) --- units/systemd-journald.service.in +++ units/systemd-journald.service.in 2014-11-10 12:22:08.461949786 +0000 @@ -14,6 +14,7 @@ After=systemd-journald.socket syslog.soc Before=sysinit.target [Service] +Type=notify ExecStart=@rootlibexecdir@/systemd-journald Restart=always RestartSec=0 ++++++ 0009-util-fix-copy-paste-error-and-actually-set-the-new-h.patch ++++++
From a9169c1c589bf7c7a29e7905d17e350ce7c7c48e Mon Sep 17 00:00:00 2001 From: Michal Sekletar <msekleta@redhat.com> Date: Mon, 27 Oct 2014 11:08:26 +0100 Subject: [PATCH] util: fix copy-paste error and actually set the new hostname
Reported-by: sztanpet on irc --- src/shared/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/shared/util.c src/shared/util.c index 7d94a28..4143f6d 100644 --- src/shared/util.c +++ src/shared/util.c @@ -7189,7 +7189,7 @@ int sethostname_idempotent(const char *s) { if (streq(buf, s)) return 0; - r = sethostname(buf, strlen(buf)); + r = sethostname(s, strlen(s)); if (r < 0) return -errno; -- 1.7.9.2 ++++++ 0010-hwdb-Update-database-of-Bluetooth-company-identifier.patch ++++++
From 5d20fde4a5c4dff4d7c737b545fbd13582d544c1 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann <marcel@holtmann.org> Date: Fri, 31 Oct 2014 20:37:59 +0100 Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
--- hwdb/20-bluetooth-vendor-product.hwdb | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git hwdb/20-bluetooth-vendor-product.hwdb hwdb/20-bluetooth-vendor-product.hwdb index ee2efdf..58ca87d 100644 --- hwdb/20-bluetooth-vendor-product.hwdb +++ hwdb/20-bluetooth-vendor-product.hwdb @@ -1166,3 +1166,60 @@ bluetooth:v0181* bluetooth:v0182* ID_VENDOR_FROM_DATABASE=HOP Ubiquitous + +bluetooth:v0183* + ID_VENDOR_FROM_DATABASE=To Be Assigned + +bluetooth:v0184* + ID_VENDOR_FROM_DATABASE=Nectar + +bluetooth:v0185* + ID_VENDOR_FROM_DATABASE=bel'apps LLC + +bluetooth:v0186* + ID_VENDOR_FROM_DATABASE=CORE Lighting Ltd + +bluetooth:v0187* + ID_VENDOR_FROM_DATABASE=Seraphim Sense Ltd + +bluetooth:v0188* + ID_VENDOR_FROM_DATABASE=Unico RBC + +bluetooth:v0189* + ID_VENDOR_FROM_DATABASE=Physical Enterprises Inc. + +bluetooth:v018A* + ID_VENDOR_FROM_DATABASE=Able Trend Technology Limited + +bluetooth:v018B* + ID_VENDOR_FROM_DATABASE=Konica Minolta, Inc. + +bluetooth:v018C* + ID_VENDOR_FROM_DATABASE=Wilo SE + +bluetooth:v018D* + ID_VENDOR_FROM_DATABASE=Extron Design Services + +bluetooth:v018E* + ID_VENDOR_FROM_DATABASE=Fitbit, Inc. + +bluetooth:v018F* + ID_VENDOR_FROM_DATABASE=Fireflies Systems + +bluetooth:v0190* + ID_VENDOR_FROM_DATABASE=Intelletto Technologies Inc. + +bluetooth:v0191* + ID_VENDOR_FROM_DATABASE=FDK CORPORATION + +bluetooth:v0192* + ID_VENDOR_FROM_DATABASE=Cloudleaf, Inc + +bluetooth:v0193* + ID_VENDOR_FROM_DATABASE=Maveric Automation LLC + +bluetooth:v0194* + ID_VENDOR_FROM_DATABASE=Acoustic Stream Corporation + +bluetooth:v0195* + ID_VENDOR_FROM_DATABASE=Zuli -- 1.7.9.2 ++++++ 0010-logind-allow-suspending-if-there-are-no-displays.patch ++++++
From d36d90933a832bd1e1eb8e3d16b3de73f91636b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com> Date: Mon, 28 Apr 2014 00:58:56 +0300 Subject: [PATCH] logind: allow suspending if there are no displays
With proprietary graphics drivers, there won't be any 'drm' devices in sysfs, so logind will never suspend the system upon closing the lid, even if only one (internal) display is connected. This has been reported by multiple users so far. IMHO, it's better to suspend the system in this case for safety reasons, to avoid having nvidia blob users' laptops overheat, for the same reason that sleep inhibitors are overridden (LidSwitchIgnoreInhibited=yes). --- src/login/logind-action.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git src/login/logind-action.c src/login/logind-action.c index ae9cd48..36ee441 100644 --- src/login/logind-action.c +++ src/login/logind-action.c @@ -79,14 +79,12 @@ int manager_handle_action( return 0; } - /* If we have more than one or no displays connected, - * don't react to lid closing. The no display case we - * treat like this under the assumption that there is - * no modern drm driver available. */ + /* If we have more than one display connected, + * don't react to lid closing. */ n = manager_count_displays(m); if (n < 0) log_warning("Display counting failed: %s", strerror(-n)); - else if (n != 1) { + else if (n > 1) { log_debug("Ignoring lid switch request, %i displays connected.", n); return 0; } -- 1.7.9.2 ++++++ 0010-machine_kill-Don-t-kill-the-unit-when-killing-the-le.patch ++++++
From 9d685ca8193c0da3ad5746be3871f5350179a3b3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra <eelco.dolstra@logicblox.com> Date: Thu, 14 Aug 2014 19:59:16 +0200 Subject: [PATCH] machine_kill(): Don't kill the unit when killing the leader
If "machinectl poweroff" or "machinectl reboot" is used on a systemd-nspawn container started with --keep-unit and --register, it should *only* send the appropriate signal to the leader PID (i.e. the container's systemd process). It shouldn't fall through to manager_kill_unit() to also send the signal to the unit. The latter ends up killing systemd-nspawn, which takes down the container prematurely. --- src/machine/machine.c | 2 ++ 1 file changed, 2 insertions(+) diff --git src/machine/machine.c src/machine/machine.c index 1c9177e..13d3448 100644 --- src/machine/machine.c +++ src/machine/machine.c @@ -493,6 +493,8 @@ int machine_kill(Machine *m, KillWho who, int signo) { if (kill(m->leader, signo) < 0) return -errno; + + return 0; } /* Otherwise make PID 1 do it for us, for the entire cgroup */ -- 1.7.9.2 ++++++ 0010-man-update-link-to-LSB.patch ++++++
From 27d14fb331ba8144f99f4da2d13f15cf5c8b8a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Thu, 6 Mar 2014 08:10:19 -0500 Subject: [PATCH] man: update link to LSB
https://bugzilla.redhat.com/show_bug.cgi?id=1073402 --- man/daemon.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git man/daemon.xml man/daemon.xml index fd29ba7..ab58d08 100644 --- man/daemon.xml +++ man/daemon.xml @@ -252,7 +252,7 @@ detect service errors and problems. It is recommended to follow the exit code scheme as defined in the <ulink - url="http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB + url="http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB recommendations for SysV init scripts</ulink>.</para></listitem> @@ -395,7 +395,7 @@ exclusively on boot (and manually by the administrator) via SysV init scripts, as detailed in the <ulink - url="http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB + url="http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB Linux Standard Base Core Specification</ulink>. This method of activation is supported ubiquitously on Linux -- 1.7.9.2 ++++++ 0010-manager-use-correct-cleanup-function.patch ++++++
From 807d0cca2b0daf4cd725298c1b5e062b1126f15b Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Thu, 11 Sep 2014 21:14:53 +0200 Subject: [PATCH] manager: use correct cleanup function
Close the dir instead of attempt to free it. Introduced in 874310b7b68c4c0d36ff07397db30a959bb7dae5 Found with coverity. Fixes: CID#996368 --- src/core/manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/core/manager.c src/core/manager.c index 9abdf47..095111e 100644 --- src/core/manager.c +++ src/core/manager.c @@ -896,7 +896,7 @@ static int manager_coldplug(Manager *m) { static void manager_build_unit_path_cache(Manager *m) { char **i; - _cleanup_free_ DIR *d = NULL; + _cleanup_closedir_ DIR *d = NULL; int r; assert(m); -- 1.7.9.2 ++++++ 0010-mount-don-t-fire-PropertiesChanged-signals-for-mount.patch ++++++
From aef831369cd2a7a1bd4a58dd96ff8628ed6a85f9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 26 Feb 2014 04:28:37 +0100 Subject: [PATCH] mount: don't fire PropertiesChanged signals for mounts that are stopped
--- src/core/mount.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git src/core/mount.c src/core/mount.c index 98812c9..7a92e1c 100644 --- src/core/mount.c +++ src/core/mount.c @@ -1679,20 +1679,20 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents, Mount *mount = MOUNT(u); if (!mount->is_mounted) { - /* This has just been unmounted. */ mount->from_proc_self_mountinfo = false; switch (mount->state) { case MOUNT_MOUNTED: + /* This has just been unmounted by + * somebody else, follow the state + * change. */ mount_enter_dead(mount, MOUNT_SUCCESS); break; default: - mount_set_state(mount, mount->state); break; - } } else if (mount->just_mounted || mount->just_changed) { @@ -1703,6 +1703,9 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents, case MOUNT_DEAD: case MOUNT_FAILED: + /* This has just been mounted by + * somebody else, follow the state + * change. */ mount_enter_mounted(mount, MOUNT_SUCCESS); break; -- 1.7.9.2 ++++++ 0010-shutdown-do-final-unmounting-only-if-not-running-ins.patch ++++++ Based on d89b5fed9ea5d9ec293585cb85bb27b56ea6ac9c Mon Sep 17 00:00:00 2001 From: Michal Sekletar <msekleta@redhat.com> Date: Tue, 21 Oct 2014 18:38:42 +0200 Subject: [PATCH] shutdown: do final unmounting only if not running inside the container If we run in the container then we run in a mount namespace. If namespace dies then kernel should do unmounting for us, hence we skip unmounting in containers. Also, it may be the case that we no longer have capability to do umount, because we are running in the unprivileged container. See: http://lists.freedesktop.org/archives/systemd-devel/2014-October/023536.html --- src/core/shutdown.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- src/core/shutdown.c +++ src/core/shutdown.c 2014-10-29 14:18:38.767837898 +0000 @@ -278,6 +278,7 @@ int main(int argc, char *argv[]) { broadcast_signal(SIGKILL, true, false); if (in_container) { + need_umount = false; need_swapoff = false; need_dm_detach = false; need_loop_detach = false; ++++++ 0010-util-treat-fuse.sshfs-as-a-network-filesystem.patch ++++++
From da92ca5eb506d513033e0c7a85daf25a7e1c9d0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 20 Jun 2014 22:43:49 -0400 Subject: [PATCH] util: treat fuse.sshfs as a network filesystem
https://bugs.freedesktop.org/show_bug.cgi?id=73727 --- src/shared/util.c | 1 + 1 file changed, 1 insertion(+) diff --git src/shared/util.c src/shared/util.c index 882a690..dbdb692 100644 --- src/shared/util.c +++ src/shared/util.c @@ -1514,6 +1514,7 @@ bool fstype_is_network(const char *fstype) { static const char table[] = "cifs\0" "smbfs\0" + "sshfs\0" "ncpfs\0" "ncp\0" "nfs\0" -- 1.7.9.2 ++++++ 0011-build-sys-add-pthread-flag-for-libsystemd-shared.patch ++++++
From 8e75477abdd838d3beddc5fd1c6a7707b22748b6 Mon Sep 17 00:00:00 2001 From: Ronny Chevalier <chevalier.ronny@gmail.com> Date: Sat, 21 Jun 2014 22:07:09 +0200 Subject: [PATCH] build-sys: add -pthread flag for libsystemd-shared
src/shared/async.c uses pthread so it will fail at link time if we link only to libsystemd-shared and use async --- Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git Makefile.am Makefile.am index c7653ea..00db82d 100644 --- Makefile.am +++ Makefile.am @@ -837,7 +837,8 @@ nodist_libsystemd_shared_la_SOURCES = \ libsystemd_shared_la_CFLAGS = \ $(AM_CFLAGS) \ - $(SECCOMP_CFLAGS) + $(SECCOMP_CFLAGS) \ + -pthread # ------------------------------------------------------------------------------ noinst_LTLIBRARIES += \ -- 1.7.9.2 ++++++ 0011-logs-show-fix-corrupt-output-with-empty-messages.patch ++++++
From 47d80904a1f72d559962cc5ad32fffd46672a34a Mon Sep 17 00:00:00 2001 From: Uoti Urpala <uoti.urpala@pp1.inet.fi> Date: Thu, 20 Feb 2014 03:00:09 +0200 Subject: [PATCH] logs-show: fix corrupt output with empty messages
If a message had zero length, journalctl would print no newline, and two output lines would be concatenated. Fix. The problem was introduced in commit 31f7bf199452 ("logs-show: print multiline messages"). Affected short and verbose output modes. Before fix: Feb 09 21:16:17 glyph dhclient[1323]: Feb 09 21:16:17 glyph NetworkManager[788]: <info> (enp4s2): DHCPv4 state changed nbi -> preinit after: Feb 09 21:16:17 glyph dhclient[1323]: Feb 09 21:16:17 glyph NetworkManager[788]: <info> (enp4s2): DHCPv4 state changed nbi -> preinit --- src/shared/logs-show.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git src/shared/logs-show.c src/shared/logs-show.c index 61c3652..12d4a1c 100644 --- src/shared/logs-show.c +++ src/shared/logs-show.c @@ -124,6 +124,11 @@ static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, Output } } + /* A special case: make sure that we print a newline when + the message is empty. */ + if (message_len == 0) + fputs("\n", f); + for (pos = message; pos < message + message_len; pos = end + 1, line++) { -- 1.7.9.2 ++++++ 0011-man-systemd-bootchart-fix-spacing-in-command.patch ++++++
From 82ed60080d327d7301fcd55f5a1f8511f894b9d5 Mon Sep 17 00:00:00 2001 From: Zachary Cook <zachcook1991@gmail.com> Date: Thu, 6 Mar 2014 03:49:49 -0500 Subject: [PATCH] man: systemd-bootchart - fix spacing in command
Use the same formatting as the systemd-analyze man page, so that man shows a space. --- man/systemd-bootchart.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git man/systemd-bootchart.xml man/systemd-bootchart.xml index d0adaad..1715d5d 100644 --- man/systemd-bootchart.xml +++ man/systemd-bootchart.xml @@ -78,8 +78,8 @@ in which order, and where possible problems exist in the startup sequence of the system. It is essentially a more detailed version of - the <command>systemd-analyze</command> - <command>plot</command> function. + the <command>systemd-analyze plot</command> + function. </para> <para> Of course, bootchart can also be used at any -- 1.7.9.2 ++++++ 0011-selinux-make-sure-we-do-not-try-to-print-missing-fie.patch ++++++ Based on dec23413ecc90d4a547aa41f02af0482b4513495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Mon, 27 Oct 2014 21:31:29 -0400 Subject: [PATCH] selinux: make sure we do not try to print missing fields UID or GID of 0 is valid, so we cannot use that to distinguish whether calls to sd_bus_creds_get_* succeeded, and the return value from the function is the only way to know about missing fields. Print "n/a" if the fields are missing. CID #1238779 --- src/core/selinux-access.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git src/core/selinux-access.c src/core/selinux-access.c index 08ea6ef..351d48f 100644 --- src/core/selinux-access.c +++ src/core/selinux-access.c @@ -53,7 +53,7 @@ struct audit_info { /* Any time an access gets denied this callback will be called - with the aduit data. We then need to just copy the audit data into the msgbuf. + with the audit data. We then need to just copy the audit data into the msgbuf. */ static int audit_callback( void *auditdata, @@ -64,14 +64,20 @@ static int audit_callback( const struct audit_info *audit = auditdata; uid_t uid = 0, login_uid = 0; gid_t gid = 0; + char login_uid_buf[DECIMAL_STR_MAX(uid_t)] = "n/a"; + char uid_buf[DECIMAL_STR_MAX(uid_t)] = "n/a"; + char gid_buf[DECIMAL_STR_MAX(gid_t)] = "n/a"; - sd_bus_creds_get_audit_login_uid(audit->creds, &login_uid); - sd_bus_creds_get_uid(audit->creds, &uid); - sd_bus_creds_get_gid(audit->creds, &gid); + if (sd_bus_creds_get_audit_login_uid(audit->creds, &login_uid) >= 0) + snprintf(login_uid_buf, sizeof(login_uid_buf), UID_FMT, login_uid); + if (sd_bus_creds_get_uid(audit->creds, &uid) >= 0) + snprintf(uid_buf, sizeof(uid_buf), UID_FMT, uid); + if (sd_bus_creds_get_gid(audit->creds, &gid) >= 0) + snprintf(gid_buf, sizeof(gid_buf), "%lu", (unsigned long)gid); snprintf(msgbuf, msgbufsize, - "auid=%d uid=%d gid=%d%s%s%s%s%s%s", - login_uid, uid, gid, + "auid=%s uid=%s gid=%s%s%s%s%s%s%s", + login_uid_buf, uid_buf, gid_buf, audit->path ? " path=\"" : "", strempty(audit->path), audit->path ? "\"" : "", audit->cmdline ? " cmdline=\"" : "", strempty(audit->cmdline), audit->cmdline ? "\"" : ""); -- 1.7.9.2 ++++++ 0011-units-fix-BindsTo-logic-when-applied-relative-to-ser.patch ++++++
From ff50244582bf69e8489bba6ce59a21663d7f8274 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 18 Aug 2014 22:21:42 +0200 Subject: [PATCH] units: fix BindsTo= logic when applied relative to services with Type=oneshot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
Start jobs for Type=oneshot units are successful when the unit state transition activating → inactive took place. In such a case all units that BindsTo= on it previously would continue to run, even though the unit they dependet on was actually already gone. --- src/core/unit.c | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git src/core/unit.c src/core/unit.c index a5f6b2e..950b83a 100644 --- src/core/unit.c +++ src/core/unit.c @@ -1471,12 +1471,44 @@ static void unit_check_unneeded(Unit *u) { if (unit_active_or_pending(other)) return; - log_info_unit(u->id, "Service %s is not needed anymore. Stopping.", u->id); + log_info_unit(u->id, "Unit %s is not needed anymore. Stopping.", u->id); /* Ok, nobody needs us anymore. Sniff. Then let's commit suicide */ manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL); } +static void unit_check_binds_to(Unit *u) { + bool stop = false; + Unit *other; + Iterator i; + + assert(u); + + if (u->job) + return; + + if (unit_active_state(u) != UNIT_ACTIVE) + return; + + SET_FOREACH(other, u->dependencies[UNIT_BINDS_TO], i) { + if (other->job) + continue; + + if (!UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other))) + continue; + + stop = true; + } + + if (!stop) + return; + + log_info_unit(u->id, "Unit %s is bound to inactive service. Stopping, too.", u->id); + + /* A unit we need to run is gone. Sniff. Let's stop this. */ + manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL); +} + static void retroactively_start_dependencies(Unit *u) { Iterator i; Unit *other; @@ -1788,11 +1820,19 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su manager_recheck_journal(m); unit_trigger_notify(u); - /* Maybe we finished startup and are now ready for being - * stopped because unneeded? */ - if (u->manager->n_reloading <= 0) + if (u->manager->n_reloading <= 0) { + /* Maybe we finished startup and are now ready for + * being stopped because unneeded? */ unit_check_unneeded(u); + /* Maybe we finished startup, but something we needed + * has vanished? Let's die then. (This happens when + * something BindsTo= to a Type=oneshot unit, as these + * units go directly from starting to inactive, + * without ever entering started.) */ + unit_check_binds_to(u); + } + unit_add_to_dbus_queue(u); unit_add_to_gc_queue(u); } -- 1.7.9.2 ++++++ 0012-core-transaction-avoid-misleading-error-message-when.patch ++++++ Based on 04ef5b03f64d3824a51a2a903548af029a006744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sun, 22 Jun 2014 14:04:23 -0400 Subject: [PATCH] core/transaction: avoid misleading error message when unit not found There's no point in telling the user to look at the logs when an attempt to load the unit file failed with ENOENT. https://bugzilla.redhat.com/show_bug.cgi?id=996133 --- TODO | 4 ---- src/core/transaction.c | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) --- src/core/transaction.c +++ src/core/transaction.c 2014-06-24 11:18:42.746235805 +0000 @@ -865,12 +865,18 @@ int transaction_add_job_and_dependencies } if (type != JOB_STOP && unit->load_state == UNIT_ERROR) { - sd_bus_error_setf(e, BUS_ERROR_LOAD_FAILED, - "Unit %s failed to load: %s. " - "See system logs and 'systemctl status %s' for details.", - unit->id, - strerror(-unit->load_error), - unit->id); + if (unit->load_error == -ENOENT) + sd_bus_error_setf(e, BUS_ERROR_LOAD_FAILED, + "Unit %s failed to load: %s.", + unit->id, + strerror(-unit->load_error)); + else + sd_bus_error_setf(e, BUS_ERROR_LOAD_FAILED, + "Unit %s failed to load: %s. " + "See system logs and 'systemctl status %s' for details.", + unit->id, + strerror(-unit->load_error), + unit->id); return -EINVAL; } ++++++ 0012-journalctl-refuse-extra-arguments-with-verify-and-si.patch ++++++
From 0b6b7c2004317da48e5bbd3078c5662d8f0061b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Wed, 26 Feb 2014 23:01:43 -0500 Subject: [PATCH] journalctl: refuse extra arguments with --verify and similar
Positional arguments only make sense with the default action. For other actions, complain instead of ignoring them silently. --- src/journal/journalctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git src/journal/journalctl.c src/journal/journalctl.c index a328ba1..0619b25 100644 --- src/journal/journalctl.c +++ src/journal/journalctl.c @@ -658,6 +658,11 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } + if (arg_action != ACTION_SHOW && optind < argc) { + log_error("Extraneous arguments starting with '%s'", argv[optind]); + return -EINVAL; + } + return 1; } -- 1.7.9.2 ++++++ 0012-journald-remove-stray-reset-of-error-return-value.patch ++++++
From 2fc74bf4336eb7a7e40c0b355d19966cd97d4b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Mon, 10 Mar 2014 21:19:23 -0400 Subject: [PATCH] journald: remove stray reset of error return value
--- src/journal/journald.c | 1 - 1 file changed, 1 deletion(-) diff --git src/journal/journald.c src/journal/journald.c index 37896d0..c8c0801 100644 --- src/journal/journald.c +++ src/journal/journald.c @@ -110,7 +110,6 @@ int main(int argc, char *argv[]) { r = sd_event_run(server.event, t); if (r < 0) { log_error("Failed to run event loop: %s", strerror(-r)); - r = -errno; goto finish; } -- 1.7.9.2 ++++++ 0012-man-add-missing-comma.patch ++++++
From 7d06ef0a5cd2f0a4e021d3d12f3841cce529e0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Thu, 6 Mar 2014 23:54:13 -0500 Subject: [PATCH] man: add missing comma
marcosf0> missing comma in udevadm "see also" section --- man/udevadm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git man/udevadm.xml man/udevadm.xml index a3f8d54..21d1443 100644 --- man/udevadm.xml +++ man/udevadm.xml @@ -594,7 +594,7 @@ <title>See Also</title> <para><citerefentry> <refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum> - </citerefentry> + </citerefentry>, <citerefentry> <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum> </citerefentry></para> -- 1.7.9.2 ++++++ 0012-manager-do-not-print-anything-while-passwords-are-be.patch ++++++ Based on e46b13c8c7f48f81d4e09912f2265daaa7f6d27e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 25 Oct 2014 20:30:51 -0400 Subject: [PATCH] manager: do not print anything while passwords are being queried https://bugs.freedesktop.org/show_bug.cgi?id=73942 --- src/core/manager.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++- src/core/manager.h | 5 ++ 2 files changed, 109 insertions(+), 1 deletion(-) --- src/core/manager.c +++ src/core/manager.c 2014-10-29 14:31:18.984212089 +0000 @@ -25,6 +25,8 @@ #include <signal.h> #include <sys/wait.h> #include <unistd.h> +#include <sys/inotify.h> +#include <sys/epoll.h> #include <sys/poll.h> #include <sys/reboot.h> #include <sys/ioctl.h> @@ -212,6 +214,96 @@ static void manager_print_jobs_in_progre } +static int have_ask_password(void) { + _cleanup_closedir_ DIR *dir; + + dir = opendir("/run/systemd/ask-password"); + if (!dir) { + if (errno == ENOENT) + return false; + else + return -errno; + } + + for (;;) { + struct dirent *de; + + errno = 0; + de = readdir(dir); + if (!de && errno != 0) + return -errno; + if (!de) + return false; + + if (startswith(de->d_name, "ask.")) + return true; + } +} + +static int manager_dispatch_ask_password_fd(sd_event_source *source, + int fd, uint32_t revents, void *userdata) { + Manager *m = userdata; + + assert(m); + + flush_fd(fd); + + m->have_ask_password = have_ask_password(); + if (m->have_ask_password < 0) + /* Log error but continue. Negative have_ask_password + * is treated as unknown status. */ + log_error("Failed to list /run/systemd/ask-password: %s", strerror(m->have_ask_password)); + + return 0; +} + +static void manager_close_ask_password(Manager *m) { + assert(m); + if (m->ask_password_inotify_fd >= 0) close_nointr_nofail(m->ask_password_inotify_fd); + m->ask_password_inotify_fd = -1; + m->ask_password_event_source = sd_event_source_unref(m->ask_password_event_source); + m->have_ask_password = -EINVAL; +} + +static int manager_check_ask_password(Manager *m) { + int r; + + assert(m); + + if (!m->ask_password_event_source) { + assert(m->ask_password_inotify_fd < 0); + + mkdir_p_label("/run/systemd/ask-password", 0755); + + m->ask_password_inotify_fd = inotify_init1(IN_NONBLOCK|IN_CLOEXEC); + if (m->ask_password_inotify_fd < 0) { + log_error("inotify_init1() failed: %m"); + return -errno; + } + + if (inotify_add_watch(m->ask_password_inotify_fd, "/run/systemd/ask-password", IN_CREATE|IN_DELETE|IN_MOVE) < 0) { + log_error("Failed to add watch on /run/systemd/ask-password: %m"); + manager_close_ask_password(m); + return -errno; + } + + r = sd_event_add_io(m->event, &m->ask_password_event_source, + m->ask_password_inotify_fd, EPOLLIN, + manager_dispatch_ask_password_fd, m); + if (r < 0) { + log_error("Failed to add event source for /run/systemd/ask-password: %m"); + manager_close_ask_password(m); + return -errno; + } + + /* Queries might have been added meanwhile... */ + manager_dispatch_ask_password_fd(m->ask_password_event_source, + m->ask_password_inotify_fd, EPOLLIN, m); + } + + return m->have_ask_password; +} + static int manager_watch_idle_pipe(Manager *m) { int r; @@ -470,6 +562,9 @@ int manager_new(SystemdRunningAs running m->pin_cgroupfs_fd = m->notify_fd = m->signal_fd = m->time_change_fd = m->dev_autofs_fd = m->private_listen_fd = m->kdbus_fd = -1; m->current_job_id = 1; /* start as id #1, so that we can leave #0 around as "null-like" value */ + m->ask_password_inotify_fd = -1; + m->have_ask_password = -EINVAL; /* we don't know */ + r = manager_default_environment(m); if (r < 0) goto fail; @@ -847,6 +942,8 @@ void manager_free(Manager *m) { if (m->kdbus_fd >= 0) close_nointr_nofail(m->kdbus_fd); + manager_close_ask_password(m); + manager_close_idle_pipe(m); udev_unref(m->udev); @@ -2526,6 +2623,9 @@ void manager_check_finished(Manager *m) /* Turn off confirm spawn now */ m->confirm_spawn = false; + /* No need to update ask password status when we're going non-interactive */ + manager_close_ask_password(m); + if (dual_timestamp_is_set(&m->finish_timestamp)) return; @@ -2843,12 +2943,15 @@ static bool manager_get_show_status(Mana if (m->no_console_output) return false; + /* If we cannot find out the status properly, just proceed. */ + if (manager_check_ask_password(m) > 0) + return false; + if (m->show_status > 0) return true; /* If Plymouth is running make sure we show the status, so * that there's something nice to see when people press Esc */ - return plymouth_running(); } --- src/core/manager.h +++ src/core/manager.h 2014-10-29 00:00:00.000000000 +0000 @@ -231,6 +231,11 @@ struct Manager { unsigned n_on_console; unsigned jobs_in_progress_iteration; + /* Do we have any outstanding password prompts? */ + int have_ask_password; + int ask_password_inotify_fd; + sd_event_source *ask_password_event_source; + /* Type=idle pipes */ int idle_pipe[4]; sd_event_source *idle_pipe_event_source; ++++++ 0012-util-try-to-be-a-bit-more-NFS-compatible-when-checki.patch ++++++
From 70421bdce2719d76efffd8afdc28433c75aac5a2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 18 Aug 2014 23:15:51 +0200 Subject: [PATCH] util: try to be a bit more NFS compatible when checking whether an FS is writable
https://bugs.freedesktop.org/show_bug.cgi?id=81169 --- src/shared/path-util.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git src/shared/path-util.c src/shared/path-util.c index 57554cd..67566bc 100644 --- src/shared/path-util.c +++ src/shared/path-util.c @@ -533,7 +533,16 @@ int path_is_read_only_fs(const char *path) { if (statvfs(path, &st) < 0) return -errno; - return !!(st.f_flag & ST_RDONLY); + if (st.f_flag & ST_RDONLY) + return true; + + /* On NFS, statvfs() might not reflect whether we can actually + * write to the remote share. Let's try again with + * access(W_OK) which is more reliable, at least sometimes. */ + if (access(path, W_OK) < 0 && errno == EROFS) + return true; + + return false; } int path_is_os_tree(const char *path) { -- 1.7.9.2 ++++++ 0013-core-libsystemd-systemd-timedate-udev-spelling-fixes.patch ++++++
From 6f285378aa6e4b5b23c939d1fea16f9ab0a57efb Mon Sep 17 00:00:00 2001 From: Miklos Vajna <vmiklos@vmiklos.hu> Date: Fri, 14 Mar 2014 21:13:38 +0100 Subject: [PATCH] core, libsystemd, systemd, timedate, udev: spelling fixes
--- src/core/service.c | 2 +- src/core/unit.c | 2 +- src/libsystemd/sd-bus/bus-message.c | 2 +- src/libsystemd/sd-bus/sd-bus.c | 4 ++-- src/systemd/sd-resolve.h | 2 +- src/timedate/timedated.c | 2 +- src/udev/udevadm-settle.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git src/core/service.c src/core/service.c index 41b95ab..386692a 100644 --- src/core/service.c +++ src/core/service.c @@ -3416,7 +3416,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) { free(t); } - /* Interpet WATCHDOG= */ + /* Interpret WATCHDOG= */ if (strv_find(tags, "WATCHDOG=1")) { log_debug_unit(u->id, "%s: got WATCHDOG=1", u->id); service_reset_watchdog(s); diff --git src/core/unit.c src/core/unit.c index 5c98843..4fb0d9c 100644 --- src/core/unit.c +++ src/core/unit.c @@ -1537,7 +1537,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su unit_destroy_cgroup(u); /* Note that this doesn't apply to RemainAfterExit services exiting - * sucessfully, since there's no change of state in that case. Which is + * successfully, since there's no change of state in that case. Which is * why it is handled in service_set_state() */ if (UNIT_IS_INACTIVE_OR_FAILED(os) != UNIT_IS_INACTIVE_OR_FAILED(ns)) { ExecContext *ec; diff --git src/libsystemd/sd-bus/bus-message.c src/libsystemd/sd-bus/bus-message.c index b9d7f6d..e32f2b8 100644 --- src/libsystemd/sd-bus/bus-message.c +++ src/libsystemd/sd-bus/bus-message.c @@ -4215,7 +4215,7 @@ static int message_read_ap( * in a single stackframe. We hence implement our own * home-grown stack in an array. */ - n_array = (unsigned) -1; /* lenght of current array entries */ + n_array = (unsigned) -1; /* length of current array entries */ n_struct = strlen(types); /* length of current struct contents signature */ for (;;) { diff --git src/libsystemd/sd-bus/sd-bus.c src/libsystemd/sd-bus/sd-bus.c index 8e44e50..ba8a8a2 100644 --- src/libsystemd/sd-bus/sd-bus.c +++ src/libsystemd/sd-bus/sd-bus.c @@ -1447,7 +1447,7 @@ static int bus_seal_message(sd_bus *b, sd_bus_message *m, usec_t timeout) { static int bus_remarshal_message(sd_bus *b, sd_bus_message **m) { assert(b); - /* Do packet version and endianess already match? */ + /* Do packet version and endianness already match? */ if ((b->message_version == 0 || b->message_version == (*m)->header->version) && (b->message_endian == 0 || b->message_endian == (*m)->header->endian)) return 0; @@ -1464,7 +1464,7 @@ int bus_seal_synthetic_message(sd_bus *b, sd_bus_message *m) { * hence let's fill something in for synthetic messages. Since * synthetic messages might have a fake sender and we don't * want to interfere with the real sender's serial numbers we - * pick a fixed, artifical one. We use (uint32_t) -1 rather + * pick a fixed, artificial one. We use (uint32_t) -1 rather * than (uint64_t) -1 since dbus1 only had 32bit identifiers, * even though kdbus can do 64bit. */ diff --git src/systemd/sd-resolve.h src/systemd/sd-resolve.h index df69e4b..3c1d482 100644 --- src/systemd/sd-resolve.h +++ src/systemd/sd-resolve.h @@ -129,7 +129,7 @@ int sd_resolve_get_next(sd_resolve *resolve, sd_resolve_query **q); int sd_resolve_get_n_queries(sd_resolve *resolve); /** Cancel a currently running query. q is is destroyed by this call - * and may not be used any futher. */ + * and may not be used any further. */ int sd_resolve_cancel(sd_resolve_query* q); /** Returns non-zero when the query operation specified by q has been completed */ diff --git src/timedate/timedated.c src/timedate/timedated.c index d85ce57..c4a797a 100644 --- src/timedate/timedated.c +++ src/timedate/timedated.c @@ -468,7 +468,7 @@ static int property_get_rtc_time( zero(tm); r = hwclock_get_time(&tm); if (r == -EBUSY) { - log_warning("/dev/rtc is busy, is somebody keeping it open continously? That's not a good idea... Returning a bogus RTC timestamp."); + log_warning("/dev/rtc is busy, is somebody keeping it open continuously? That's not a good idea... Returning a bogus RTC timestamp."); t = 0; } else if (r == -ENOENT) { log_debug("Not /dev/rtc found."); diff --git src/udev/udevadm-settle.c src/udev/udevadm-settle.c index b026155..927ea2a 100644 --- src/udev/udevadm-settle.c +++ src/udev/udevadm-settle.c @@ -100,7 +100,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) case '?': exit(EXIT_FAILURE); default: - assert_not_reached("Unkown argument"); + assert_not_reached("Unknown argument"); } if (optind < argc) { -- 1.7.9.2 ++++++ 0013-units-Do-not-unescape-instance-name-in-systemd-backl.patch ++++++
From 6c49212741253dae05b89d22374186f092ef1e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= <thomas@archlinux.org> Date: Fri, 7 Mar 2014 01:50:34 +0100 Subject: [PATCH] units: Do not unescape instance name in systemd-backlight@.service
The instance name is never escaped in the udev rule, but unescaped in the unit. This results in the following error message on Asus boards: Failed to get backlight or LED device 'backlight:eeepc/wmi': No such file or directory --- units/systemd-backlight@.service.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git units/systemd-backlight@.service.in units/systemd-backlight@.service.in index 5caa5d5..e945d87 100644 --- units/systemd-backlight@.service.in +++ units/systemd-backlight@.service.in @@ -6,7 +6,7 @@ # (at your option) any later version. [Unit] -Description=Load/Save Screen Backlight Brightness of %I +Description=Load/Save Screen Backlight Brightness of %i Documentation=man:systemd-backlight@.service(8) DefaultDependencies=no RequiresMountsFor=/var/lib/systemd/backlight @@ -17,5 +17,5 @@ Before=sysinit.target shutdown.target [Service] Type=oneshot RemainAfterExit=yes -ExecStart=@rootlibexecdir@/systemd-backlight load %I -ExecStop=@rootlibexecdir@/systemd-backlight save %I +ExecStart=@rootlibexecdir@/systemd-backlight load %i +ExecStop=@rootlibexecdir@/systemd-backlight save %i -- 1.7.9.2 ++++++ 0014-journald-with-journaling-FS.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:03.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:03.000000000 +0100 @@ -1,22 +1,5 @@ -From: werner@suse.de -Upstream: marked as openSUSE-specific fix originally, but may well - worth be to be sent upstream. - -Original description: - (none) - -Augmented description [jengelh@inai.de]: -Disable COW on journal files, as that is naturally leading to a lot -of unwanted fragmentation on btrfs. -No word on compression… ---- - src/journal/journald-server.c | 34 ++++++++++++++++++++++++++++++++++ - 1 file changed, 34 insertions(+) - -Index: systemd/src/journal/journald-server.c -=================================================================== ---- systemd.orig/src/journal/journald-server.c -+++ systemd/src/journal/journald-server.c +--- systemd-208/src/journal/journald-server.c ++++ systemd-208/src/journal/journald-server.c 2013-12-10 16:31:50.770235717 +0000 @@ -21,6 +21,7 @@ #include <sys/signalfd.h> @@ -25,50 +8,45 @@ #include <linux/sockios.h> #include <sys/statvfs.h> #include <sys/mman.h> -@@ -917,6 +918,38 @@ finish: - dispatch_message_real(s, iovec, n, m, ucred, tv, label, label_len, unit_id, priority, object_pid); - } +@@ -878,7 +879,7 @@ finish: -+/* -+ * On journaling and/or compressing file systems, avoid doubling the efforts -+ * for the system, that is, set NOCOW and NOCOMP inode flags. Check for every -+ * single flag, as otherwise, some of the file systems may return EOPNOTSUPP on -+ * a single unkown flag (like BtrFS does). -+ * -+ * …but src/journal/journal-file.c already sets NOCOW too…⸘ -+ */ -+static void disable_cow(const char *dir, const Server *serv) -+{ -+ unsigned long flags; -+ int fd = open(dir, O_DIRECTORY); -+ -+ if (fd < 0) -+ return; -+ if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == 0) { -+ unsigned long old = flags; -+ if (!(flags & FS_NOATIME_FL) && -+ ioctl(fd, FS_IOC_SETFLAGS, flags | FS_NOATIME_FL) == 0) -+ flags |= FS_NOATIME_FL; -+ if (!(flags & FS_NOCOW_FL) && -+ ioctl(fd, FS_IOC_SETFLAGS, flags | FS_NOCOW_FL) == 0) -+ flags |= FS_NOCOW_FL; -+ if (!(flags & FS_NOCOMP_FL) && serv->compress) { -+ flags &= ~FS_COMPR_FL; -+ flags |= FS_NOCOMP_FL; -+ } -+ if (old != flags) -+ ioctl(fd, FS_IOC_SETFLAGS, flags); -+ } -+ close(fd); -+} - static int system_journal_open(Server *s, bool flush_requested) { - int r; -@@ -946,6 +979,7 @@ static int system_journal_open(Server *s + static int system_journal_open(Server *s) { +- int r; ++ int r, fd; + char *fn; + sd_id128_t machine; + char ids[33]; +@@ -905,7 +906,31 @@ static int system_journal_open(Server *s + (void) mkdir("/var/log/journal/", 0755); - fn = strjoina("/var/log/journal/", ids); - (void) mkdir(fn, 0755); -+ disable_cow(fn, s); + fn = strappenda("/var/log/journal/", ids); +- (void) mkdir(fn, 0755); ++ (void)mkdir(fn, 0755); ++ ++ /* ++ * On journaling and/or compressing file systems avoid doubling the ++ * efforts for the system, that is set NOCOW and NOCOMP inode flags. ++ * Check for every single flag as otherwise some of the file systems ++ * may return EOPNOTSUPP on one unkown flag (like BtrFS does). ++ */ ++ if ((fd = open(fn, O_DIRECTORY)) >= 0) { ++ long flags; ++ if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == 0) { ++ int old = flags; ++ if (!(flags&FS_NOATIME_FL) && ioctl(fd, FS_IOC_SETFLAGS, flags|FS_NOATIME_FL) == 0) ++ flags |= FS_NOATIME_FL; ++ if (!(flags&FS_NOCOW_FL) && ioctl(fd, FS_IOC_SETFLAGS, flags|FS_NOCOW_FL) == 0) ++ flags |= FS_NOCOW_FL; ++ if (!(flags&FS_NOCOMP_FL) && s->compress) { ++ flags &= ~FS_COMPR_FL; ++ flags |= FS_NOCOMP_FL; ++ } ++ if (old != flags) ++ ioctl(fd, FS_IOC_SETFLAGS, flags); ++ } ++ close(fd); ++ } - fn = strjoina(fn, "/system.journal"); + fn = strappenda(fn, "/system.journal"); r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, s->compress, s->seal, &s->system_metrics, s->mmap, NULL, &s->system_journal); ++++++ 0014-nspawn-fix-detection-of-missing-proc-self-loginuid.patch ++++++
From 13e8ceb84e56907d73b6b07418deb37faaf0e66d Mon Sep 17 00:00:00 2001 From: Tero Roponen <tero.roponen@gmail.com> Date: Tue, 25 Feb 2014 17:19:35 +0200 Subject: [PATCH] nspawn: fix detection of missing /proc/self/loginuid
Running 'systemd-nspawn -D /srv/Fedora/' gave me this error: Failed to read /proc/self/loginuid: No such file or directory Container Fedora failed with error code 1. This patch fixes the problem. --- src/nspawn/nspawn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/nspawn/nspawn.c src/nspawn/nspawn.c index 1fe641b..92b6728 100644 --- src/nspawn/nspawn.c +++ src/nspawn/nspawn.c @@ -1349,7 +1349,7 @@ static int reset_audit_loginuid(void) { return 0; r = read_one_line_file("/proc/self/loginuid", &p); - if (r == -EEXIST) + if (r == -ENOENT) return 0; if (r < 0) { log_error("Failed to read /proc/self/loginuid: %s", strerror(-r)); -- 1.7.9.2 ++++++ 0018-Make-LSB-Skripts-know-about-Required-and-Should.patch ++++++ Should solve the problems of bug #858864 - LSB "+" dependencies aren't handled properly bug #857204 - inssrv fails to enable rpcbind The side effect is that RequiresOverridable= is used for the services add behind Required-Start bug #863217 - systemd overrides explicit admin request to disable a service That is that in this version the Wants= for all services behind Should-Start, X-Start-Before, and X-Stop-After is not used anymore --- service.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- systemd-208/src/core/service.c +++ systemd-208/src/core/service.c 2014-02-21 14:44:59.066735478 +0000 @@ -380,6 +380,8 @@ static int sysv_translate_facility(const "remote_fs", SPECIAL_REMOTE_FS_TARGET, "syslog", NULL, "time", SPECIAL_TIME_SYNC_TARGET, + "all", SPECIAL_DEFAULT_TARGET, + "null", NULL, }; unsigned i; @@ -389,7 +391,7 @@ static int sysv_translate_facility(const assert(name); assert(_r); - n = *name == '$' ? name + 1 : name; + n = (*name == '$' || *name == '+') ? name + 1 : name; for (i = 0; i < ELEMENTSOF(table); i += 2) { @@ -816,10 +818,13 @@ static int service_load_sysv_path(Servic startswith_no_case(t, "Should-Start:") || startswith_no_case(t, "X-Start-Before:") || startswith_no_case(t, "X-Start-After:")) { + UnitDependency d, e; char *i, *w; size_t z; state = LSB; + d = startswith_no_case(t, "X-Start-Before:") ? UNIT_BEFORE : UNIT_AFTER; + e = startswith_no_case(t, "Required-Start:") ? UNIT_REQUIRES_OVERRIDABLE : _UNIT_DEPENDENCY_INVALID; FOREACH_WORD_QUOTED(w, z, strchr(t, ':')+1, i) { char *n, *m; @@ -838,12 +843,18 @@ static int service_load_sysv_path(Servic continue; } + if (*n == '+') + e = UNIT_WANTS; + free(n); if (r == 0) continue; - r = unit_add_dependency_by_name(u, startswith_no_case(t, "X-Start-Before:") ? UNIT_BEFORE : UNIT_AFTER, m, NULL, true); + if (e != _UNIT_DEPENDENCY_INVALID) + r = unit_add_two_dependencies_by_name(u, d, e, m, NULL, true); + else + r = unit_add_dependency_by_name(u, d, m, NULL, true); if (r < 0) log_error_unit(u->id, "[%s:%u] Failed to add dependency on %s, ignoring: %s", ++++++ 0019-make-completion-smart-to-be-able-to-redirect.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:03.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:03.000000000 +0100 @@ -1,45 +1,8 @@ ---- - shell-completion/bash/coredumpctl | 6 +++++- - shell-completion/bash/hostnamectl | 6 +++++- - shell-completion/bash/journalctl | 6 +++++- - shell-completion/bash/kernel-install | 13 ++++++++++++- - shell-completion/bash/localectl | 6 +++++- - shell-completion/bash/loginctl | 6 +++++- - shell-completion/bash/systemctl.in | 6 +++++- - shell-completion/bash/systemd-analyze | 6 +++++- - shell-completion/bash/systemd-run | 14 +++++++++++++- - shell-completion/bash/timedatectl | 6 +++++- - shell-completion/bash/udevadm | 6 +++++- - 11 files changed, 70 insertions(+), 11 deletions(-) - -Index: systemd/shell-completion/bash/coredumpctl -=================================================================== ---- systemd.orig/shell-completion/bash/coredumpctl -+++ systemd/shell-completion/bash/coredumpctl -@@ -44,6 +44,10 @@ _coredumpctl() { - [DUMP]='dump gdb' - ) - -+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then -+ return 0 -+ fi -+ - if __contains_word "$prev" '--output -o'; then - comps=$( compgen -A file -- "$cur" ) - compopt -o filenames -@@ -82,4 +86,4 @@ _coredumpctl() { - return 0 - } - --complete -F _coredumpctl coredumpctl -+complete -o default -o bashdefault -F _coredumpctl coredumpctl -Index: systemd/shell-completion/bash/hostnamectl -=================================================================== ---- systemd.orig/shell-completion/bash/hostnamectl -+++ systemd/shell-completion/bash/hostnamectl +--- systemd-208/shell-completion/bash/hostnamectl ++++ systemd-208/shell-completion/bash/hostnamectl 2014-01-17 14:27:16.183272019 +0000 @@ -30,6 +30,10 @@ _hostnamectl() { local OPTS='-h --help --version --transient --static --pretty - --no-ask-password -H --host --machine' + --no-ask-password -H --host' + if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then + return 0 @@ -48,18 +11,16 @@ if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 -@@ -61,4 +65,4 @@ _hostnamectl() { +@@ -58,4 +62,4 @@ _hostnamectl() { return 0 } -complete -F _hostnamectl hostnamectl +complete -o default -o bashdefault -F _hostnamectl hostnamectl -Index: systemd/shell-completion/bash/journalctl -=================================================================== ---- systemd.orig/shell-completion/bash/journalctl -+++ systemd/shell-completion/bash/journalctl -@@ -55,6 +55,10 @@ _journalctl() { - --root --machine' +--- systemd-208/shell-completion/bash/journalctl ++++ systemd-208/shell-completion/bash/journalctl 2014-01-17 14:34:30.338737694 +0000 +@@ -49,6 +49,10 @@ _journalctl() { + --verify-key' ) + if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then @@ -69,16 +30,14 @@ if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then case $prev in --boot|--this-boot|-b) -@@ -120,4 +124,4 @@ _journalctl() { +@@ -107,4 +111,4 @@ _journalctl() { fi } -complete -F _journalctl journalctl +complete -o default -o bashdefault -F _journalctl journalctl -Index: systemd/shell-completion/bash/kernel-install -=================================================================== ---- systemd.orig/shell-completion/bash/kernel-install -+++ systemd/shell-completion/bash/kernel-install +--- systemd-208/shell-completion/bash/kernel-install ++++ systemd-208/shell-completion/bash/kernel-install 2014-01-17 14:34:41.982255874 +0000 @@ -18,11 +18,22 @@ # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. @@ -108,13 +67,11 @@ -complete -F _kernel_install kernel-install +complete -o default -o bashdefault -F _kernel_install kernel-install -Index: systemd/shell-completion/bash/localectl -=================================================================== ---- systemd.orig/shell-completion/bash/localectl -+++ systemd/shell-completion/bash/localectl -@@ -36,6 +36,10 @@ _localectl() { +--- systemd-208/shell-completion/bash/localectl ++++ systemd-208/shell-completion/bash/localectl 2014-01-17 14:34:52.546235747 +0000 +@@ -30,6 +30,10 @@ _localectl() { local OPTS='-h --help --version --no-convert --no-pager --no-ask-password - -H --host --machine' + -H --host' + if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then + return 0 @@ -123,19 +80,17 @@ if __contains_word "$prev" $OPTS; then case $prev in --host|-H) -@@ -89,4 +93,4 @@ _localectl() { +@@ -73,4 +77,4 @@ _localectl() { return 0 } -complete -F _localectl localectl +complete -o default -o bashdefault -F _localectl localectl -Index: systemd/shell-completion/bash/loginctl -=================================================================== ---- systemd.orig/shell-completion/bash/loginctl -+++ systemd/shell-completion/bash/loginctl -@@ -38,6 +38,10 @@ _loginctl () { - [ARG]='--host -H --kill-who --property -p --signal -s --machine' - ) +--- systemd-208/shell-completion/bash/loginctl ++++ systemd-208/shell-completion/bash/loginctl 2014-01-17 14:35:03.386245699 +0000 +@@ -37,6 +37,10 @@ _loginctl () { + [ARG]='--host -H --kill-who --property -p --signal -s' + ) + if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then + return 0 @@ -144,17 +99,15 @@ if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --signal|-s) -@@ -107,4 +111,4 @@ _loginctl () { +@@ -106,4 +110,4 @@ _loginctl () { return 0 } -complete -F _loginctl loginctl +complete -o default -o bashdefault -F _loginctl loginctl -Index: systemd/shell-completion/bash/systemctl.in -=================================================================== ---- systemd.orig/shell-completion/bash/systemctl.in -+++ systemd/shell-completion/bash/systemctl.in -@@ -96,6 +96,10 @@ _systemctl () { +--- systemd-208/shell-completion/bash/systemctl ++++ systemd-208/shell-completion/bash/systemctl 2014-01-17 14:35:26.506235666 +0000 +@@ -77,6 +77,10 @@ _systemctl () { [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root' ) @@ -165,18 +118,16 @@ if __contains_word "--user" ${COMP_WORDS[*]}; then mode=--user else -@@ -264,4 +268,4 @@ _systemctl () { +@@ -226,4 +230,4 @@ _systemctl () { return 0 } -complete -F _systemctl systemctl +complete -o default -o bashdefault -F _systemctl systemctl -Index: systemd/shell-completion/bash/systemd-analyze -=================================================================== ---- systemd.orig/shell-completion/bash/systemd-analyze -+++ systemd/shell-completion/bash/systemd-analyze -@@ -47,6 +47,10 @@ _systemd_analyze() { - [VERIFY]='verify' +--- systemd-208/shell-completion/bash/systemd-analyze ++++ systemd-208/shell-completion/bash/systemd-analyze 2014-01-17 14:35:38.366736021 +0000 +@@ -37,6 +37,10 @@ _systemd_analyze() { + [LOG_LEVEL]='set-log-level' ) + if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then @@ -186,16 +137,33 @@ _init_completion || return for ((i=0; i < COMP_CWORD; i++)); do -@@ -114,4 +118,4 @@ _systemd_analyze() { +@@ -83,4 +87,4 @@ _systemd_analyze() { return 0 } -complete -F _systemd_analyze systemd-analyze +complete -o default -o bashdefault -F _systemd_analyze systemd-analyze -Index: systemd/shell-completion/bash/systemd-run -=================================================================== ---- systemd.orig/shell-completion/bash/systemd-run -+++ systemd/shell-completion/bash/systemd-run +--- systemd-208/shell-completion/bash/systemd-coredumpctl ++++ systemd-208/shell-completion/bash/systemd-coredumpctl 2014-01-17 14:35:46.434235632 +0000 +@@ -44,6 +44,10 @@ _coredumpctl() { + [DUMP]='dump gdb' + ) + ++ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then ++ return 0 ++ fi ++ + if __contains_word "$prev" '--output -o'; then + comps=$( compgen -A file -- "$cur" ) + compopt -o filenames +@@ -82,4 +86,4 @@ _coredumpctl() { + return 0 + } + +-complete -F _coredumpctl systemd-coredumpctl ++complete -o default -o bashdefault -F _coredumpctl systemd-coredumpctl +--- systemd-208/shell-completion/bash/systemd-run ++++ systemd-208/shell-completion/bash/systemd-run 2014-01-17 14:35:55.938236298 +0000 @@ -17,6 +17,13 @@ # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. @@ -210,7 +178,7 @@ __systemctl() { local mode=$1; shift 1 systemctl $mode --full --no-legend "$@" -@@ -38,6 +45,11 @@ _systemd_run() { +@@ -31,6 +38,11 @@ _systemd_run() { local mode=--system local i @@ -222,19 +190,17 @@ for (( i=1; i <= COMP_CWORD; i++ )); do if [[ ${COMP_WORDS[i]} != -* ]]; then local root_command=${COMP_WORDS[i]} -@@ -98,4 +110,4 @@ _systemd_run() { +@@ -60,4 +72,4 @@ _systemd_run() { return 0 } -complete -F _systemd_run systemd-run +complete -o default -o bashdefault -F _systemd_run systemd-run -Index: systemd/shell-completion/bash/timedatectl -=================================================================== ---- systemd.orig/shell-completion/bash/timedatectl -+++ systemd/shell-completion/bash/timedatectl +--- systemd-208/shell-completion/bash/timedatectl ++++ systemd-208/shell-completion/bash/timedatectl 2014-01-17 14:36:06.182735466 +0000 @@ -30,6 +30,10 @@ _timedatectl() { local OPTS='-h --help --version --adjust-system-clock --no-pager - --no-ask-password -H --host --machine' + --no-ask-password -H --host' + if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then + return 0 @@ -249,10 +215,8 @@ -complete -F _timedatectl timedatectl +complete -o default -o bashdefault -F _timedatectl timedatectl -Index: systemd/shell-completion/bash/udevadm -=================================================================== ---- systemd.orig/shell-completion/bash/udevadm -+++ systemd/shell-completion/bash/udevadm +--- systemd-208/shell-completion/bash/udevadm ++++ systemd-208/shell-completion/bash/udevadm 2014-01-17 14:36:16.406236120 +0000 @@ -36,6 +36,10 @@ _udevadm() { local verbs=(info trigger settle control monitor hwdb test-builtin test) ++++++ 1001-re-enable-by_path-links-for-ata-devices.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:03.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:03.000000000 +0100 @@ -22,14 +22,14 @@ Signed-off-by: Robert Milasan <rmilasan@suse.com> Signed-off-by: Hannes Reinecke <hare@suse.de> --- - src/udev/udev-builtin-path_id.c | 53 ++++++++++++++++++++++++++++++---------- + src/udev/udev-builtin-path_id.c | 53 +++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 12 deletions(-) -Index: systemd-218/src/udev/udev-builtin-path_id.c -=================================================================== ---- systemd-218.orig/src/udev/udev-builtin-path_id.c -+++ systemd-218/src/udev/udev-builtin-path_id.c -@@ -426,6 +426,46 @@ static struct udev_device *handle_scsi_h +diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c +index 0599980..fbd3fda 100644 +--- a/src/udev/udev-builtin-path_id.c ++++ b/src/udev/udev-builtin-path_id.c +@@ -339,6 +339,46 @@ static struct udev_device *handle_scsi_hyperv(struct udev_device *parent, char * return parent; } @@ -73,10 +73,10 @@ + return hostdev; +} + - static struct udev_device *handle_scsi(struct udev_device *parent, char **path, bool *supported_parent) { + static struct udev_device *handle_scsi(struct udev_device *parent, char **path) + { const char *devtype; - const char *name; -@@ -465,19 +505,8 @@ static struct udev_device *handle_scsi(s +@@ -375,19 +415,8 @@ static struct udev_device *handle_scsi(struct udev_device *parent, char **path) goto out; } @@ -97,3 +97,6 @@ goto out; } +-- +1.8.1.4 + ++++++ 1003-udev-netlink-null-rules.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:03.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:03.000000000 +0100 @@ -4,19 +4,17 @@ udevd race for netlink events (bnc#774646) --- - src/udev/udevd.c | 2 ++ + src/udev/udevd.c | 2 ++ 1 file changed, 2 insertions(+) -Index: systemd-218/src/udev/udevd.c -=================================================================== ---- systemd-218.orig/src/udev/udevd.c -+++ systemd-218/src/udev/udevd.c -@@ -1468,6 +1468,8 @@ int main(int argc, char *argv[]) { +--- systemd-206.orig/src/udev/udevd.c ++++ systemd-206/src/udev/udevd.c +@@ -1337,6 +1337,8 @@ int main(int argc, char *argv[]) dev = udev_monitor_receive_device(monitor); if (dev != NULL) { udev_device_set_usec_initialized(dev, now(CLOCK_MONOTONIC)); + if (rules == NULL) -+ rules = udev_rules_new(udev, arg_resolve_names); ++ rules = udev_rules_new(udev, resolve_names); if (event_queue_insert(dev) < 0) udev_device_unref(dev); } ++++++ 1005-create-default-links-for-primary-cd_dvd-drive.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:03.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:03.000000000 +0100 @@ -4,16 +4,14 @@ cdrom_id: created links for the default cd/dvd drive (bnc#783054). --- - rules/60-cdrom_id.rules | 5 ++++- + rules/60-cdrom_id.rules | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -Index: systemd/rules/60-cdrom_id.rules -=================================================================== ---- systemd.orig/rules/60-cdrom_id.rules -+++ systemd/rules/60-cdrom_id.rules -@@ -20,6 +20,9 @@ IMPORT{program}="cdrom_id --lock-media $ - # stale mounts after ejecting - ENV{DISK_MEDIA_CHANGE}=="?*", ENV{ID_CDROM_MEDIA}!="?*", ENV{SYSTEMD_READY}="0" +--- systemd-206.orig/rules/60-cdrom_id.rules ++++ systemd-206/rules/60-cdrom_id.rules +@@ -15,6 +15,9 @@ ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdr + # enable the receiving of media eject button events + IMPORT{program}="cdrom_id --lock-media $devnode" -KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100" +KERNEL=="sr0", ENV{ID_CDROM}=="1", SYMLINK+="cdrom", OPTIONS+="link_priority=-100" ++++++ 1006-udev-always-rename-network.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:03.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:03.000000000 +0100 @@ -9,17 +9,15 @@ Port the patch of Robert to systemd v210 and test it out. --- - src/udev/udev-event.c | 41 +++++++++++++++++++++++++++++++++++++---- - 1 file changed, 37 insertions(+), 4 deletions(-) + udev-event.c | 42 ++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 38 insertions(+), 4 deletions(-) -Index: systemd-218/src/udev/udev-event.c -=================================================================== ---- systemd-218.orig/src/udev/udev-event.c -+++ systemd-218/src/udev/udev-event.c -@@ -767,20 +767,53 @@ out: - static int rename_netif(struct udev_event *event) { +--- systemd-210/src/udev/udev-event.c ++++ systemd-210/src/udev/udev-event.c 2014-03-27 13:19:06.727748307 +0000 +@@ -750,8 +750,9 @@ static int rename_netif(struct udev_even struct udev_device *dev = event->dev; + _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL; char name[IFNAMSIZ]; + char interim[IFNAMSIZ], *ptr = &interim[0]; const char *oldname; @@ -28,40 +26,43 @@ oldname = udev_device_get_sysname(dev); - strscpy(name, IFNAMSIZ, event->name); +@@ -765,12 +766,45 @@ static int rename_netif(struct udev_even + return r; - r = rtnl_set_link_name(&event->rtnl, udev_device_get_ifindex(dev), name); + r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), name); - if (r < 0) + if (r == 0) { -+ log_info("renamed network interface %s to %s\n", oldname, name); ++ print_kmsg("renamed network interface %s to %s\n", oldname, name); + return r; + } else if (r != -EEXIST) { - return log_error_errno(r, "Error changing net interface name '%s' to '%s': %m", oldname, name); -+ } - -- log_debug("renamed network interface '%s' to '%s'", oldname, name); + log_error("error changing net interface name %s to %s: %s", + oldname, name, strerror(-r)); +- else +- print_kmsg("renamed network interface %s to %s", oldname, name); ++ return r; ++ } ++ + /* free our own name, another process may wait for us */ + strpcpyf(&ptr, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev)); - -- return 0; -+ r = rtnl_set_link_name(&event->rtnl, udev_device_get_ifindex(dev), interim); ++ ++ r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), interim); + if (r < 0) { + log_error("error changing net interface name %s to %s: %s", + oldname, interim, strerror(-r)); + return r; + } -+ + + /* log temporary name */ -+ log_info("renamed network interface %s to %s\n", oldname, interim); ++ print_kmsg("renamed network interface %s to %s\n", oldname, interim); + + loop = 90 * 20; + while (loop--) { + const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 }; + nanosleep(&duration, NULL); + -+ r = rtnl_set_link_name(&event->rtnl, udev_device_get_ifindex(dev), name); ++ r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), name); + if (r == 0) { -+ log_info("renamed network interface %s to %s\n", interim, name); ++ print_kmsg("renamed network interface %s to %s\n", interim, name); + break; + } + @@ -71,7 +72,6 @@ + break; + } + } -+ return r; + return r; } - void udev_event_execute_rules(struct udev_event *event, ++++++ 1008-add-msft-compability-rules.patch ++++++ --- systemd-206.orig/Makefile.am +++ systemd-206/Makefile.am @@ -2484,6 +2484,10 @@ dist_udevrules_DATA += \ rules/80-hotplug-cpu-mem.rules # ------------------------------------------------------------------------------ +dist_udevrules_DATA += \ + rules/61-msft.rules + +# ------------------------------------------------------------------------------ if ENABLE_GUDEV if ENABLE_GTK_DOC SUBDIRS += \ --- /dev/null +++ systemd-206/rules/61-msft.rules @@ -0,0 +1,9 @@ +# MSFT compability rules +ACTION!="add|change", GOTO="msft_end" + +ENV{DEVTYPE}=="partition", IMPORT{parent}="SCSI_IDENT_*" +KERNEL=="sd*[!0-9]|sr*", ENV{SCSI_IDENT_LUN_T10}!="?*", IMPORT{program}="/usr/bin/sg_inq -p di --export $tempnode" +KERNEL=="sd*|sr*", ENV{DEVTYPE}=="disk", ENV{SCSI_IDENT_LUN_T10}=="?*", SYMLINK+="disk/by-id/scsi-1$env{SCSI_IDENT_LUN_T10}" +KERNEL=="sd*", ENV{DEVTYPE}=="partition", ENV{SCSI_IDENT_LUN_T10}=="?*", SYMLINK+="disk/by-id/scsi-1$env{SCSI_IDENT_LUN_T10}-part%n" + +LABEL="msft_end" ++++++ 1009-cdrom_id-use-the-old-MMC-fallback.patch ++++++
From a14f14976094650e17d39f3a7d15a1c68c93c333 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn <lnykryn@redhat.com> Date: Thu, 27 Feb 2014 11:06:37 +0100 Subject: [PATCH] cdrom_id: use the old MMC fallback
https://bugzilla.redhat.com/show_bug.cgi?id=1038015 The problem seems to be that the your virtual DVD is emulating a really old DVD device, and doing it kind of strangely.
dracut:# /lib/udev/cdrom_id --debug /dev/sr0 probing: '/dev/sr0' INQUIRY: [IMM ][Virtual CD/DVD ][0316] GET CONFIGURATION failed with SK=5h/ASC=24h/ACQ=00h
So your virtual drive rejects the GET CONFIGURATION command as illegal. Other pre-MMC2 drives that don't accept this command usually return the error SK=5h,ASC=20h (invalid/unsupported command code), in which case cdrom_id tries an older method, and then ID_CDROM_MEDIA_TRACK_COUNT_DATA gets set and all the /dev/disk/by-label (etc) links get set up. The virtual drive returns the error SK=5h,ASC=24h (invalid field in Command Descriptor Block), which cdrom_id doesn't handle, so it gives up and the links never get made. The ideal solution would be to make the IMM to emulate a device that's less than 15 years old, but I'm not going to hold my breath waiting for that. So probably cdrom_id should also use the old MMC fallback when the error is SK=5h,ASC=24h, and then all of this would work as expected. Suggested-by:Luca Miccini <lmiccini@redhat.com> --- src/udev/cdrom_id/cdrom_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/udev/cdrom_id/cdrom_id.c src/udev/cdrom_id/cdrom_id.c index 93467c2..33b2bc3 100644 --- a/src/udev/cdrom_id/cdrom_id.c +++ b/src/udev/cdrom_id/cdrom_id.c @@ -556,7 +556,7 @@ static int cd_profiles(struct udev *udev, int fd) if ((err != 0)) { info_scsi_cmd_err(udev, "GET CONFIGURATION", err); /* handle pre-MMC2 drives which do not support GET CONFIGURATION */ - if (SK(err) == 0x5 && ASC(err) == 0x20) { + if (SK(err) == 0x5 && (ASC(err) == 0x20 || ASC(err) == 0x24)) { log_debug("drive is pre-MMC2 and does not support 46h get configuration command"); log_debug("trying to work around the problem"); ret = cd_profiles_old_mmc(udev, fd); -- 1.7.9.2 ++++++ 1010-udev-increase-result-size-for-programs.patch ++++++ Index: systemd-210/src/udev/udev-rules.c =================================================================== --- systemd-210.orig/src/udev/udev-rules.c +++ systemd-210/src/udev/udev-rules.c @@ -2027,7 +2027,7 @@ int udev_rules_apply_to_event(struct ude case TK_M_PROGRAM: { char program[UTIL_PATH_SIZE]; char **envp; - char result[UTIL_PATH_SIZE]; + char result[UTIL_LINE_SIZE]; free(event->program_result); event->program_result = NULL; ++++++ 1014-udev-update-net_id-comments.patch ++++++
From d4b687c96adf207f0878aebf3ce3371f6160687f Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Thu, 27 Mar 2014 15:30:09 +0100 Subject: [PATCH] udev: update net_id comments
From bf81e792f3c0aed54edf004c1c95cc6f6d81d0ee Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 27 Mar 2014 21:47:14 +0100 Subject: [PATCH] udev: persistent naming - we cannot use virtio numbers as
Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/udev-builtin-net_id.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 4f2b2c1..9ac07de 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -33,8 +33,11 @@ * ww -- wwan * * Type of names: + * b<number> -- BCMA bus core number + * ccw<name> -- CCW bus group name * o<index> -- on-board device index number * s<slot>[f<function>][d<dev_id>] -- hotplug slot index number + * v<number> -- virtio number * x<MAC> -- MAC address * [P<domain>]p<bus>s<slot>[f<function>][d<dev_id>] * -- PCI geographical location @@ -119,12 +122,9 @@ struct netnames { const char *pci_onboard_label; char usb_ports[IFNAMSIZ]; - char bcma_core[IFNAMSIZ]; - - char virtio_core[IFNAMSIZ]; - - char ccw_core[IFNAMSIZ]; + char virtio[IFNAMSIZ]; + char ccw_group[IFNAMSIZ]; }; /* retrieve on-board index number and label from firmware */ @@ -353,18 +353,17 @@ static int names_bcma(struct udev_device *dev, struct netnames *names) { static int names_virtio(struct udev_device *dev, struct netnames *names) { struct udev_device *virtdev; - unsigned int core; + unsigned int num; virtdev = udev_device_get_parent_with_subsystem_devtype(dev, "virtio", NULL); if (!virtdev) return -ENOENT; - /* core num */ - if (sscanf(udev_device_get_sysname(virtdev), "virtio%u", &core) != 1) + if (sscanf(udev_device_get_sysname(virtdev), "virtio%u", &num) != 1) return -EINVAL; - /* suppress the common core == 0 */ - if (core > 0) - snprintf(names->virtio_core, sizeof(names->virtio_core), "v%u", core); + /* suppress the common num == 0 */ + if (num > 0) + snprintf(names->virtio, sizeof(names->virtio), "v%u", num); names->type = NET_VIRTIO; return 0; @@ -402,8 +401,8 @@ static int names_ccw(struct udev_device *dev, struct netnames *names) { return -EINVAL; /* Store the CCW bus-ID for use as network device name */ - rc = snprintf(names->ccw_core, sizeof(names->ccw_core), "ccw%s", bus_id); - if (rc >= 0 && rc < (int)sizeof(names->ccw_core)) + rc = snprintf(names->ccw_group, sizeof(names->ccw_group), "ccw%s", bus_id); + if (rc >= 0 && rc < (int)sizeof(names->ccw_group)) names->type = NET_CCWGROUP; return 0; } @@ -517,7 +516,7 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool if (err >= 0 && names.type == NET_CCWGROUP) { char str[IFNAMSIZ]; - if (snprintf(str, sizeof(str), "%s%s", prefix, names.ccw_core) < (int)sizeof(str)) + if (snprintf(str, sizeof(str), "%s%s", prefix, names.ccw_group) < (int)sizeof(str)) udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str); goto out; } @@ -585,11 +584,11 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool char str[IFNAMSIZ]; if (names.pci_path[0]) - if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_path, names.virtio_core) < (int)sizeof(str)) + if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_path, names.virtio) < (int)sizeof(str)) udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str); if (names.pci_slot[0]) - if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_slot, names.virtio_core) < (int)sizeof(str)) + if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_slot, names.virtio) < (int)sizeof(str)) udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str); goto out; } -- 1.8.4.5 ++++++ 1015-udev-persistent-naming-we-cannot-use-virtio-numbers-.patch ++++++ they are not stable This reverts commit 8741f2defaf26aafe5ee0fd29954cfdf84ee519c: 'Add virtio-blk support to path_id' and commit e3d563346c4237af23335cc6904e0662efdf62ad: 'udev: net_id - handle virtio buses'. Distros may want to take note of this, as it changes behavior. Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/udev-builtin-net_id.c | 36 ------------------------------------ src/udev/udev-builtin-path_id.c | 3 --- 2 files changed, 39 deletions(-) Index: systemd-210/src/udev/udev-builtin-net_id.c =================================================================== --- systemd-210.orig/src/udev/udev-builtin-net_id.c +++ systemd-210/src/udev/udev-builtin-net_id.c @@ -37,7 +37,6 @@ * ccw<name> -- CCW bus group name * o<index> -- on-board device index number * s<slot>[f<function>][d<dev_id>] -- hotplug slot index number - * v<number> -- virtio number * x<MAC> -- MAC address * [P<domain>]p<bus>s<slot>[f<function>][d<dev_id>] * -- PCI geographical location @@ -123,7 +122,6 @@ struct netnames { char usb_ports[IFNAMSIZ]; char bcma_core[IFNAMSIZ]; - char virtio[IFNAMSIZ]; char ccw_group[IFNAMSIZ]; }; @@ -351,24 +349,6 @@ static int names_bcma(struct udev_device return 0; } -static int names_virtio(struct udev_device *dev, struct netnames *names) { - struct udev_device *virtdev; - unsigned int num; - - virtdev = udev_device_get_parent_with_subsystem_devtype(dev, "virtio", NULL); - if (!virtdev) - return -ENOENT; - - if (sscanf(udev_device_get_sysname(virtdev), "virtio%u", &num) != 1) - return -EINVAL; - /* suppress the common num == 0 */ - if (num > 0) - snprintf(names->virtio, sizeof(names->virtio), "v%u", num); - - names->type = NET_VIRTIO; - return 0; -} - static int names_ccw(struct udev_device *dev, struct netnames *names) { struct udev_device *cdev; const char *bus_id; @@ -577,22 +557,6 @@ static int builtin_net_id(struct udev_de udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str); goto out; } - - /* virtio bus */ - err = names_virtio(dev, &names); - if (err >= 0 && names.type == NET_VIRTIO) { - char str[IFNAMSIZ]; - - if (names.pci_path[0]) - if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_path, names.virtio) < (int)sizeof(str)) - udev_builtin_add_property(dev, test, "ID_NET_NAME_PATH", str); - - if (names.pci_slot[0]) - if (snprintf(str, sizeof(str), "%s%s%s", prefix, names.pci_slot, names.virtio) < (int)sizeof(str)) - udev_builtin_add_property(dev, test, "ID_NET_NAME_SLOT", str); - goto out; - } - out: return EXIT_SUCCESS; } Index: systemd-210/src/udev/udev-builtin-path_id.c =================================================================== --- systemd-210.orig/src/udev/udev-builtin-path_id.c +++ systemd-210/src/udev/udev-builtin-path_id.c @@ -571,9 +571,6 @@ static int builtin_path_id(struct udev_d } else if (streq(subsys, "xen")) { path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "xen"); - } else if (streq(subsys, "virtio")) { - path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "virtio"); } else if (streq(subsys, "scm")) { path_prepend(&path, "scm-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "scm"); ++++++ 1016-udev-warn-when-name_to_handle_at-is-not-implemented.patch ++++++ Based on e6c474723dc66cd4765fd09453d6b48bd5905ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sun, 20 Apr 2014 13:57:26 -0400 Subject: [PATCH] udev: warn when name_to_handle_at is not implemented We have a bunch of reports from people who have a custom kernel and are confused why udev is not running. Issue a warning on error. Barring an error in the code, the only error that is possible is ENOSYS. https://bugzilla.redhat.com/show_bug.cgi?id=1072966 --- src/libudev/libudev-monitor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- src/libudev/libudev-monitor.c +++ src/libudev/libudev-monitor.c 2014-05-12 00:00:00.000000000 +0000 @@ -115,8 +115,11 @@ static bool udev_has_devtmpfs(struct ude int r; r = name_to_handle_at(AT_FDCWD, "/dev", &h.handle, &mount_id, 0); - if (r < 0) + if (r < 0) { + if (errno != EOPNOTSUPP) + udev_err(udev, "name_to_handle_at on /dev: %m\n"); return false; + } f = fopen("/proc/self/mountinfo", "re"); ++++++ 1017-udev-serialize-synchronize-block-device-event-handli.patch ++++++
From 3ebdb81ef088afd3b4c72b516beb5610f8c93a0d Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Sun, 13 Apr 2014 19:54:27 -0700 Subject: [PATCH] udev: serialize/synchronize block device event handling with file locks
--- src/udev/udevd.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git src/udev/udevd.c src/udev/udevd.c index f9ee368..aecd208 100644 --- src/udev/udevd.c +++ src/udev/udevd.c @@ -31,6 +31,7 @@ #include <time.h> #include <getopt.h> #include <dirent.h> +#include <sys/file.h> #include <sys/time.h> #include <sys/prctl.h> #include <sys/socket.h> @@ -265,6 +266,7 @@ static void worker_new(struct event *event) for (;;) { struct udev_event *udev_event; struct worker_message msg; + int fd_lock = -1; int err; log_debug("seq %llu running", udev_device_get_seqnum(dev)); @@ -280,6 +282,30 @@ static void worker_new(struct event *event) if (exec_delay > 0) udev_event->exec_delay = exec_delay; + /* + * Take a "read lock" on the device node; this establishes + * a concept of device "ownership" to serialize device + * access. External processes holding a "write lock" will + * cause udev to skip the event handling; in the case udev + * acquired the lock, the external process will block until + * udev has finished its event handling. + */ + if (streq_ptr("block", udev_device_get_subsystem(dev))) { + struct udev_device *d = dev; + + if (streq_ptr("partition", udev_device_get_devtype(d))) + d = udev_device_get_parent(d); + + if (d) { + fd_lock = open(udev_device_get_devnode(d), O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK); + if (fd_lock >= 0 && flock(fd_lock, LOCK_SH|LOCK_NB) < 0) { + log_debug("Unable to flock(%s), skipping event handling: %m", udev_device_get_devnode(d)); + err = -EWOULDBLOCK; + goto skip; + } + } + } + /* apply rules, create node, symlinks */ err = udev_event_execute_rules(udev_event, rules, &sigmask_orig); @@ -292,13 +318,16 @@ static void worker_new(struct event *event) udev_device_update_db(dev); } + if (fd_lock >= 0) + close(fd_lock); + /* send processed event back to libudev listeners */ udev_monitor_send_device(worker_monitor, NULL, dev); +skip: /* send udevd the result of the event execution */ memzero(&msg, sizeof(struct worker_message)); - if (err != 0) - msg.exitcode = err; + msg.exitcode = err; msg.pid = getpid(); send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); -- 1.7.9.2 ++++++ 1018-udev-do-not-skip-the-execution-of-RUN-when-renaming-.patch ++++++
From 1ea972174baba40dbc80c51cbfc4edc49764b59b Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Wed, 14 May 2014 00:34:49 +0200 Subject: [PATCH] udev: do not skip the execution of RUN when renaming a network device fails
--- src/test/test-udev.c | 5 ++--- src/udev/udev-event.c | 11 +++++------ src/udev/udev.h | 2 +- src/udev/udevadm-test.c | 13 +++++-------- src/udev/udevd.c | 5 ++--- 5 files changed, 15 insertions(+), 21 deletions(-) diff --git src/test/test-udev.c src/test/test-udev.c index b064744..b057cc8 100644 --- src/test/test-udev.c +++ src/test/test-udev.c @@ -155,9 +155,8 @@ int main(int argc, char *argv[]) { } } - err = udev_event_execute_rules(event, rules, &sigmask_orig); - if (err == 0) - udev_event_execute_run(event, NULL); + udev_event_execute_rules(event, rules, &sigmask_orig); + udev_event_execute_run(event, NULL); out: if (event != NULL && event->fd_signal >= 0) close(event->fd_signal); diff --git src/udev/udev-event.c src/udev/udev-event.c index 2cab42b..5213a4a 100644 --- src/udev/udev-event.c +++ src/udev/udev-event.c @@ -776,13 +776,12 @@ static int rename_netif(struct udev_event *event) return r; } -int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask) +void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask) { struct udev_device *dev = event->dev; - int err = 0; if (udev_device_get_subsystem(dev) == NULL) - return -1; + return; if (streq(udev_device_get_action(dev), "remove")) { udev_device_read_db(dev, NULL); @@ -816,9 +815,10 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, event->name != NULL && !streq(event->name, udev_device_get_sysname(dev))) { char syspath[UTIL_PATH_SIZE]; char *pos; + int r; - err = rename_netif(event); - if (err == 0) { + r = rename_netif(event); + if (r >= 0) { log_debug("renamed netif to '%s'", event->name); /* remember old name */ @@ -881,7 +881,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, udev_device_unref(event->dev_db); event->dev_db = NULL; } - return err; } void udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) diff --git src/udev/udev.h src/udev/udev.h index 936adfb..62538bc 100644 --- src/udev/udev.h +++ src/udev/udev.h @@ -84,7 +84,7 @@ int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, int udev_event_spawn(struct udev_event *event, const char *cmd, char **envp, const sigset_t *sigmask, char *result, size_t ressize); -int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); +void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); void udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]); diff --git src/udev/udevadm-test.c src/udev/udevadm-test.c index 6cd311b..6a2f548 100644 --- src/udev/udevadm-test.c +++ src/udev/udevadm-test.c @@ -43,7 +43,6 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) _cleanup_udev_device_unref_ struct udev_device *dev = NULL; _cleanup_udev_event_unref_ struct udev_event *event = NULL; sigset_t mask, sigmask_orig; - int err; int rc = 0, c; static const struct option options[] = { @@ -139,18 +138,16 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) goto out; } - err = udev_event_execute_rules(event, rules, &sigmask_orig); + udev_event_execute_rules(event, rules, &sigmask_orig); udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); - if (err == 0) { - udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { - char program[UTIL_PATH_SIZE]; + udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { + char program[UTIL_PATH_SIZE]; - udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); - printf("run: '%s'\n", program); - } + udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); + printf("run: '%s'\n", program); } out: if (event != NULL && event->fd_signal >= 0) diff --git src/udev/udevd.c src/udev/udevd.c index aecd208..bc0696c 100644 --- src/udev/udevd.c +++ src/udev/udevd.c @@ -307,10 +307,9 @@ static void worker_new(struct event *event) } /* apply rules, create node, symlinks */ - err = udev_event_execute_rules(udev_event, rules, &sigmask_orig); + udev_event_execute_rules(udev_event, rules, &sigmask_orig); - if (err == 0) - udev_event_execute_run(udev_event, &sigmask_orig); + udev_event_execute_run(udev_event, &sigmask_orig); /* apply/restore inotify watch */ if (err == 0 && udev_event->inotify_watch) { -- 1.7.9.2 ++++++ 1019-udev-avoid-use-of-uninitialized-err.patch ++++++
From bf9bead187802a52a1f376a03caee762d663e945 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Fri, 16 May 2014 23:46:48 +0200 Subject: [PATCH] udev: avoid use of uninitialized err
After 1ea972174baba40dbc80c51cbfc4edc49764b59b err is no longer set unless we hit a special case. Initialize it to 0 and remove a check that will never fail. --- src/udev/udevd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git src/udev/udevd.c src/udev/udevd.c index bc0696c..1c9488e 100644 --- src/udev/udevd.c +++ src/udev/udevd.c @@ -267,7 +267,7 @@ static void worker_new(struct event *event) struct udev_event *udev_event; struct worker_message msg; int fd_lock = -1; - int err; + int err = 0; log_debug("seq %llu running", udev_device_get_seqnum(dev)); udev_event = udev_event_new(dev); @@ -312,7 +312,7 @@ static void worker_new(struct event *event) udev_event_execute_run(udev_event, &sigmask_orig); /* apply/restore inotify watch */ - if (err == 0 && udev_event->inotify_watch) { + if (udev_event->inotify_watch) { udev_watch_begin(udev, dev); udev_device_update_db(dev); } -- 1.7.9.2 ++++++ 1020-udev-keyboard-also-hook-into-change-events.patch ++++++
From 49804365ea1242456c9763058a59cf68479e07ea Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Mon, 26 May 2014 09:30:21 +0800 Subject: [PATCH] udev: keyboard - also hook into "change" events
Re-apply the keymaps when "udevadm trigger" is called. Hooking into "add" only would just remove all keymap content from the udev database instead of applying the new config. --- rules/60-keyboard.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git rules/60-keyboard.rules rules/60-keyboard.rules index 4e0f366..22f71e7 100644 --- rules/60-keyboard.rules +++ rules/60-keyboard.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add", GOTO="keyboard_end" +ACTION=="remove", GOTO="keyboard_end" KERNEL!="event*", GOTO="keyboard_end" ENV{ID_INPUT_KEY}=="", GOTO="keyboard_end" -- 1.7.9.2 ++++++ 1021-udev-re-add-persistent-net-rules.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:04.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:04.000000000 +0100 @@ -1,73 +1,7 @@ ---- - Makefile.am | 9 - src/udev/net/link-config.c | 17 + - src/udev/rule_generator/75-persistent-net-generator.rules | 105 ++++++++++ - src/udev/rule_generator/76-net-sriov-names.rules | 18 + - src/udev/rule_generator/net-set-sriov-names | 79 +++++++ - src/udev/rule_generator/rule_generator.functions | 113 +++++++++++ - src/udev/rule_generator/write_net_rules | 141 ++++++++++++++ - 7 files changed, 479 insertions(+), 3 deletions(-) - -Index: systemd-218/Makefile.am -=================================================================== ---- systemd-218.orig/Makefile.am -+++ systemd-218/Makefile.am -@@ -3416,7 +3416,14 @@ dist_udevrules_DATA += \ - rules/75-tty-description.rules \ - rules/78-sound-card.rules \ - rules/80-net-setup-link.rules \ -- rules/95-udev-late.rules -+ rules/95-udev-late.rules \ -+ src/udev/rule_generator/75-persistent-net-generator.rules \ -+ src/udev/rule_generator/76-net-sriov-names.rules -+ -+udevlibexec_PROGRAMS += \ -+ src/udev/rule_generator/rule_generator.functions \ -+ src/udev/rule_generator/write_net_rules \ -+ src/udev/rule_generator/net-set-sriov-names - - nodist_udevrules_DATA += \ - rules/99-systemd.rules -Index: systemd-218/src/udev/net/link-config.c -=================================================================== ---- systemd-218.orig/src/udev/net/link-config.c -+++ systemd-218/src/udev/net/link-config.c -@@ -176,16 +176,29 @@ static bool enable_name_policy(void) { - size_t l; - - r = proc_cmdline(&line); -- if (r < 0) { -+ if (r < 0) - log_warning_errno(r, "Failed to read /proc/cmdline, ignoring: %m"); -+#if defined(NET_IFNAMES) && (NET_IFNAMES == 1) -+# warning Using persistent rules as a default -+ if (r <= 0) -+ return false; -+ -+ FOREACH_WORD_QUOTED(w, l, line, state) -+ if (strneq(w, "net.ifnames=1", l)) -+ return true; -+ -+ return false; -+#else -+# warning Using predictable rules as a default -+ if (r <= 0) - return true; -- } - - FOREACH_WORD_QUOTED(word, l, line, state) - if (strneq(word, "net.ifnames=0", l)) - return false; - - return true; -+#endif - } - - int link_config_load(link_config_ctx *ctx) { -Index: systemd-218/src/udev/rule_generator/75-persistent-net-generator.rules +Index: systemd-210/src/udev/rule_generator/75-persistent-net-generator.rules =================================================================== --- /dev/null -+++ systemd-218/src/udev/rule_generator/75-persistent-net-generator.rules ++++ systemd-210/src/udev/rule_generator/75-persistent-net-generator.rules @@ -0,0 +1,105 @@ +# do not edit this file, it will be overwritten on update + @@ -174,117 +108,10 @@ +ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" + +LABEL="persistent_net_generator_end" -Index: systemd-218/src/udev/rule_generator/76-net-sriov-names.rules -=================================================================== ---- /dev/null -+++ systemd-218/src/udev/rule_generator/76-net-sriov-names.rules -@@ -0,0 +1,18 @@ -+# do not edit this file, it will be overwritten on update -+# -+# rename SRIOV virtual function interfaces -+ -+ACTION=="remove", GOTO="net-sriov-names_end" -+SUBSYSTEM!="net", GOTO="net-sriov-names_end" -+ -+IMPORT{cmdline}="net.ifnames" -+ENV{net.ifnames}=="1", GOTO="net-sriov-names_end" -+ -+SUBSYSTEM=="net", SUBSYSTEMS=="pci", ACTION=="add", NAME=="?*", ENV{INTERFACE_NEW}="$name" -+SUBSYSTEM=="net", SUBSYSTEMS=="pci", ACTION=="add", IMPORT{program}="net-set-sriov-names" -+ -+# rename interface if needed -+ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" -+ENV{INTERFACE_NEW}=="", DRIVERS=="cxgb4vf|igbvf|ixgbevf", NAME="vf$attr{ifindex}" -+ -+LABEL="net-sriov-names_end" -Index: systemd-218/src/udev/rule_generator/net-set-sriov-names -=================================================================== ---- /dev/null -+++ systemd-218/src/udev/rule_generator/net-set-sriov-names -@@ -0,0 +1,79 @@ -+#!/bin/bash -e -+# -+# This script is run to rename virtual interfaces -+# -+ -+if [ -n "$UDEV_LOG" ]; then -+ if [ "$UDEV_LOG" -ge 7 ]; then -+ set -x -+ fi -+fi -+ -+# according to dev_new_index(), ifindex is within [1, INT_MAX] -+int_max=$(/usr/bin/getconf INT_MAX) -+ifindex_before() { -+ a=$1 -+ b=$2 -+ -+ ((0 < (b - a) && (b - a) < int_max / 2 || -+ -1 * int_max < (b - a) && (b - a) < -1 * int_max / 2)) -+} -+ -+rename_interface() { -+ local src_net=$1 -+ local dest_net=$2 -+ local err=0 -+ -+ /sbin/ip link set dev $src_net down -+ /sbin/ip link set dev $src_net name $dest_net -+} -+ -+if [ -z "$INTERFACE" ]; then -+ echo "missing \$INTERFACE" >&2 -+ exit 1 -+fi -+ -+if [ -e "/sys/class/net/$INTERFACE/device/physfn" ]; then -+ pf=$(ls -1 "/sys/class/net/$INTERFACE/device/physfn/net") -+ if [ $(echo "$pf" | wc -l) -ne 1 ]; then -+ echo "too many pf's" >&2 -+ exit 1 -+ fi -+ read vfindex < "/sys/class/net/$INTERFACE/ifindex" -+ read pfindex < "/sys/class/net/$pf/ifindex" -+ if ifindex_before $pfindex $vfindex; then -+ bus_info=$(basename $(readlink "/sys/class/net/$INTERFACE/device")) -+ for virtfn in "/sys/class/net/$pf/device/"virtfn*; do -+ if [ "$(basename $(readlink "$virtfn"))" = "$bus_info" ]; then -+ vfnum=$(basename "$virtfn") -+ vfnum=${vfnum#virtfn} -+ echo "INTERFACE_NEW=$pf.vf$vfnum" -+ exit 0 -+ fi -+ done -+ fi -+fi -+ -+read pfindex < "/sys/class/net/$INTERFACE/ifindex" -+shopt -s nullglob -+for virtfn in "/sys/class/net/$INTERFACE/device/"virtfn*; do -+ vf=$(ls -1 "$virtfn/net") -+ if [ $(echo "$vf" | wc -l) -ne 1 ]; then -+ echo "too many vf's" >&2 -+ exit 1 -+ fi -+ read vfindex < "/sys/class/net/$vf/ifindex" -+ if ifindex_before $vfindex $pfindex; then -+ vfnum=$(basename "$virtfn") -+ vfnum=${vfnum#virtfn} -+ if [ "$INTERFACE_NEW" ]; then -+ new_name=$INTERFACE_NEW -+ else -+ new_name=$INTERFACE -+ fi -+ new_name="$new_name.vf$vfnum" -+ if [ "$vf" != "$new_name" ]; then -+ rename_interface "$vf" "$new_name" -+ fi -+ fi -+done -Index: systemd-218/src/udev/rule_generator/rule_generator.functions +Index: systemd-210/src/udev/rule_generator/rule_generator.functions =================================================================== --- /dev/null -+++ systemd-218/src/udev/rule_generator/rule_generator.functions ++++ systemd-210/src/udev/rule_generator/rule_generator.functions @@ -0,0 +1,113 @@ +# functions used by the udev rule generator + @@ -399,10 +226,10 @@ + $([ -e $RULES_FILE ] && echo $RULES_FILE) \ + 2>/dev/null) +} -Index: systemd-218/src/udev/rule_generator/write_net_rules +Index: systemd-210/src/udev/rule_generator/write_net_rules =================================================================== --- /dev/null -+++ systemd-218/src/udev/rule_generator/write_net_rules ++++ systemd-210/src/udev/rule_generator/write_net_rules @@ -0,0 +1,141 @@ +#!/bin/sh -e + @@ -545,3 +372,161 @@ +unlock_rules_file + +exit 0 +Index: systemd-210/Makefile.am +=================================================================== +--- systemd-210.orig/Makefile.am ++++ systemd-210/Makefile.am +@@ -2552,7 +2552,14 @@ dist_udevrules_DATA += \ + rules/75-tty-description.rules \ + rules/78-sound-card.rules \ + rules/80-net-setup-link.rules \ +- rules/95-udev-late.rules ++ rules/95-udev-late.rules \ ++ src/udev/rule_generator/75-persistent-net-generator.rules \ ++ src/udev/rule_generator/76-net-sriov-names.rules ++ ++udevlibexec_PROGRAMS += \ ++ src/udev/rule_generator/rule_generator.functions \ ++ src/udev/rule_generator/write_net_rules \ ++ src/udev/rule_generator/net-set-sriov-names + + dist_udevhwdb_DATA = \ + hwdb/20-pci-vendor-model.hwdb \ +Index: systemd-210/src/udev/rule_generator/76-net-sriov-names.rules +=================================================================== +--- /dev/null ++++ systemd-210/src/udev/rule_generator/76-net-sriov-names.rules +@@ -0,0 +1,18 @@ ++# do not edit this file, it will be overwritten on update ++# ++# rename SRIOV virtual function interfaces ++ ++ACTION=="remove", GOTO="net-sriov-names_end" ++SUBSYSTEM!="net", GOTO="net-sriov-names_end" ++ ++IMPORT{cmdline}="net.ifnames" ++ENV{net.ifnames}=="1", GOTO="net-sriov-names_end" ++ ++SUBSYSTEM=="net", SUBSYSTEMS=="pci", ACTION=="add", NAME=="?*", ENV{INTERFACE_NEW}="$name" ++SUBSYSTEM=="net", SUBSYSTEMS=="pci", ACTION=="add", IMPORT{program}="net-set-sriov-names" ++ ++# rename interface if needed ++ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" ++ENV{INTERFACE_NEW}=="", DRIVERS=="cxgb4vf|igbvf|ixgbevf", NAME="vf$attr{ifindex}" ++ ++LABEL="net-sriov-names_end" +Index: systemd-210/src/udev/rule_generator/net-set-sriov-names +=================================================================== +--- /dev/null ++++ systemd-210/src/udev/rule_generator/net-set-sriov-names +@@ -0,0 +1,79 @@ ++#!/bin/bash -e ++# ++# This script is run to rename virtual interfaces ++# ++ ++if [ -n "$UDEV_LOG" ]; then ++ if [ "$UDEV_LOG" -ge 7 ]; then ++ set -x ++ fi ++fi ++ ++# according to dev_new_index(), ifindex is within [1, INT_MAX] ++int_max=$(/usr/bin/getconf INT_MAX) ++ifindex_before() { ++ a=$1 ++ b=$2 ++ ++ ((0 < (b - a) && (b - a) < int_max / 2 || ++ -1 * int_max < (b - a) && (b - a) < -1 * int_max / 2)) ++} ++ ++rename_interface() { ++ local src_net=$1 ++ local dest_net=$2 ++ local err=0 ++ ++ /sbin/ip link set dev $src_net down ++ /sbin/ip link set dev $src_net name $dest_net ++} ++ ++if [ -z "$INTERFACE" ]; then ++ echo "missing \$INTERFACE" >&2 ++ exit 1 ++fi ++ ++if [ -e "/sys/class/net/$INTERFACE/device/physfn" ]; then ++ pf=$(ls -1 "/sys/class/net/$INTERFACE/device/physfn/net") ++ if [ $(echo "$pf" | wc -l) -ne 1 ]; then ++ echo "too many pf's" >&2 ++ exit 1 ++ fi ++ read vfindex < "/sys/class/net/$INTERFACE/ifindex" ++ read pfindex < "/sys/class/net/$pf/ifindex" ++ if ifindex_before $pfindex $vfindex; then ++ bus_info=$(basename $(readlink "/sys/class/net/$INTERFACE/device")) ++ for virtfn in "/sys/class/net/$pf/device/"virtfn*; do ++ if [ "$(basename $(readlink "$virtfn"))" = "$bus_info" ]; then ++ vfnum=$(basename "$virtfn") ++ vfnum=${vfnum#virtfn} ++ echo "INTERFACE_NEW=$pf.vf$vfnum" ++ exit 0 ++ fi ++ done ++ fi ++fi ++ ++read pfindex < "/sys/class/net/$INTERFACE/ifindex" ++shopt -s nullglob ++for virtfn in "/sys/class/net/$INTERFACE/device/"virtfn*; do ++ vf=$(ls -1 "$virtfn/net") ++ if [ $(echo "$vf" | wc -l) -ne 1 ]; then ++ echo "too many vf's" >&2 ++ exit 1 ++ fi ++ read vfindex < "/sys/class/net/$vf/ifindex" ++ if ifindex_before $vfindex $pfindex; then ++ vfnum=$(basename "$virtfn") ++ vfnum=${vfnum#virtfn} ++ if [ "$INTERFACE_NEW" ]; then ++ new_name=$INTERFACE_NEW ++ else ++ new_name=$INTERFACE ++ fi ++ new_name="$new_name.vf$vfnum" ++ if [ "$vf" != "$new_name" ]; then ++ rename_interface "$vf" "$new_name" ++ fi ++ fi ++done +Index: systemd-210/src/udev/net/link-config.c +=================================================================== +--- systemd-210.orig/src/udev/net/link-config.c ++++ systemd-210/src/udev/net/link-config.c +@@ -193,6 +193,18 @@ static bool enable_name_policy(void) { + r = proc_cmdline(&line); + if (r < 0) + log_warning("Failed to read /proc/cmdline, ignoring: %s", strerror(-r)); ++#if defined(NET_IFNAMES) && (NET_IFNAMES == 1) ++# warning Using persistent rules as a default ++ if (r <= 0) ++ return false; ++ ++ FOREACH_WORD_QUOTED(w, l, line, state) ++ if (strneq(w, "net.ifnames=1", l)) ++ return true; ++ ++ return false; ++#else ++# warning Using predictable rules as a default + if (r <= 0) + return true; + +@@ -201,6 +213,7 @@ static bool enable_name_policy(void) { + return false; + + return true; ++#endif + } + + int link_config_load(link_config_ctx *ctx) { ++++++ 1022-udev-remove-seqnum-API-and-all-assumptions-about-seq.patch ++++++ ++++ 1445 lines (skipped) ++++++ 1023-udev-builtin-keyboard-do-tell-on-which-device-EVIOCS.patch ++++++
From a52ec8ed881537627869afa8f0486db7e20ce2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org> Date: Fri, 30 May 2014 13:16:56 -0400 Subject: [PATCH] udev-builtin-keyboard: do tell on which device EVIOCSKEYCODE failed.
I am getting "Error calling EVIOCSKEYCODE (scan code 0xc022d, key code 418): Invalid argument", the error message does not tell on which specific device the problem is, add that info. --- src/udev/udev-builtin-keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/udev/udev-builtin-keyboard.c src/udev/udev-builtin-keyboard.c index 614e44e..9b66bfd 100644 --- src/udev/udev-builtin-keyboard.c +++ src/udev/udev-builtin-keyboard.c @@ -143,7 +143,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo log_debug("keyboard: mapping scan code %d (0x%x) to key code %d (0x%x)", map[i].scan, map[i].scan, map[i].key, map[i].key); if (ioctl(fd, EVIOCSKEYCODE, &map[i]) < 0) - log_error("Error calling EVIOCSKEYCODE (scan code 0x%x, key code %d): %m", map[i].scan, map[i].key); + log_error("Error calling EVIOCSKEYCODE on device node '%s' (scan code 0x%x, key code %d): %m", node, map[i].scan, map[i].key); } /* install list of force-release codes */ -- 1.7.9.2 ++++++ 1024-udev-always-close-lock-file-descriptor.patch ++++++ Based on 3d06f4183470d42361303086ed9dedd29c0ffc1b Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Tue, 3 Jun 2014 10:46:51 +0200 Subject: [PATCH] udev: always close lock file descriptor https://bugs.freedesktop.org/show_bug.cgi?id=79576 --- src/udev/udevd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- src/udev/udevd.c +++ src/udev/udevd.c 2014-06-03 15:34:42.778346368 +0000 @@ -301,6 +301,7 @@ static void worker_new(struct event *eve if (fd_lock >= 0 && flock(fd_lock, LOCK_SH|LOCK_NB) < 0) { log_debug("Unable to flock(%s), skipping event handling: %m", udev_device_get_devnode(d)); err = -EWOULDBLOCK; + close_nointr_nofail(fd_lock); fd_lock = -1; goto skip; } } @@ -318,7 +319,7 @@ static void worker_new(struct event *eve } if (fd_lock >= 0) - close(fd_lock); + close_nointr_nofail(fd_lock); /* send processed event back to libudev listeners */ udev_monitor_send_device(worker_monitor, NULL, dev); @@ -378,9 +379,9 @@ skip: out: udev_device_unref(dev); if (fd_signal >= 0) - close(fd_signal); + close_nointr_nofail(fd_signal); if (fd_ep >= 0) - close(fd_ep); + close_nointr_nofail(fd_ep); close(fd_inotify); close(worker_watch[WRITE_END]); udev_rules_unref(rules); ++++++ 1025-udev-exclude-device-mapper-from-block-device-ownersh.patch ++++++
From e918a1b5a94f270186dca59156354acd2a596494 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Tue, 3 Jun 2014 16:49:38 +0200 Subject: [PATCH] udev: exclude device-mapper from block device ownership event locking
Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/udevd.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 819ea3b..6c05104 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -290,7 +290,19 @@ static void worker_new(struct event *event) * acquired the lock, the external process will block until * udev has finished its event handling. */ - if (streq_ptr("block", udev_device_get_subsystem(dev))) { + + /* + * <kabi_> since we make check - device seems unused - we try + * ioctl to deactivate - and device is found to be opened + * <kay> sure, you try to take a write lock + * <kay> if you get it udev is out + * <kay> if you can't get it, udev is busy + * <kabi_> we cannot deactivate openned device (as it is in-use) + * <kay> maybe we should just exclude dm from that thing entirely + * <kabi_> IMHO this sounds like a good plan for this moment + */ + if (streq_ptr("block", udev_device_get_subsystem(dev)) && + !startswith("dm-", udev_device_get_sysname(dev))) { struct udev_device *d = dev; if (streq_ptr("partition", udev_device_get_devtype(d))) -- 1.8.4.5 ++++++ 1026-udevd-inotify-modernizations.patch ++++++
From edd32000c806e4527c5f376d138f7bff07724c26 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Wed, 4 Jun 2014 11:05:45 +0200 Subject: [PATCH] udevd: inotify - modernizations
Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/udevd.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) Index: systemd-210/src/udev/udevd.c =================================================================== --- systemd-210.orig/src/udev/udevd.c +++ systemd-210/src/udev/udevd.c @@ -736,20 +736,30 @@ out: return udev_ctrl_connection_unref(ctrl_conn); } +static void synthesize_change(struct udev_device *dev) { + char filename[UTIL_PATH_SIZE]; + + log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev)); + strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); + write_string_file(filename, "change"); +} + /* read inotify messages */ static int handle_inotify(struct udev *udev) { int nbytes, pos; char *buf; struct inotify_event *ev; + int r; - if ((ioctl(fd_inotify, FIONREAD, &nbytes) < 0) || (nbytes <= 0)) - return 0; + r = ioctl(fd_inotify, FIONREAD, &nbytes); + if (r < 0 || nbytes <= 0) + return -errno; buf = malloc(nbytes); - if (buf == NULL) { + if (!buf) { log_error("error getting buffer for inotify"); - return -1; + return -ENOMEM; } nbytes = read(fd_inotify, buf, nbytes); @@ -759,27 +769,16 @@ static int handle_inotify(struct udev *u ev = (struct inotify_event *)(buf + pos); dev = udev_watch_lookup(udev, ev->wd); - if (dev != NULL) { - log_debug("inotify event: %x for %s", ev->mask, udev_device_get_devnode(dev)); - if (ev->mask & IN_CLOSE_WRITE) { - char filename[UTIL_PATH_SIZE]; - int fd; - - log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev)); - strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); - fd = open(filename, O_WRONLY|O_CLOEXEC); - if (fd >= 0) { - if (write(fd, "change", 6) < 0) - log_debug("error writing uevent: %m"); - close(fd); - } - } - if (ev->mask & IN_IGNORED) - udev_watch_end(udev, dev); + if (!dev) + continue; - udev_device_unref(dev); - } + log_debug("inotify event: %x for %s", ev->mask, udev_device_get_devnode(dev)); + if (ev->mask & IN_CLOSE_WRITE) + synthesize_change(dev); + else if (ev->mask & IN_IGNORED) + udev_watch_end(udev, dev); + udev_device_unref(dev); } free(buf); ++++++ 1027-udev-synthesize-change-events-for-partitions-when-to.patch ++++++
From f3a740a5dae792fb6b2d411022ce8c29ced1c3f1 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Wed, 4 Jun 2014 12:16:28 +0200 Subject: [PATCH] udev: synthesize "change' events for partitions when tools change the disk
This should make sure that fdisk-like programs will automatically cause an update of all partitions, just like mkfs-like programs cause an update of the partition. Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/udevd.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) Index: systemd-210/src/udev/udevd.c =================================================================== --- systemd-210.orig/src/udev/udevd.c +++ systemd-210/src/udev/udevd.c @@ -46,6 +46,7 @@ #include <sys/utsname.h> #include "udev.h" +#include "udev-util.h" #include "sd-daemon.h" #include "cgroup-util.h" #include "dev-setup.h" @@ -736,15 +737,54 @@ out: return udev_ctrl_connection_unref(ctrl_conn); } -static void synthesize_change(struct udev_device *dev) { +static int synthesize_change(struct udev_device *dev) { char filename[UTIL_PATH_SIZE]; + int r; log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev)); strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); write_string_file(filename, "change"); + + /* for disks devices, re-trigger all partitions too */ + if (streq_ptr("block", udev_device_get_subsystem(dev)) && + streq_ptr("disk", udev_device_get_devtype(dev))) { + struct udev *udev = udev_device_get_udev(dev); + _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; + struct udev_list_entry *item; + + e = udev_enumerate_new(udev); + if (!e) + return -ENOMEM; + + r = udev_enumerate_add_match_parent(e, dev); + if (r < 0) + return r; + + r = udev_enumerate_add_match_subsystem(e, "block"); + if (r < 0) + return r; + + r = udev_enumerate_scan_devices(e); + udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) { + _cleanup_udev_device_unref_ struct udev_device *d = NULL; + + d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)); + if (!d) + continue; + + if (!streq_ptr("partition", udev_device_get_devtype(d))) + continue; + + log_debug("device %s closed, synthesising partition '%s' 'change'", + udev_device_get_devnode(dev), udev_device_get_devnode(d)); + strscpyl(filename, sizeof(filename), udev_device_get_syspath(d), "/uevent", NULL); + write_string_file(filename, "change"); + } + } + + return 0; } -/* read inotify messages */ static int handle_inotify(struct udev *udev) { int nbytes, pos; ++++++ 1028-udev-link-config-fix-mem-leak.patch ++++++
From edf029b7fd9a5853a87d3ca99aac2922bb8a277e Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Wed, 4 Jun 2014 12:34:23 +0200 Subject: [PATCH] udev: link-config - fix mem leak
Reported by Kay. Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/net/link-config.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: systemd-210/src/udev/net/link-config.c =================================================================== --- systemd-210.orig/src/udev/net/link-config.c +++ systemd-210/src/udev/net/link-config.c @@ -118,6 +118,7 @@ static void link_configs_free(link_confi free(link->match_type); free(link->description); free(link->alias); + free(link->name_policy); free(link); } @@ -205,7 +206,8 @@ static bool enable_name_policy(void) { int link_config_load(link_config_ctx *ctx) { int r; - char **files, **f; + _cleanup_strv_free_ char **files; + char **f; link_configs_free(ctx); ++++++ 1029-udev-try-first-re-reading-the-partition-table.patch ++++++
From ede344452a54e1c53f541cad12a06269a4fe96a9 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Wed, 4 Jun 2014 13:30:24 +0200 Subject: [PATCH] udev: try first re-reading the partition table
mounted partitions: # dd if=/dev/zero of=/dev/sda bs=1 count=1 UDEV [4157.369250] change .../0:0:0:0/block/sda (block) UDEV [4157.375059] change .../0:0:0:0/block/sda/sda1 (block) UDEV [4157.397088] change .../0:0:0:0/block/sda/sda2 (block) UDEV [4157.404842] change .../0:0:0:0/block/sda/sda4 (block) unmounted partitions: # dd if=/dev/zero of=/dev/sdb bs=1 count=1 UDEV [4163.450217] remove .../target6:0:0/6:0:0:0/block/sdb/sdb1 (block) UDEV [4163.593167] change .../target6:0:0/6:0:0:0/block/sdb (block) UDEV [4163.713982] add .../target6:0:0/6:0:0:0/block/sdb/sdb1 (block) Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/udevd.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) Index: systemd-210/src/udev/udevd.c =================================================================== --- systemd-210.orig/src/udev/udevd.c +++ systemd-210/src/udev/udevd.c @@ -38,6 +38,7 @@ #include <sys/un.h> #include <sys/signalfd.h> #include <sys/epoll.h> +#include <sys/mount.h> #include <sys/poll.h> #include <sys/wait.h> #include <sys/stat.h> @@ -741,17 +742,37 @@ static int synthesize_change(struct udev char filename[UTIL_PATH_SIZE]; int r; - log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev)); - strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); - write_string_file(filename, "change"); - - /* for disks devices, re-trigger all partitions too */ if (streq_ptr("block", udev_device_get_subsystem(dev)) && - streq_ptr("disk", udev_device_get_devtype(dev))) { + streq_ptr("disk", udev_device_get_devtype(dev)) && + !startswith("dm-", udev_device_get_sysname(dev))) { + int fd; struct udev *udev = udev_device_get_udev(dev); _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; struct udev_list_entry *item; + /* + * Try to re-read the partition table, this only succeeds if + * none of the devices is busy. + * + * The kernel will send out a change event for the disk, and + * "remove/add" for all partitions. + */ + fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK); + if (fd >= 0) { + r = ioctl(fd, BLKRRPART, 0); + close(fd); + if (r >= 0) + return 0; + } + + /* + * Re-reading the partition table did not work, synthesize "change" + * events for the disk and all partitions. + */ + log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev)); + strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); + write_string_file(filename, "change"); + e = udev_enumerate_new(udev); if (!e) return -ENOMEM; @@ -780,8 +801,14 @@ static int synthesize_change(struct udev strscpyl(filename, sizeof(filename), udev_device_get_syspath(d), "/uevent", NULL); write_string_file(filename, "change"); } + + return 0; } + log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev)); + strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); + write_string_file(filename, "change"); + return 0; } ++++++ 1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch ++++++
From 10fab50a3091e0b819c3ddab5a7c07acf750c050 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Wed, 4 Jun 2014 14:09:31 +0200 Subject: [PATCH] udev: guard REREADP logic with open(O_ECXL)
Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: systemd-210/src/udev/udevd.c =================================================================== --- systemd-210.orig/src/udev/udevd.c +++ systemd-210/src/udev/udevd.c @@ -757,7 +757,7 @@ static int synthesize_change(struct udev * The kernel will send out a change event for the disk, and * "remove/add" for all partitions. */ - fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK); + fd = open(udev_device_get_devnode(dev), O_RDONLY|O_EXCL|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK); if (fd >= 0) { r = ioctl(fd, BLKRRPART, 0); close(fd); ++++++ 1031-udev-make-sure-we-always-get-change-for-the-disk.patch ++++++
From e9fc29f4ecc9509ccc02eb8a014341e26c0d7831 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Wed, 4 Jun 2014 15:17:15 +0200 Subject: [PATCH] udev: make sure we always get "change" for the disk
The kernel will return 0 for REREADPT when no partition table is found, we have to send out "change" ourselves. Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/udevd.c | 53 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 14 deletions(-) Index: systemd-210/src/udev/udevd.c =================================================================== --- systemd-210.orig/src/udev/udevd.c +++ systemd-210/src/udev/udevd.c @@ -745,34 +745,28 @@ static int synthesize_change(struct udev if (streq_ptr("block", udev_device_get_subsystem(dev)) && streq_ptr("disk", udev_device_get_devtype(dev)) && !startswith("dm-", udev_device_get_sysname(dev))) { + bool part_table_read = false; + bool has_partitions = false; int fd; struct udev *udev = udev_device_get_udev(dev); _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; struct udev_list_entry *item; /* - * Try to re-read the partition table, this only succeeds if - * none of the devices is busy. - * - * The kernel will send out a change event for the disk, and - * "remove/add" for all partitions. + * Try to re-read the partition table. This only succeeds if + * none of the devices is busy. The kernel returns 0 if no + * partition table is found, and we will not get an event for + * the disk. */ fd = open(udev_device_get_devnode(dev), O_RDONLY|O_EXCL|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK); if (fd >= 0) { r = ioctl(fd, BLKRRPART, 0); close(fd); if (r >= 0) - return 0; + part_table_read = true; } - /* - * Re-reading the partition table did not work, synthesize "change" - * events for the disk and all partitions. - */ - log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev)); - strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); - write_string_file(filename, "change"); - + /* search for partitions */ e = udev_enumerate_new(udev); if (!e) return -ENOMEM; @@ -786,6 +780,37 @@ static int synthesize_change(struct udev return r; r = udev_enumerate_scan_devices(e); + + udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) { + _cleanup_udev_device_unref_ struct udev_device *d = NULL; + + d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)); + if (!d) + continue; + + if (!streq_ptr("partition", udev_device_get_devtype(d))) + continue; + + has_partitions = true; + break; + } + + /* + * We have partitions and re-read the table, the kernel already sent + * out a "change" event for the disk, and "remove/add" for all + * partitions. + */ + if (part_table_read && has_partitions) + return 0; + + /* + * We have partitions but re-reading the partition table did not + * work, synthesize "change" for the disk and all partitions. + */ + log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev)); + strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); + write_string_file(filename, "change"); + udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) { _cleanup_udev_device_unref_ struct udev_device *d = NULL; ++++++ 1032-udev-guard-REREADPT-by-exclusive-lock-instead-of-O_E.patch ++++++
From 02ba8fb3357daf57f6120ac512fb464a4c623419 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Wed, 4 Jun 2014 16:21:19 +0200 Subject: [PATCH] udev: guard REREADPT by exclusive lock instead of O_EXCL
Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/udevd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) Index: systemd-210/src/udev/udevd.c =================================================================== --- systemd-210.orig/src/udev/udevd.c +++ systemd-210/src/udev/udevd.c @@ -758,9 +758,12 @@ static int synthesize_change(struct udev * partition table is found, and we will not get an event for * the disk. */ - fd = open(udev_device_get_devnode(dev), O_RDONLY|O_EXCL|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK); + fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK); if (fd >= 0) { - r = ioctl(fd, BLKRRPART, 0); + r = flock(fd, LOCK_EX|LOCK_NB); + if (r >= 0) + r = ioctl(fd, BLKRRPART, 0); + close(fd); if (r >= 0) part_table_read = true; ++++++ 1033-udev-really-exclude-device-mapper-from-block-device.patch ++++++
From 638ca89c53e2b897cfb3f627f4acbc7d09af2f4c Mon Sep 17 00:00:00 2001 From: Christian Hesse <mail@eworm.de> Date: Tue, 10 Jun 2014 15:51:15 +0200 Subject: [PATCH] udev: really exclude device-mapper from block device ownership event locking
Arguments were wrong order, no? This fixes commits: e918a1b5a94f270186dca59156354acd2a596494 3d06f4183470d42361303086ed9dedd29c0ffc1b Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/udevd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: systemd-210/src/udev/udevd.c =================================================================== --- systemd-210.orig/src/udev/udevd.c +++ systemd-210/src/udev/udevd.c @@ -304,7 +304,7 @@ static void worker_new(struct event *eve * <kabi_> IMHO this sounds like a good plan for this moment */ if (streq_ptr("block", udev_device_get_subsystem(dev)) && - !startswith("dm-", udev_device_get_sysname(dev))) { + !startswith(udev_device_get_sysname(dev), "dm-")) { struct udev_device *d = dev; if (streq_ptr("partition", udev_device_get_devtype(d))) @@ -744,7 +744,7 @@ static int synthesize_change(struct udev if (streq_ptr("block", udev_device_get_subsystem(dev)) && streq_ptr("disk", udev_device_get_devtype(dev)) && - !startswith("dm-", udev_device_get_sysname(dev))) { + !startswith(udev_device_get_sysname(dev), "dm-")) { bool part_table_read = false; bool has_partitions = false; int fd; ++++++ 1034-udev-check-the-return-value-from-udev_enumerate_scan.patch ++++++
From 47a3fa0f7679521b85f7aeba9e245c52cc7bb2cb Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com> Date: Wed, 4 Jun 2014 23:40:43 +0200 Subject: [PATCH] udev: check the return value from udev_enumerate_scan_devices
The return value from udev_enumerate_scan_devices was stored but never used. I assume this was meant to be checked. Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/udev/udevd.c | 2 ++ 1 file changed, 2 insertions(+) Index: systemd-210/src/udev/udevd.c =================================================================== --- systemd-210.orig/src/udev/udevd.c +++ systemd-210/src/udev/udevd.c @@ -783,6 +783,8 @@ static int synthesize_change(struct udev return r; r = udev_enumerate_scan_devices(e); + if (r < 0) + return r; udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) { _cleanup_udev_device_unref_ struct udev_device *d = NULL; ++++++ 1038-udev-fix-invalid-free-in-enable_name_policy.patch ++++++
From f8a0bb5285024b6ce372c3157e761e6543ebdcd2 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson <andreas@fatal.se> Date: Fri, 13 Jun 2014 18:48:21 +0200 Subject: [PATCH] udev: fix invalid free() in enable_name_policy()
static bool enable_name_policy(...) in ./src/udev/net/link-config.c calls proc_cmdline(...) to get "line" initialized, but proc_cmdline(...) does not guarantee that atleast when both conditions (detect_container(NULL) > 0) and read_full_file(...) returned < 0. --- src/udev/net/link-config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/udev/net/link-config.c src/udev/net/link-config.c index a9acc3d..7a9d01b 100644 --- src/udev/net/link-config.c +++ src/udev/net/link-config.c @@ -185,7 +185,7 @@ static int load_link(link_config_ctx *ctx, const char *filename) { } static bool enable_name_policy(void) { - _cleanup_free_ char *line; + _cleanup_free_ char *line = NULL; char *w, *state; int r; size_t l; -- 1.7.9.2 ++++++ 1039-udevadm-settle-fixed-return-code-for-empty-queue.patch ++++++
From 83be2c398589a3d64db5999cfd5527c5219bff46 Mon Sep 17 00:00:00 2001 From: Harald Hoyer <harald@redhat.com> Date: Tue, 20 May 2014 12:25:16 +0200 Subject: [PATCH] udevadm-settle: fixed return code for empty queue
If the udev queue is empty and "/run/udev/queue" does not exist, "udevadm settle" would return with EXIT_FAILURE, because the inotify on "/run/udev/queue" would fail with ENOENT. This patch lets "udevadm settle" exit with EXIT_SUCCESS in this case. --- src/udev/udevadm-settle.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git src/udev/udevadm-settle.c src/udev/udevadm-settle.c index 65fc35f..66fd843 100644 --- src/udev/udevadm-settle.c +++ src/udev/udevadm-settle.c @@ -116,7 +116,11 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) } if (inotify_add_watch(pfd[0].fd, "/run/udev/queue" , IN_DELETE) < 0) { - log_debug("watching /run/udev failed"); + /* If it does not exist, we don't have to wait */ + if (errno == ENOENT) + rc = EXIT_SUCCESS; + else + log_debug("watching /run/udev/queue failed"); goto out; } -- 1.7.9.2 ++++++ 1041-libudev-fix-udev_queue_get_queue_is_empty-logic.patch ++++++
From 45e60962b7965f32755a76b79a28126299aac149 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Fri, 27 Jun 2014 14:20:17 +0200 Subject: [PATCH] libudev: fix udev_queue_get_queue_is_empty() logic
--- src/libudev/libudev-queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/libudev/libudev-queue.c src/libudev/libudev-queue.c index eb0e096..c32a7ef 100644 --- src/libudev/libudev-queue.c +++ src/libudev/libudev-queue.c @@ -175,7 +175,7 @@ _public_ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) **/ _public_ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) { - return access("/run/udev/queue", F_OK) >= 0; + return access("/run/udev/queue", F_OK) < 0; } /** -- 1.7.9.2 ++++++ 1042-libudev-queue-provide-file-descriptor-to-watch-busy-.patch ++++++ Based on 14cb733684d3c3f50d088a3a370ddf8e8894dfa4 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Fri, 27 Jun 2014 17:42:44 +0200 Subject: [PATCH] libudev: queue provide file descriptor to watch busy event queue --- docs/libudev/libudev-sections.txt | 2 ++ src/libudev/libudev-queue.c | 46 +++++++++++++++++++++++++++++++++++ src/libudev/libudev.h | 2 ++ src/libudev/libudev.sym | 2 ++ src/udev/udevadm-settle.c | 48 ++++++++++++++++--------------------- 5 files changed, 73 insertions(+), 27 deletions(-) diff --git docs/libudev/libudev-sections.txt docs/libudev/libudev-sections.txt index c154645..8a31ded 100644 --- docs/libudev/libudev-sections.txt +++ docs/libudev/libudev-sections.txt @@ -116,6 +116,8 @@ udev_queue_get_seqnum_sequence_is_finished udev_queue_get_queued_list_entry udev_queue_get_kernel_seqnum udev_queue_get_udev_seqnum +udev_queue_get_fd +udev_queue_flush </SECTION> <SECTION> diff --git src/libudev/libudev-queue.c src/libudev/libudev-queue.c index c32a7ef..d4334b4 100644 --- src/libudev/libudev-queue.c +++ src/libudev/libudev-queue.c @@ -26,6 +26,7 @@ #include <string.h> #include <limits.h> #include <sys/stat.h> +#include <sys/inotify.h> #include "libudev.h" #include "libudev-private.h" @@ -45,6 +46,7 @@ struct udev_queue { struct udev *udev; int refcount; + int fd; }; /** @@ -69,6 +71,7 @@ _public_ struct udev_queue *udev_queue_new(struct udev *udev) udev_queue->refcount = 1; udev_queue->udev = udev; + udev_queue->fd = -1; return udev_queue; } @@ -107,6 +110,9 @@ _public_ struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue) if (udev_queue->refcount > 0) return NULL; + if (udev_queue->fd >= 0) + close_nointr_nofail(udev_queue->fd); + free(udev_queue); return NULL; } @@ -222,3 +228,44 @@ _public_ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_qu { return NULL; } + +/** + * udev_queue_get_fd: + * @udev_queue: udev queue context + * + * Returns: a file descriptor to watch for a queue to become empty. + */ +_public_ int udev_queue_get_fd(struct udev_queue *udev_queue) { + int fd; + int r; + + if (udev_queue->fd >= 0) + return udev_queue->fd; + + fd = inotify_init1(IN_CLOEXEC); + if (fd < 0) + return -errno; + + r = inotify_add_watch(fd, "/run/udev/queue" , IN_DELETE); + if (r < 0) { + r = -errno; + close(fd); + return r; + } + + udev_queue->fd = fd; + return fd; +} + +/** + * udev_queue_flush: + * @udev_queue: udev queue context + * + * Returns: the result of clearing the watch for queue changes. + */ +_public_ int udev_queue_flush(struct udev_queue *udev_queue) { + if (udev_queue->fd < 0) + return -EINVAL; + + return flush_fd(udev_queue->fd); +} diff --git src/libudev/libudev.h src/libudev/libudev.h index ceb89bd..4f2f115 100644 --- src/libudev/libudev.h +++ src/libudev/libudev.h @@ -177,6 +177,8 @@ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue); int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) __attribute__ ((deprecated)); int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, unsigned long long int start, unsigned long long int end) __attribute__ ((deprecated)); +int udev_queue_get_fd(struct udev_queue *udev_queue); +int udev_queue_flush(struct udev_queue *udev_queue); struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) __attribute__ ((deprecated)); /* diff --git src/libudev/libudev.sym src/libudev/libudev.sym index 1e6f885..95cd1c7 100644 --- src/libudev/libudev.sym +++ src/libudev/libudev.sym @@ -82,6 +82,8 @@ global: udev_queue_get_udev; udev_queue_get_udev_is_active; udev_queue_get_udev_seqnum; + udev_queue_get_fd; + udev_queue_flush; udev_queue_new; udev_queue_ref; udev_queue_unref; diff --git src/udev/udevadm-settle.c src/udev/udevadm-settle.c index 66fd843..79e8b59 100644 --- src/udev/udevadm-settle.c +++ src/udev/udevadm-settle.c @@ -29,7 +29,6 @@ #include <getopt.h> #include <signal.h> #include <time.h> -#include <sys/inotify.h> #include <sys/poll.h> #include <sys/stat.h> #include <sys/types.h> @@ -59,7 +58,9 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) const char *exists = NULL; unsigned int timeout = 120; struct pollfd pfd[1] = { {.fd = -1}, }; - int rc = EXIT_FAILURE, c; + int c; + struct udev_queue *queue; + int rc = EXIT_FAILURE; while ((c = getopt_long(argc, argv, "s:e:t:E:qh", options, NULL)) >= 0) { switch (c) { @@ -79,9 +80,9 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) break; case 'h': help(); - exit(EXIT_SUCCESS); + return EXIT_SUCCESS; case '?': - exit(EXIT_FAILURE); + return EXIT_FAILURE; default: assert_not_reached("Unknown argument"); } @@ -89,7 +90,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) if (optind < argc) { fprintf(stderr, "Extraneous argument: '%s'\n", argv[optind]); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } /* guarantee that the udev daemon isn't pre-processing */ @@ -101,26 +102,23 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) if (udev_ctrl_send_ping(uctrl, timeout) < 0) { log_debug("no connection to daemon"); udev_ctrl_unref(uctrl); - rc = EXIT_SUCCESS; - goto out; + return EXIT_SUCCESS; } udev_ctrl_unref(uctrl); } } - pfd[0].events = POLLIN; - pfd[0].fd = inotify_init1(IN_CLOEXEC); - if (pfd[0].fd < 0) { - log_error("inotify_init failed: %m"); - goto out; + queue = udev_queue_new(udev); + if (!queue) { + log_error("unable to get udev queue"); + return EXIT_FAILURE; } - if (inotify_add_watch(pfd[0].fd, "/run/udev/queue" , IN_DELETE) < 0) { - /* If it does not exist, we don't have to wait */ - if (errno == ENOENT) - rc = EXIT_SUCCESS; - else - log_debug("watching /run/udev/queue failed"); + pfd[0].events = POLLIN; + pfd[0].fd = udev_queue_get_fd(queue); + if (pfd[0].fd < 0) { + log_debug("queue is empty, nothing to watch"); + rc = EXIT_SUCCESS; goto out; } @@ -131,22 +129,18 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) } /* exit if queue is empty */ - if (access("/run/udev/queue", F_OK) < 0) { + if (udev_queue_get_queue_is_empty(queue)) { rc = EXIT_SUCCESS; break; } - /* wake up when "queue" file is deleted */ - if (poll(pfd, 1, 100) > 0 && pfd[0].revents & POLLIN) { - char buf[sizeof(struct inotify_event) + PATH_MAX]; - - read(pfd[0].fd, buf, sizeof(buf)); - } + /* wake up when queue is empty */ + if (poll(pfd, 1, 100) > 0 && pfd[0].revents & POLLIN) + udev_queue_flush(queue); } out: - if (pfd[0].fd >= 0) - close(pfd[0].fd); + udev_queue_unref(queue); return rc; } -- 1.7.9.2 ++++++ 1043-libudev-queue-watch-entire-directory-to-allow-the-re.patch ++++++
From 8a7a0c19edd2d971d4aa9d635f7978af841e8278 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Fri, 27 Jun 2014 19:54:45 +0200 Subject: [PATCH] libudev: queue - watch entire directory to allow the re-use of the watch descriptor
--- src/libudev/libudev-queue.c | 2 +- src/udev/udevadm-settle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git src/libudev/libudev-queue.c src/libudev/libudev-queue.c index d4334b4..8ef1f3d 100644 --- src/libudev/libudev-queue.c +++ src/libudev/libudev-queue.c @@ -245,7 +245,7 @@ _public_ int udev_queue_get_fd(struct udev_queue *udev_queue) { if (fd < 0) return -errno; - r = inotify_add_watch(fd, "/run/udev/queue" , IN_DELETE); + r = inotify_add_watch(fd, "/run/udev" , IN_DELETE); if (r < 0) { r = -errno; close(fd); diff --git src/udev/udevadm-settle.c src/udev/udevadm-settle.c index 79e8b59..fa5b0c2 100644 --- src/udev/udevadm-settle.c +++ src/udev/udevadm-settle.c @@ -135,7 +135,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) } /* wake up when queue is empty */ - if (poll(pfd, 1, 100) > 0 && pfd[0].revents & POLLIN) + if (poll(pfd, 1, MSEC_PER_SEC) > 0 && pfd[0].revents & POLLIN) udev_queue_flush(queue); } -- 1.7.9.2 ++++++ 1044-rules-update-qemu-hid-rules.patch ++++++
From cd31d1884f1ecf38e11bc6268f446d75dfafbc25 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann <kraxel@redhat.com> Date: Mon, 24 Mar 2014 12:07:41 +0100 Subject: [PATCH] rules: update qemu hid rules
Update comment to be a bit more specific. Change match to blacklist the serial number of the broken devices instead of whitelisting the serial number of the fixed devices. This allows to do something useful with the serial number in the future. --- rules/42-usb-hid-pm.rules | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git rules/42-usb-hid-pm.rules rules/42-usb-hid-pm.rules index 3fd6e8a..c675b5b 100644 --- rules/42-usb-hid-pm.rules +++ rules/42-usb-hid-pm.rules @@ -2,14 +2,15 @@ # # Enable autosuspend for qemu emulated usb hid devices -# Note that there are buggy qemu versions which advertise remote -# wakeup support but don't actually implement it correctly. This -# is the reason why we need a match for the serial number here. -# The serial number "42" is used to tag the implementations where +# Note that there are buggy qemu versions (0.13 & older) which +# advertise remote wakeup support but don't actually implement +# it correctly. This is the reason why we need a match for the +# serial number here. Old, broken versions have serial "1". +# It has been changed to "42" after fixing the bug to indicate # remote wakeup is working. -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto" # Catch-all for Avocent HID devices. Keyed off interface in order to only # trigger on HID class devices. -- 1.7.9.2 ++++++ 1045-rules-don-t-enable-usb-pm-for-Avocent-devices.patch ++++++ Based on 52fb538361053f8c4abce0e40cd0bae3d28ceb16 Mon Sep 17 00:00:00 2001 From: Tom Hirst <tom.hirst@ipe-systems.co.uk> Date: Wed, 25 Jun 2014 11:57:11 +0000 Subject: [PATCH] rules: don't enable usb pm for Avocent devices The Avocent KVM over IP devices doesn't work correctly with USB power management enabled. --- rules/42-usb-hid-pm.rules | 4 ---- 1 file changed, 4 deletions(-) diff --git rules/42-usb-hid-pm.rules rules/42-usb-hid-pm.rules index c675b5b..4c300da 100644 --- rules/42-usb-hid-pm.rules +++ rules/42-usb-hid-pm.rules @@ -12,10 +12,6 @@ ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}!= ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto" ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto" -# Catch-all for Avocent HID devices. Keyed off interface in order to only -# trigger on HID class devices. -ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0624", ATTR{bInterfaceClass}=="03", TEST=="../power/control", ATTR{../power/control}="auto" - # Dell DRAC 4 ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="413c", ATTR{idProduct}=="2500", TEST=="power/control", ATTR{power/control}="auto" -- 1.7.9.2 ++++++ 1047-udev-net_setup_link-builtin-should-print-the-reason-.patch ++++++
From 01d4590b775661ebc71c7b81b0c62ccd69395268 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 2 Jul 2014 15:13:29 +0200 Subject: [PATCH] udev: net_setup_link builtin should print the reason why something fails
Let's tell users what is going wrong. --- src/udev/udev-builtin-net_setup_link.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git src/udev/udev-builtin-net_setup_link.c src/udev/udev-builtin-net_setup_link.c index 3cd384e..6207269 100644 --- src/udev/udev-builtin-net_setup_link.c +++ src/udev/udev-builtin-net_setup_link.c @@ -43,17 +43,17 @@ static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv r = link_config_get(ctx, dev, &link); if (r < 0) { if (r == -ENOENT) { - log_debug("No matching link configuration found"); + log_debug("No matching link configuration found."); return EXIT_SUCCESS; } else { - log_error("Could not get link config"); + log_error("Could not get link config: %s", strerror(-r)); return EXIT_FAILURE; } } r = link_config_apply(ctx, link, dev, &name); if (r < 0) { - log_error("Could not apply link config to %s", udev_device_get_sysname(dev)); + log_error("Could not apply link config to %s: %s", udev_device_get_sysname(dev), strerror(-r)); return EXIT_FAILURE; } @@ -77,18 +77,18 @@ static int builtin_net_setup_link_init(struct udev *udev) { if (r < 0) return r; - log_debug("Created link configuration context"); + log_debug("Created link configuration context."); return 0; } static void builtin_net_setup_link_exit(struct udev *udev) { link_config_ctx_free(ctx); ctx = NULL; - log_debug("Unloaded link configuration context"); + log_debug("Unloaded link configuration context."); } static bool builtin_net_setup_link_validate(struct udev *udev) { - log_debug("Check if link configuration needs reloading"); + log_debug("Check if link configuration needs reloading."); if (!ctx) return false; -- 1.7.9.2 ++++++ 1048-udev-net_setup_link-add-a-bit-more-logging.patch ++++++
From 866ee3682213789f85b877700457fdca05695a0e Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 3 Jul 2014 09:57:27 +0200 Subject: [PATCH] udev: net_setup_link - add a bit more logging
--- src/udev/net/link-config.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git src/udev/net/link-config.c src/udev/net/link-config.c index 7a9d01b..b8650a6 100644 --- src/udev/net/link-config.c +++ src/udev/net/link-config.c @@ -92,14 +92,20 @@ static int link_config_ctx_connect(link_config_ctx *ctx) { if (ctx->ethtool_fd == -1) { r = ethtool_connect(&ctx->ethtool_fd); - if (r < 0) + if (r < 0) { + log_warning("link_config: could not connect to ethtool: %s", + strerror(-r)); return r; + } } if (!ctx->rtnl) { r = sd_rtnl_open(&ctx->rtnl, 0); - if (r < 0) + if (r < 0) { + log_warning("link_config: could not connect to rtnl: %s", + strerror(-r)); return r; + } } return 0; -- 1.7.9.2 ++++++ 1049-udev-link_config-ignore-errors-due-to-missing-MAC-ad.patch ++++++ Based on a669ea9860900d5cdebbc4cb9aaea72db7e28a02 Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Mon, 7 Jul 2014 14:50:16 +0200 Subject: [PATCH] udev: link_config - ignore errors due to missing MAC address Otherwis, we get misleading error messages on links with MACs. Reported by Leonid Isaev. --- src/udev/net/link-config.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- src/udev/net/link-config.c +++ src/udev/net/link-config.c 2014-07-08 10:44:19.450735575 +0000 @@ -440,7 +440,9 @@ int link_config_apply(link_config_ctx *c case MACPOLICY_PERSISTENT: if (!mac_is_permanent(device)) { r = get_mac(device, false, &generated_mac); - if (r < 0) + if (r == -ENOENT) + break; + else if (r < 0) return r; mac = &generated_mac; } @@ -448,7 +450,9 @@ int link_config_apply(link_config_ctx *c case MACPOLICY_RANDOM: if (!mac_is_random(device)) { r = get_mac(device, true, &generated_mac); - if (r < 0) + if (r == -ENOENT) + break; + else if (r < 0) return r; mac = &generated_mac; } ++++++ 1052-rules-uaccess-add-ID_SOFTWARE_RADIO.patch ++++++
From 30632d97d9d68c8202e562f34afae8f8d6e9c377 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Tue, 15 Jul 2014 17:35:53 +0200 Subject: [PATCH] rules: uaccess - add ID_SOFTWARE_RADIO
On Tue, Jul 15, 2014 at 1:52 PM, Alick Zhao <alick9188@gmail.com> wrote:
So maybe ID_SOFTWARE_RADIO ?
Hmm, SDR is more a term for a generic technology than for a device class. To me it does not really sound like an administrator would know what this is.
What exactly is the device or subsystem you want to make accessible to locally logged-in users only?
Initially it is bladeRF, but many more are of interest: USRP, rtl-sdr, HackRF, ... [1]
I agree an administrator might not know what SDR is, since it is currently still not widely known, and makes sense only for amateurs and researchers. But as a SDR fan, I see many new SDR peripherals are created recently, and expect to see more. So a generic ID seems reasonable to me.
[1] http://en.wikipedia.org/wiki/List_of_software-defined_radios
src/login/70-uaccess.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git src/login/70-uaccess.rules src/login/70-uaccess.rules index 57f619d..694df2c 100644 --- src/login/70-uaccess.rules +++ src/login/70-uaccess.rules @@ -72,4 +72,7 @@ ENV{DDC_DEVICE}=="?*", TAG+="uaccess" # media player raw devices (for user-mode drivers, Android SDK, etc.) SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="uaccess" +# software-defined radio communication devices +ENV{ID_SOFTWARE_RADIO}=="?*", TAG+="uaccess" + LABEL="uaccess_end" -- 1.7.9.2 ++++++ 1054-udev-exclude-MD-from-block-device-ownership-event-lo.patch ++++++
From 2e5b17d01347d3c3118be2b8ad63d20415dbb1f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Thu, 24 Jul 2014 23:37:35 +0200 Subject: [PATCH] udev: exclude MD from block device ownership event locking
MD instantiates devices at open(). This is incomptible with the locking logic, as the "change" event emitted when stopping a device will bring it back. --- src/udev/udevd.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git src/udev/udevd.c src/udev/udevd.c index a45d324..db935d6 100644 --- src/udev/udevd.c +++ src/udev/udevd.c @@ -285,26 +285,17 @@ static void worker_new(struct event *event) udev_event->exec_delay = exec_delay; /* - * Take a "read lock" on the device node; this establishes + * Take a shared lock on the device node; this establishes * a concept of device "ownership" to serialize device - * access. External processes holding a "write lock" will + * access. External processes holding an exclusive lock will * cause udev to skip the event handling; in the case udev - * acquired the lock, the external process will block until + * acquired the lock, the external process can block until * udev has finished its event handling. */ - - /* - * <kabi_> since we make check - device seems unused - we try - * ioctl to deactivate - and device is found to be opened - * <kay> sure, you try to take a write lock - * <kay> if you get it udev is out - * <kay> if you can't get it, udev is busy - * <kabi_> we cannot deactivate openned device (as it is in-use) - * <kay> maybe we should just exclude dm from that thing entirely - * <kabi_> IMHO this sounds like a good plan for this moment - */ - if (streq_ptr("block", udev_device_get_subsystem(dev)) && - !startswith(udev_device_get_sysname(dev), "dm-")) { + if (!streq_ptr(udev_device_get_action(dev), "remove") && + streq_ptr("block", udev_device_get_subsystem(dev)) && + !startswith(udev_device_get_sysname(dev), "dm-") && + !startswith(udev_device_get_sysname(dev), "md")) { struct udev_device *d = dev; if (streq_ptr("partition", udev_device_get_devtype(d))) -- 1.7.9.2 ++++++ 1056-udevd-add-event-timeout-commandline-option.patch ++++++
From 9719859c07aa13539ed2cd4b31972cd30f678543 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke <hare@suse.de> Date: Tue, 29 Jul 2014 09:06:14 +0200 Subject: [PATCH] udevd: add --event-timeout commandline option
Some events take longer than the default 30 seconds. Killing those events will leave the machine halfway configured. Add a commandline option '--event-timeout' to handle these cases. --- man/systemd-udevd.service.xml | 19 +++++++++++++++++++ src/udev/udevd.c | 12 +++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git man/systemd-udevd.service.xml man/systemd-udevd.service.xml index f44b7a0..8de43b1 100644 --- man/systemd-udevd.service.xml +++ man/systemd-udevd.service.xml @@ -44,6 +44,7 @@ <arg><option>--debug</option></arg> <arg><option>--children-max=</option></arg> <arg><option>--exec-delay=</option></arg> + <arg><option>--event-timeout=</option></arg> <arg><option>--resolve-names=early|late|never</option></arg> <arg><option>--version</option></arg> <arg><option>--help</option></arg> @@ -96,6 +97,15 @@ </varlistentry> <varlistentry> + <term><option>--event-timeout=</option></term> + <listitem> + <para>Wait for the event to finish up to the given + number of seconds. After this time the event will + be terminated. Default is 30.</para> + </listitem> + </varlistentry> + + <varlistentry> <term><option>--resolve-names=</option></term> <listitem> <para>Specify when systemd-udevd should resolve names of users and groups. @@ -156,6 +166,15 @@ </listitem> </varlistentry> <varlistentry> + <term><varname>udev.event-timeout=</varname></term> + <term><varname>rd.udev.event-timeout=</varname></term> + <listitem> + <para>Wait for events to finish up to the given number + of seconds. This option might be useful if events are + terminated due to a timeout in large configurations.</para> + </listitem> + </varlistentry> + <varlistentry> <term><varname>net.ifnames=</varname></term> <listitem> <para>Network interfaces are renamed to give them predictable names diff --git src/udev/udevd.c src/udev/udevd.c index db935d6..c5dd739 100644 --- src/udev/udevd.c +++ src/udev/udevd.c @@ -74,6 +74,7 @@ static bool reload; static int children; static int children_max; static int exec_delay; +static int event_timeout = 30; static sigset_t sigmask_orig; static UDEV_LIST(event_list); static UDEV_LIST(worker_list); @@ -312,6 +313,9 @@ static void worker_new(struct event *event) } } + if (event_timeout != 30) + udev_event->timeout_usec = event_timeout * USEC_PER_SEC; + /* apply rules, create node, symlinks */ udev_event_execute_rules(udev_event, rules, &sigmask_orig); @@ -1009,6 +1013,8 @@ static void kernel_cmdline_options(struct udev *udev) children_max = strtoul(opt + 18, NULL, 0); } else if (startswith(opt, "udev.exec-delay=")) { exec_delay = strtoul(opt + 16, NULL, 0); + } else if (startswith(opt, "udev.event-timeout=")) { + event_timeout = strtoul(opt + 16, NULL, 0); } free(s); @@ -1026,6 +1032,7 @@ int main(int argc, char *argv[]) { "debug", no_argument, NULL, 'D' }, { "children-max", required_argument, NULL, 'c' }, { "exec-delay", required_argument, NULL, 'e' }, + { "event-timeout", required_argument, NULL, 't' }, { "resolve-names", required_argument, NULL, 'N' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, @@ -1069,6 +1076,9 @@ int main(int argc, char *argv[]) case 'e': exec_delay = strtoul(optarg, NULL, 0); break; + case 't': + event_timeout = strtoul(optarg, NULL, 0); + break; case 'D': debug = true; log_set_max_level(LOG_DEBUG); @@ -1406,7 +1416,7 @@ int main(int argc, char *argv[]) if (worker->state != WORKER_RUNNING) continue; - if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > 30 * USEC_PER_SEC) { + if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > event_timeout * USEC_PER_SEC) { log_error("worker [%u] %s timeout; kill it", worker->pid, worker->event ? worker->event->devpath : "<idle>"); kill(worker->pid, SIGKILL); -- 1.7.9.2 ++++++ 1057-udev-unify-event-timeout-handling.patch ++++++
From dd5eddd28a74a49607a8fffcaf960040dba98479 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Tue, 29 Jul 2014 15:18:27 +0200 Subject: [PATCH] udev: unify event timeout handling
--- man/systemd-udevd.service.xml | 7 +++--- man/udev.xml | 7 ------ src/test/test-udev.c | 5 ++-- src/udev/udev-event.c | 53 ++++++++++++++++++++++------------------- src/udev/udev-rules.c | 38 ++++++++--------------------- src/udev/udev.h | 8 +++---- src/udev/udevadm-test.c | 2 +- src/udev/udevd.c | 32 ++++++++++--------------- 8 files changed, 61 insertions(+), 91 deletions(-) diff --git man/systemd-udevd.service.xml man/systemd-udevd.service.xml index 8de43b1..3053dc7 100644 --- man/systemd-udevd.service.xml +++ man/systemd-udevd.service.xml @@ -99,9 +99,8 @@ <varlistentry> <term><option>--event-timeout=</option></term> <listitem> - <para>Wait for the event to finish up to the given - number of seconds. After this time the event will - be terminated. Default is 30.</para> + <para>Set the number of seconds to wait for events to finish. After + this time the event will be terminated. The default is 30 seconds.</para> </listitem> </varlistentry> @@ -171,7 +170,7 @@ <listitem> <para>Wait for events to finish up to the given number of seconds. This option might be useful if events are - terminated due to a timeout in large configurations.</para> + terminated due to kernel drivers taking too long to initialize.</para> </listitem> </varlistentry> <varlistentry> diff --git man/udev.xml man/udev.xml index 4e5f8f0..123c073 100644 --- man/udev.xml +++ man/udev.xml @@ -516,13 +516,6 @@ </listitem> </varlistentry> <varlistentry> - <term><option>event_timeout=</option></term> - <listitem> - <para>Number of seconds an event waits for operations to finish before - giving up and terminating itself.</para> - </listitem> - </varlistentry> - <varlistentry> <term><option>string_escape=<replaceable>none|replace</replaceable></option></term> <listitem> <para>Usually control and other possibly unsafe characters are replaced diff --git src/test/test-udev.c src/test/test-udev.c index b057cc8..26d6537 100644 --- src/test/test-udev.c +++ src/test/test-udev.c @@ -80,7 +80,6 @@ out: return err; } - int main(int argc, char *argv[]) { _cleanup_udev_unref_ struct udev *udev = NULL; _cleanup_udev_event_unref_ struct udev_event *event = NULL; @@ -155,8 +154,8 @@ int main(int argc, char *argv[]) { } } - udev_event_execute_rules(event, rules, &sigmask_orig); - udev_event_execute_run(event, NULL); + udev_event_execute_rules(event, USEC_PER_SEC, rules, &sigmask_orig); + udev_event_execute_run(event, USEC_PER_SEC, NULL); out: if (event != NULL && event->fd_signal >= 0) close(event->fd_signal); diff --git src/udev/udev-event.c src/udev/udev-event.c index 5213a4a..6ad80d5 100644 --- src/udev/udev-event.c +++ src/udev/udev-event.c @@ -48,7 +48,6 @@ struct udev_event *udev_event_new(struct udev_device *dev) udev_list_init(udev, &event->seclabel_list, false); event->fd_signal = -1; event->birth_usec = now(CLOCK_MONOTONIC); - event->timeout_usec = 30 * 1000 * 1000; return event; } @@ -422,9 +421,10 @@ static int spawn_exec(struct udev_event *event, } static void spawn_read(struct udev_event *event, - const char *cmd, - int fd_stdout, int fd_stderr, - char *result, size_t ressize) + usec_t timeout_usec, + const char *cmd, + int fd_stdout, int fd_stderr, + char *result, size_t ressize) { size_t respos = 0; int fd_ep = -1; @@ -467,15 +467,15 @@ static void spawn_read(struct udev_event *event, struct epoll_event ev[4]; int i; - if (event->timeout_usec > 0) { + if (timeout_usec > 0) { usec_t age_usec; age_usec = now(CLOCK_MONOTONIC) - event->birth_usec; - if (age_usec >= event->timeout_usec) { + if (age_usec >= timeout_usec) { log_error("timeout '%s'", cmd); goto out; } - timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + timeout = ((timeout_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC; } else { timeout = -1; } @@ -543,8 +543,9 @@ out: close(fd_ep); } -static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) -{ +static int spawn_wait(struct udev_event *event, + usec_t timeout_usec, + const char *cmd, pid_t pid) { struct pollfd pfd[1]; int err = 0; @@ -555,14 +556,14 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) int timeout; int fdcount; - if (event->timeout_usec > 0) { + if (timeout_usec > 0) { usec_t age_usec; age_usec = now(CLOCK_MONOTONIC) - event->birth_usec; - if (age_usec >= event->timeout_usec) + if (age_usec >= timeout_usec) timeout = 1000; else - timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + timeout = ((timeout_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC; } else { timeout = -1; } @@ -657,9 +658,9 @@ out: } int udev_event_spawn(struct udev_event *event, + usec_t timeout_usec, const char *cmd, char **envp, const sigset_t *sigmask, - char *result, size_t ressize) -{ + char *result, size_t ressize) { struct udev *udev = event->udev; int outpipe[2] = {-1, -1}; int errpipe[2] = {-1, -1}; @@ -728,11 +729,13 @@ int udev_event_spawn(struct udev_event *event, errpipe[WRITE_END] = -1; } - spawn_read(event, cmd, - outpipe[READ_END], errpipe[READ_END], - result, ressize); + spawn_read(event, + timeout_usec, + cmd, + outpipe[READ_END], errpipe[READ_END], + result, ressize); - err = spawn_wait(event, cmd, pid); + err = spawn_wait(event, timeout_usec, cmd, pid); } out: @@ -776,8 +779,9 @@ static int rename_netif(struct udev_event *event) return r; } -void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask) -{ +void udev_event_execute_rules(struct udev_event *event, + usec_t timeout_usec, + struct udev_rules *rules, const sigset_t *sigmask) { struct udev_device *dev = event->dev; if (udev_device_get_subsystem(dev) == NULL) @@ -791,7 +795,7 @@ void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules if (major(udev_device_get_devnum(dev)) != 0) udev_watch_end(event->udev, dev); - udev_rules_apply_to_event(rules, event, sigmask); + udev_rules_apply_to_event(rules, event, timeout_usec, sigmask); if (major(udev_device_get_devnum(dev)) != 0) udev_node_remove(dev); @@ -808,7 +812,7 @@ void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules udev_watch_end(event->udev, event->dev_db); } - udev_rules_apply_to_event(rules, event, sigmask); + udev_rules_apply_to_event(rules, event, timeout_usec, sigmask); /* rename a new network interface, if needed */ if (udev_device_get_ifindex(dev) > 0 && streq(udev_device_get_action(dev), "add") && @@ -883,8 +887,7 @@ void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules } } -void udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) -{ +void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const sigset_t *sigmask) { struct udev_list_entry *list_entry; udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { @@ -907,7 +910,7 @@ void udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) udev_event_apply_format(event, cmd, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); - udev_event_spawn(event, program, envp, sigmask, NULL, 0); + udev_event_spawn(event, timeout_usec, program, envp, sigmask, NULL, 0); } } } diff --git src/udev/udev-rules.c src/udev/udev-rules.c index 9864016..aacde38 100644 --- src/udev/udev-rules.c +++ src/udev/udev-rules.c @@ -137,7 +137,6 @@ enum token_type { TK_M_PARENTS_MAX, TK_M_TEST, /* val, mode_t */ - TK_M_EVENT_TIMEOUT, /* int */ TK_M_PROGRAM, /* val */ TK_M_IMPORT_FILE, /* val */ TK_M_IMPORT_PROG, /* val */ @@ -201,7 +200,6 @@ struct token { uid_t uid; gid_t gid; int devlink_prio; - int event_timeout; int watch; enum udev_builtin_cmd builtin_cmd; }; @@ -275,7 +273,6 @@ static const char *token_str(enum token_type type) [TK_M_PARENTS_MAX] = "M PARENTS_MAX", [TK_M_TEST] = "M TEST", - [TK_M_EVENT_TIMEOUT] = "M EVENT_TIMEOUT", [TK_M_PROGRAM] = "M PROGRAM", [TK_M_IMPORT_FILE] = "M IMPORT_FILE", [TK_M_IMPORT_PROG] = "M IMPORT_PROG", @@ -409,9 +406,6 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_A_SECLABEL: log_debug("%s %s '%s' '%s'", token_str(type), operation_str(op), attr, value); break; - case TK_M_EVENT_TIMEOUT: - log_debug("%s %u", token_str(type), token->key.event_timeout); - break; case TK_A_GOTO: log_debug("%s '%s' %u", token_str(type), value, token->key.rule_goto); break; @@ -627,8 +621,9 @@ static int import_file_into_properties(struct udev_device *dev, const char *file return 0; } -static int import_program_into_properties(struct udev_event *event, const char *program, const sigset_t *sigmask) -{ +static int import_program_into_properties(struct udev_event *event, + usec_t timeout_usec, + const char *program, const sigset_t *sigmask) { struct udev_device *dev = event->dev; char **envp; char result[UTIL_LINE_SIZE]; @@ -636,7 +631,7 @@ static int import_program_into_properties(struct udev_event *event, const char * int err; envp = udev_device_get_properties_envp(dev); - err = udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)); + err = udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result)); if (err < 0) return err; @@ -942,9 +937,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_A_MODE_ID: token->key.mode = *(mode_t *)data; break; - case TK_M_EVENT_TIMEOUT: - token->key.event_timeout = *(int *)data; - break; case TK_RULE: case TK_M_PARENTS_MIN: case TK_M_PARENTS_MAX: @@ -1462,14 +1454,6 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, op, NULL, &prio); } - pos = strstr(value, "event_timeout="); - if (pos != NULL) { - int tout = atoi(&pos[strlen("event_timeout=")]); - - rule_add_key(&rule_tmp, TK_M_EVENT_TIMEOUT, op, NULL, &tout); - } - - pos = strstr(value, "string_escape="); if (pos != NULL) { pos = &pos[strlen("string_escape=")]; if (startswith(pos, "none")) @@ -1829,8 +1813,10 @@ enum escape_type { ESCAPE_REPLACE, }; -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask) -{ +int udev_rules_apply_to_event(struct udev_rules *rules, + struct udev_event *event, + usec_t timeout_usec, + const sigset_t *sigmask) { struct token *cur; struct token *rule; enum escape_type esc = ESCAPE_UNSET; @@ -2024,10 +2010,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event goto nomatch; break; } - case TK_M_EVENT_TIMEOUT: - log_debug("OPTIONS event_timeout=%u", cur->key.event_timeout); - event->timeout_usec = cur->key.event_timeout * 1000 * 1000; - break; case TK_M_PROGRAM: { char program[UTIL_PATH_SIZE]; char **envp; @@ -2042,7 +2024,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event rules_str(rules, rule->rule.filename_off), rule->rule.filename_line); - if (udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)) < 0) { + if (udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result)) < 0) { if (cur->key.op != OP_NOMATCH) goto nomatch; } else { @@ -2078,7 +2060,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event rules_str(rules, rule->rule.filename_off), rule->rule.filename_line); - if (import_program_into_properties(event, import, sigmask) != 0) + if (import_program_into_properties(event, timeout_usec, import, sigmask) != 0) if (cur->key.op != OP_NOMATCH) goto nomatch; break; diff --git src/udev/udev.h src/udev/udev.h index 62538bc..4aca70b 100644 --- src/udev/udev.h +++ src/udev/udev.h @@ -43,7 +43,6 @@ struct udev_event { struct udev_list run_list; int exec_delay; usec_t birth_usec; - usec_t timeout_usec; int fd_signal; unsigned int builtin_run; unsigned int builtin_ret; @@ -72,7 +71,7 @@ struct udev_rules; struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); struct udev_rules *udev_rules_unref(struct udev_rules *rules); bool udev_rules_check_timestamp(struct udev_rules *rules); -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask); +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, usec_t timeout_usec, const sigset_t *sigmask); int udev_rules_apply_static_dev_perms(struct udev_rules *rules); /* udev-event.c */ @@ -82,10 +81,11 @@ size_t udev_event_apply_format(struct udev_event *event, const char *src, char * int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, char *result, size_t maxsize, int read_value); int udev_event_spawn(struct udev_event *event, + usec_t timeout_usec, const char *cmd, char **envp, const sigset_t *sigmask, char *result, size_t ressize); -void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); -void udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); +void udev_event_execute_rules(struct udev_event *event, usec_t timeout_usec, struct udev_rules *rules, const sigset_t *sigset); +void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const sigset_t *sigset); int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]); /* udev-watch.c */ diff --git src/udev/udevadm-test.c src/udev/udevadm-test.c index 6a2f548..52cc26c 100644 --- src/udev/udevadm-test.c +++ src/udev/udevadm-test.c @@ -138,7 +138,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) goto out; } - udev_event_execute_rules(event, rules, &sigmask_orig); + udev_event_execute_rules(event, 30 * USEC_PER_SEC, rules, &sigmask_orig); udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); diff --git src/udev/udevd.c src/udev/udevd.c index c5dd739..dee7a87 100644 --- src/udev/udevd.c +++ src/udev/udevd.c @@ -74,7 +74,7 @@ static bool reload; static int children; static int children_max; static int exec_delay; -static int event_timeout = 30; +static usec_t event_timeout_usec = 30 * USEC_PER_SEC; static sigset_t sigmask_orig; static UDEV_LIST(event_list); static UDEV_LIST(worker_list); @@ -313,13 +313,10 @@ static void worker_new(struct event *event) } } - if (event_timeout != 30) - udev_event->timeout_usec = event_timeout * USEC_PER_SEC; - /* apply rules, create node, symlinks */ - udev_event_execute_rules(udev_event, rules, &sigmask_orig); + udev_event_execute_rules(udev_event, event_timeout_usec, rules, &sigmask_orig); - udev_event_execute_run(udev_event, &sigmask_orig); + udev_event_execute_run(udev_event, event_timeout_usec, &sigmask_orig); /* apply/restore inotify watch */ if (udev_event->inotify_watch) { @@ -1014,15 +1011,14 @@ static void kernel_cmdline_options(struct udev *udev) } else if (startswith(opt, "udev.exec-delay=")) { exec_delay = strtoul(opt + 16, NULL, 0); } else if (startswith(opt, "udev.event-timeout=")) { - event_timeout = strtoul(opt + 16, NULL, 0); + event_timeout_usec = strtoul(opt + 16, NULL, 0) * USEC_PER_SEC; } free(s); } } -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { struct udev *udev; sigset_t mask; int daemonize = false; @@ -1077,7 +1073,7 @@ int main(int argc, char *argv[]) exec_delay = strtoul(optarg, NULL, 0); break; case 't': - event_timeout = strtoul(optarg, NULL, 0); + event_timeout_usec = strtoul(optarg, NULL, 0) * USEC_PER_SEC; break; case 'D': debug = true; @@ -1103,6 +1099,7 @@ int main(int argc, char *argv[]) " --debug\n" " --children-max=<maximum number of workers>\n" " --exec-delay=<seconds to wait before executing RUN=>\n" + " --event-timeout=<seconds to wait before terminating an event>\n" " --resolve-names=early|late|never\n" " --version\n" " --help\n" @@ -1416,20 +1413,17 @@ int main(int argc, char *argv[]) if (worker->state != WORKER_RUNNING) continue; - if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > event_timeout * USEC_PER_SEC) { - log_error("worker [%u] %s timeout; kill it", worker->pid, - worker->event ? worker->event->devpath : "<idle>"); + if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > event_timeout_usec) { + log_error("worker [%u] %s timeout; kill it", worker->pid, worker->event->devpath); kill(worker->pid, SIGKILL); worker->state = WORKER_KILLED; /* drop reference taken for state 'running' */ worker_unref(worker); - if (worker->event) { - log_error("seq %llu '%s' killed", udev_device_get_seqnum(worker->event->dev), worker->event->devpath); - worker->event->exitcode = -64; - event_queue_delete(worker->event); - worker->event = NULL; - } + log_error("seq %llu '%s' killed", udev_device_get_seqnum(worker->event->dev), worker->event->devpath); + worker->event->exitcode = -64; + event_queue_delete(worker->event); + worker->event = NULL; } } -- 1.7.9.2 ++++++ 1058-udev-unify-event-timeout-handling.patch ++++++ Based on dd5eddd28a74a49607a8fffcaf960040dba98479 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Tue, 29 Jul 2014 15:18:27 +0200 Subject: [PATCH] udev: unify event timeout handling --- man/systemd-udevd.service.xml | 7 +++--- man/udev.xml | 7 ------ src/test/test-udev.c | 5 ++-- src/udev/udev-event.c | 53 ++++++++++++++++++++++------------------- src/udev/udev-rules.c | 38 ++++++++--------------------- src/udev/udev.h | 8 +++---- src/udev/udevadm-test.c | 2 +- src/udev/udevd.c | 32 ++++++++++--------------- 8 files changed, 61 insertions(+), 91 deletions(-) diff --git man/systemd-udevd.service.xml man/systemd-udevd.service.xml index 8de43b1..3053dc7 100644 --- man/systemd-udevd.service.xml +++ man/systemd-udevd.service.xml @@ -99,9 +99,8 @@ <varlistentry> <term><option>--event-timeout=</option></term> <listitem> - <para>Wait for the event to finish up to the given - number of seconds. After this time the event will - be terminated. Default is 30.</para> + <para>Set the number of seconds to wait for events to finish. After + this time the event will be terminated. The default is 30 seconds.</para> </listitem> </varlistentry> @@ -171,7 +170,7 @@ <listitem> <para>Wait for events to finish up to the given number of seconds. This option might be useful if events are - terminated due to a timeout in large configurations.</para> + terminated due to kernel drivers taking too long to initialize.</para> </listitem> </varlistentry> <varlistentry> diff --git man/udev.xml man/udev.xml index 4e5f8f0..123c073 100644 --- man/udev.xml +++ man/udev.xml @@ -516,13 +516,6 @@ </listitem> </varlistentry> <varlistentry> - <term><option>event_timeout=</option></term> - <listitem> - <para>Number of seconds an event waits for operations to finish before - giving up and terminating itself.</para> - </listitem> - </varlistentry> - <varlistentry> <term><option>string_escape=<replaceable>none|replace</replaceable></option></term> <listitem> <para>Usually control and other possibly unsafe characters are replaced diff --git src/test/test-udev.c src/test/test-udev.c index b057cc8..26d6537 100644 --- src/test/test-udev.c +++ src/test/test-udev.c @@ -80,7 +80,6 @@ out: return err; } - int main(int argc, char *argv[]) { _cleanup_udev_unref_ struct udev *udev = NULL; _cleanup_udev_event_unref_ struct udev_event *event = NULL; @@ -155,8 +154,8 @@ int main(int argc, char *argv[]) { } } - udev_event_execute_rules(event, rules, &sigmask_orig); - udev_event_execute_run(event, NULL); + udev_event_execute_rules(event, USEC_PER_SEC, rules, &sigmask_orig); + udev_event_execute_run(event, USEC_PER_SEC, NULL); out: if (event != NULL && event->fd_signal >= 0) close(event->fd_signal); diff --git src/udev/udev-event.c src/udev/udev-event.c index 5213a4a..6ad80d5 100644 --- src/udev/udev-event.c +++ src/udev/udev-event.c @@ -48,7 +48,6 @@ struct udev_event *udev_event_new(struct udev_device *dev) udev_list_init(udev, &event->seclabel_list, false); event->fd_signal = -1; event->birth_usec = now(CLOCK_MONOTONIC); - event->timeout_usec = 30 * 1000 * 1000; return event; } @@ -422,9 +421,10 @@ static int spawn_exec(struct udev_event *event, } static void spawn_read(struct udev_event *event, - const char *cmd, - int fd_stdout, int fd_stderr, - char *result, size_t ressize) + usec_t timeout_usec, + const char *cmd, + int fd_stdout, int fd_stderr, + char *result, size_t ressize) { size_t respos = 0; int fd_ep = -1; @@ -467,15 +467,15 @@ static void spawn_read(struct udev_event *event, struct epoll_event ev[4]; int i; - if (event->timeout_usec > 0) { + if (timeout_usec > 0) { usec_t age_usec; age_usec = now(CLOCK_MONOTONIC) - event->birth_usec; - if (age_usec >= event->timeout_usec) { + if (age_usec >= timeout_usec) { log_error("timeout '%s'", cmd); goto out; } - timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + timeout = ((timeout_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC; } else { timeout = -1; } @@ -543,8 +543,9 @@ out: close(fd_ep); } -static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) -{ +static int spawn_wait(struct udev_event *event, + usec_t timeout_usec, + const char *cmd, pid_t pid) { struct pollfd pfd[1]; int err = 0; @@ -555,14 +556,14 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) int timeout; int fdcount; - if (event->timeout_usec > 0) { + if (timeout_usec > 0) { usec_t age_usec; age_usec = now(CLOCK_MONOTONIC) - event->birth_usec; - if (age_usec >= event->timeout_usec) + if (age_usec >= timeout_usec) timeout = 1000; else - timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + timeout = ((timeout_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC; } else { timeout = -1; } @@ -657,9 +658,9 @@ out: } int udev_event_spawn(struct udev_event *event, + usec_t timeout_usec, const char *cmd, char **envp, const sigset_t *sigmask, - char *result, size_t ressize) -{ + char *result, size_t ressize) { struct udev *udev = event->udev; int outpipe[2] = {-1, -1}; int errpipe[2] = {-1, -1}; @@ -728,11 +729,13 @@ int udev_event_spawn(struct udev_event *event, errpipe[WRITE_END] = -1; } - spawn_read(event, cmd, - outpipe[READ_END], errpipe[READ_END], - result, ressize); + spawn_read(event, + timeout_usec, + cmd, + outpipe[READ_END], errpipe[READ_END], + result, ressize); - err = spawn_wait(event, cmd, pid); + err = spawn_wait(event, timeout_usec, cmd, pid); } out: @@ -776,8 +779,9 @@ static int rename_netif(struct udev_event *event) return r; } -void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask) -{ +void udev_event_execute_rules(struct udev_event *event, + usec_t timeout_usec, + struct udev_rules *rules, const sigset_t *sigmask) { struct udev_device *dev = event->dev; if (udev_device_get_subsystem(dev) == NULL) @@ -791,7 +795,7 @@ void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules if (major(udev_device_get_devnum(dev)) != 0) udev_watch_end(event->udev, dev); - udev_rules_apply_to_event(rules, event, sigmask); + udev_rules_apply_to_event(rules, event, timeout_usec, sigmask); if (major(udev_device_get_devnum(dev)) != 0) udev_node_remove(dev); @@ -808,7 +812,7 @@ void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules udev_watch_end(event->udev, event->dev_db); } - udev_rules_apply_to_event(rules, event, sigmask); + udev_rules_apply_to_event(rules, event, timeout_usec, sigmask); /* rename a new network interface, if needed */ if (udev_device_get_ifindex(dev) > 0 && streq(udev_device_get_action(dev), "add") && @@ -883,8 +887,7 @@ void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules } } -void udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) -{ +void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const sigset_t *sigmask) { struct udev_list_entry *list_entry; udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { @@ -907,7 +910,7 @@ void udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) udev_event_apply_format(event, cmd, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); - udev_event_spawn(event, program, envp, sigmask, NULL, 0); + udev_event_spawn(event, timeout_usec, program, envp, sigmask, NULL, 0); } } } diff --git src/udev/udev-rules.c src/udev/udev-rules.c index 9864016..aacde38 100644 --- src/udev/udev-rules.c +++ src/udev/udev-rules.c @@ -137,7 +137,6 @@ enum token_type { TK_M_PARENTS_MAX, TK_M_TEST, /* val, mode_t */ - TK_M_EVENT_TIMEOUT, /* int */ TK_M_PROGRAM, /* val */ TK_M_IMPORT_FILE, /* val */ TK_M_IMPORT_PROG, /* val */ @@ -201,7 +200,6 @@ struct token { uid_t uid; gid_t gid; int devlink_prio; - int event_timeout; int watch; enum udev_builtin_cmd builtin_cmd; }; @@ -275,7 +273,6 @@ static const char *token_str(enum token_type type) [TK_M_PARENTS_MAX] = "M PARENTS_MAX", [TK_M_TEST] = "M TEST", - [TK_M_EVENT_TIMEOUT] = "M EVENT_TIMEOUT", [TK_M_PROGRAM] = "M PROGRAM", [TK_M_IMPORT_FILE] = "M IMPORT_FILE", [TK_M_IMPORT_PROG] = "M IMPORT_PROG", @@ -409,9 +406,6 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_A_SECLABEL: log_debug("%s %s '%s' '%s'", token_str(type), operation_str(op), attr, value); break; - case TK_M_EVENT_TIMEOUT: - log_debug("%s %u", token_str(type), token->key.event_timeout); - break; case TK_A_GOTO: log_debug("%s '%s' %u", token_str(type), value, token->key.rule_goto); break; @@ -627,8 +621,9 @@ static int import_file_into_properties(struct udev_device *dev, const char *file return 0; } -static int import_program_into_properties(struct udev_event *event, const char *program, const sigset_t *sigmask) -{ +static int import_program_into_properties(struct udev_event *event, + usec_t timeout_usec, + const char *program, const sigset_t *sigmask) { struct udev_device *dev = event->dev; char **envp; char result[UTIL_LINE_SIZE]; @@ -636,7 +631,7 @@ static int import_program_into_properties(struct udev_event *event, const char * int err; envp = udev_device_get_properties_envp(dev); - err = udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)); + err = udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result)); if (err < 0) return err; @@ -942,9 +937,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_A_MODE_ID: token->key.mode = *(mode_t *)data; break; - case TK_M_EVENT_TIMEOUT: - token->key.event_timeout = *(int *)data; - break; case TK_RULE: case TK_M_PARENTS_MIN: case TK_M_PARENTS_MAX: @@ -1462,14 +1454,6 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, op, NULL, &prio); } - pos = strstr(value, "event_timeout="); - if (pos != NULL) { - int tout = atoi(&pos[strlen("event_timeout=")]); - - rule_add_key(&rule_tmp, TK_M_EVENT_TIMEOUT, op, NULL, &tout); - } - - pos = strstr(value, "string_escape="); if (pos != NULL) { pos = &pos[strlen("string_escape=")]; if (startswith(pos, "none")) @@ -1829,8 +1813,10 @@ enum escape_type { ESCAPE_REPLACE, }; -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask) -{ +int udev_rules_apply_to_event(struct udev_rules *rules, + struct udev_event *event, + usec_t timeout_usec, + const sigset_t *sigmask) { struct token *cur; struct token *rule; enum escape_type esc = ESCAPE_UNSET; @@ -2024,10 +2010,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event goto nomatch; break; } - case TK_M_EVENT_TIMEOUT: - log_debug("OPTIONS event_timeout=%u", cur->key.event_timeout); - event->timeout_usec = cur->key.event_timeout * 1000 * 1000; - break; case TK_M_PROGRAM: { char program[UTIL_PATH_SIZE]; char **envp; @@ -2042,7 +2024,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event rules_str(rules, rule->rule.filename_off), rule->rule.filename_line); - if (udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)) < 0) { + if (udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result)) < 0) { if (cur->key.op != OP_NOMATCH) goto nomatch; } else { @@ -2078,7 +2060,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event rules_str(rules, rule->rule.filename_off), rule->rule.filename_line); - if (import_program_into_properties(event, import, sigmask) != 0) + if (import_program_into_properties(event, timeout_usec, import, sigmask) != 0) if (cur->key.op != OP_NOMATCH) goto nomatch; break; diff --git src/udev/udev.h src/udev/udev.h index 62538bc..4aca70b 100644 --- src/udev/udev.h +++ src/udev/udev.h @@ -43,7 +43,6 @@ struct udev_event { struct udev_list run_list; int exec_delay; usec_t birth_usec; - usec_t timeout_usec; int fd_signal; unsigned int builtin_run; unsigned int builtin_ret; @@ -72,7 +71,7 @@ struct udev_rules; struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); struct udev_rules *udev_rules_unref(struct udev_rules *rules); bool udev_rules_check_timestamp(struct udev_rules *rules); -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask); +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, usec_t timeout_usec, const sigset_t *sigmask); int udev_rules_apply_static_dev_perms(struct udev_rules *rules); /* udev-event.c */ @@ -82,10 +81,11 @@ size_t udev_event_apply_format(struct udev_event *event, const char *src, char * int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, char *result, size_t maxsize, int read_value); int udev_event_spawn(struct udev_event *event, + usec_t timeout_usec, const char *cmd, char **envp, const sigset_t *sigmask, char *result, size_t ressize); -void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); -void udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); +void udev_event_execute_rules(struct udev_event *event, usec_t timeout_usec, struct udev_rules *rules, const sigset_t *sigset); +void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const sigset_t *sigset); int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]); /* udev-watch.c */ diff --git src/udev/udevadm-test.c src/udev/udevadm-test.c index 6a2f548..52cc26c 100644 --- src/udev/udevadm-test.c +++ src/udev/udevadm-test.c @@ -138,7 +138,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) goto out; } - udev_event_execute_rules(event, rules, &sigmask_orig); + udev_event_execute_rules(event, 30 * USEC_PER_SEC, rules, &sigmask_orig); udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); diff --git src/udev/udevd.c src/udev/udevd.c index c5dd739..dee7a87 100644 --- src/udev/udevd.c +++ src/udev/udevd.c @@ -74,7 +74,7 @@ static bool reload; static int children; static int children_max; static int exec_delay; -static int event_timeout = 30; +static usec_t event_timeout_usec = 30 * USEC_PER_SEC; static sigset_t sigmask_orig; static UDEV_LIST(event_list); static UDEV_LIST(worker_list); @@ -313,13 +313,10 @@ static void worker_new(struct event *event) } } - if (event_timeout != 30) - udev_event->timeout_usec = event_timeout * USEC_PER_SEC; - /* apply rules, create node, symlinks */ - udev_event_execute_rules(udev_event, rules, &sigmask_orig); + udev_event_execute_rules(udev_event, event_timeout_usec, rules, &sigmask_orig); - udev_event_execute_run(udev_event, &sigmask_orig); + udev_event_execute_run(udev_event, event_timeout_usec, &sigmask_orig); /* apply/restore inotify watch */ if (udev_event->inotify_watch) { @@ -1014,15 +1011,14 @@ static void kernel_cmdline_options(struct udev *udev) } else if (startswith(opt, "udev.exec-delay=")) { exec_delay = strtoul(opt + 16, NULL, 0); } else if (startswith(opt, "udev.event-timeout=")) { - event_timeout = strtoul(opt + 16, NULL, 0); + event_timeout_usec = strtoul(opt + 16, NULL, 0) * USEC_PER_SEC; } free(s); } } -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { struct udev *udev; sigset_t mask; int daemonize = false; @@ -1077,7 +1073,7 @@ int main(int argc, char *argv[]) exec_delay = strtoul(optarg, NULL, 0); break; case 't': - event_timeout = strtoul(optarg, NULL, 0); + event_timeout_usec = strtoul(optarg, NULL, 0) * USEC_PER_SEC; break; case 'D': debug = true; @@ -1103,6 +1099,7 @@ int main(int argc, char *argv[]) " --debug\n" " --children-max=<maximum number of workers>\n" " --exec-delay=<seconds to wait before executing RUN=>\n" + " --event-timeout=<seconds to wait before terminating an event>\n" " --resolve-names=early|late|never\n" " --version\n" " --help\n" @@ -1416,20 +1413,17 @@ int main(int argc, char *argv[]) if (worker->state != WORKER_RUNNING) continue; - if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > event_timeout * USEC_PER_SEC) { - log_error("worker [%u] %s timeout; kill it", worker->pid, - worker->event ? worker->event->devpath : "<idle>"); + if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > event_timeout_usec) { + log_error("worker [%u] %s timeout; kill it", worker->pid, worker->event->devpath); kill(worker->pid, SIGKILL); worker->state = WORKER_KILLED; /* drop reference taken for state 'running' */ worker_unref(worker); - if (worker->event) { - log_error("seq %llu '%s' killed", udev_device_get_seqnum(worker->event->dev), worker->event->devpath); - worker->event->exitcode = -64; - event_queue_delete(worker->event, true); - worker->event = NULL; - } + log_error("seq %llu '%s' killed", udev_device_get_seqnum(worker->event->dev), worker->event->devpath); + worker->event->exitcode = -64; + event_queue_delete(worker->event, true); + worker->event = NULL; } } -- 1.7.9.2 ++++++ 1059-udev-fixup-commit-dd5eddd28a74a49607a8fffcaf960040db.patch ++++++
From 9f20a8a376f924c8eb5423cfc1f98644fc1e2d1a Mon Sep 17 00:00:00 2001 From: Hannes Reinecke <hare@suse.de> Date: Wed, 30 Jul 2014 10:10:46 +0200 Subject: [PATCH] udev: fixup commit dd5eddd28a74a49607a8fffcaf960040dba98479
Commit dd5eddd28a74a49607a8fffcaf960040dba98479 accidentally removed one line too many. --- src/udev/udev-rules.c | 1 + 1 file changed, 1 insertion(+) diff --git src/udev/udev-rules.c src/udev/udev-rules.c index 59bc124..cc56215 100644 --- src/udev/udev-rules.c +++ src/udev/udev-rules.c @@ -1436,6 +1436,7 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, op, NULL, &prio); } + pos = strstr(value, "string_escape="); if (pos != NULL) { pos = &pos[strlen("string_escape=")]; if (startswith(pos, "none")) -- 1.7.9.2 ++++++ 1061-rules-allow-systemd-to-manage-loop-device-partitions.patch ++++++
From b5df2eabf3fdd3e1663bc4c948812472084f3e96 Mon Sep 17 00:00:00 2001 From: Kevin Wells <wellsie1116@gmail.com> Date: Thu, 31 Jul 2014 17:38:21 +0200 Subject: [PATCH] rules: allow systemd to manage loop device partitions
SYSTEMD_READY is currently set to 0 for all loop devices (loop[0-9]*) that do not have a backing_file. Partitioned loop devices (ex. loop0p1), however, are matched by this rule and excluded by systemd even though they are active devices. This change adds an additional check to the rule, ensuring that only top level loop devices (loop[0-9]+$) are excluded from systemd. --- rules/99-systemd.rules.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git rules/99-systemd.rules.in rules/99-systemd.rules.in index c3ef81b..aa435c4 100644 --- rules/99-systemd.rules.in +++ rules/99-systemd.rules.in @@ -23,7 +23,7 @@ SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", TEST!="md/array_state", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0" # Ignore loop devices that don't have any file attached -SUBSYSTEM=="block", KERNEL=="loop[0-9]*", TEST!="loop/backing_file", ENV{SYSTEMD_READY}="0" +SUBSYSTEM=="block", KERNEL=="loop[0-9]*", ENV{DEVTYPE}=="disk", TEST!="loop/backing_file", ENV{SYSTEMD_READY}="0" # Ignore nbd devices in the "add" event, with "change" the nbd is ready ACTION=="add", SUBSYSTEM=="block", KERNEL=="nbd*", ENV{SYSTEMD_READY}="0" -- 1.7.9.2 ++++++ 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch ++++++ Based on e98bbfd2074e2b1079b7059341eac25741baf319 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Mon, 4 Aug 2014 18:15:34 +0200 Subject: [PATCH] udev: path_id - suppress ID_PATH for devices with an unknown parent device type https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1321816 --- src/udev/udev-builtin-path_id.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) --- src/udev/udev-builtin-path_id.c +++ src/udev/udev-builtin-path_id.c 2014-08-22 14:08:59.250235369 +0000 @@ -524,7 +524,8 @@ static int builtin_path_id(struct udev_d { struct udev_device *parent; char *path = NULL; - bool some_transport = false; + bool supported_transport = false; + bool supported_parent = false; /* S390 ccw bus */ parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL); @@ -545,47 +546,62 @@ static int builtin_path_id(struct udev_d handle_scsi_tape(parent, &path); } else if (streq(subsys, "scsi")) { parent = handle_scsi(parent, &path); - some_transport = true; + supported_transport = true; } else if (streq(subsys, "cciss")) { parent = handle_cciss(parent, &path); - some_transport = true; + supported_transport = true; } else if (streq(subsys, "usb")) { parent = handle_usb(parent, &path); - some_transport = true; + supported_transport = true; } else if (streq(subsys, "bcma")) { parent = handle_bcma(parent, &path); - some_transport = true; + supported_transport = true; } else if (streq(subsys, "serio")) { path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); parent = skip_subsystem(parent, "serio"); } else if (streq(subsys, "pci")) { path_prepend(&path, "pci-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "pci"); + supported_parent = true; } else if (streq(subsys, "platform")) { path_prepend(&path, "platform-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "platform"); - some_transport = true; + supported_transport = true; + supported_parent = true; } else if (streq(subsys, "acpi")) { path_prepend(&path, "acpi-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "acpi"); + supported_parent = true; } else if (streq(subsys, "xen")) { path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "xen"); + supported_parent = true; } else if (streq(subsys, "scm")) { path_prepend(&path, "scm-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "scm"); - some_transport = true; + supported_transport = true; + supported_parent = true; } parent = udev_device_get_parent(parent); } /* - * Do not return a single-parent-device-only for block - * devices, they might have entire buses behind it which - * do not get unique IDs only by using the parent device. + * Do return devices with have an unknown type of parent device, they + * might produce conflicting IDs below multiple independent parent + * devices. */ - if (!some_transport && streq(udev_device_get_subsystem(dev), "block")) { + if (!supported_parent) { + free(path); + path = NULL; + } + + /* + * Do not return a have-only a single-parent block devices, some + * have entire hidden buses behind it, and not create predictable + * IDs that way. + */ + if (streq(udev_device_get_subsystem(dev), "block") && !supported_transport) { free(path); path = NULL; } ++++++ 1064-udev-hwdb-do-not-look-at-usb_device-parents.patch ++++++
From 77cf759ea05bea476cdcb8d0dcd04c4e6fb3b2ff Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Tue, 26 Aug 2014 18:27:36 +0200 Subject: [PATCH] udev: hwdb - do not look at "usb_device" parents
Based on a patch from Simon McVittie <simon.mcvittie@collabora.co.uk>. Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758050 --- src/udev/udev-builtin-hwdb.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git src/udev/udev-builtin-hwdb.c src/udev/udev-builtin-hwdb.c index cac97e7..695a31a 100644 --- src/udev/udev-builtin-hwdb.c +++ src/udev/udev-builtin-hwdb.c @@ -88,9 +88,10 @@ static int udev_builtin_hwdb_search(struct udev_device *dev, struct udev_device const char *filter, bool test) { struct udev_device *d; char s[16]; - int n = 0; + bool last = false; + int r = 0; - for (d = srcdev; d; d = udev_device_get_parent(d)) { + for (d = srcdev; d && !last; d = udev_device_get_parent(d)) { const char *dsubsys; const char *modalias = NULL; @@ -104,19 +105,24 @@ static int udev_builtin_hwdb_search(struct udev_device *dev, struct udev_device modalias = udev_device_get_property_value(d, "MODALIAS"); - /* the usb_device does not have a modalias, compose one */ - if (!modalias && streq(dsubsys, "usb")) - modalias = modalias_usb(d, s, sizeof(s)); + if (streq(dsubsys, "usb") && streq_ptr(udev_device_get_devtype(d), "usb_device")) { + /* if the usb_device does not have a modalias, compose one */ + if (!modalias) + modalias = modalias_usb(d, s, sizeof(s)); + + /* avoid looking at any parent device, they are usually just a USB hub */ + last = true; + } if (!modalias) continue; - n = udev_builtin_hwdb_lookup(dev, prefix, modalias, filter, test); - if (n > 0) + r = udev_builtin_hwdb_lookup(dev, prefix, modalias, filter, test); + if (r > 0) break; } - return n; + return r; } static int builtin_hwdb(struct udev_device *dev, int argc, char *argv[], bool test) { -- 1.7.9.2 ++++++ 1065-udev-bump-event-timeout-to-60-seconds.patch ++++++
From 2e92633dbae52f5ac9b7b2e068935990d475d2cd Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Sat, 30 Aug 2014 11:36:32 +0200 Subject: [PATCH] udev: bump event timeout to 60 seconds
--- src/udev/udevadm-test.c | 2 +- src/udev/udevd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git src/udev/udevadm-test.c src/udev/udevadm-test.c index 8486049..809adb6 100644 --- src/udev/udevadm-test.c +++ src/udev/udevadm-test.c @@ -136,7 +136,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) { goto out; } - udev_event_execute_rules(event, 30 * USEC_PER_SEC, rules, &sigmask_orig); + udev_event_execute_rules(event, 60 * USEC_PER_SEC, rules, &sigmask_orig); udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); diff --git src/udev/udevd.c src/udev/udevd.c index 9c2b0d5..e72c5b2 100644 --- src/udev/udevd.c +++ src/udev/udevd.c @@ -73,7 +73,7 @@ static bool reload; static int children; static int children_max; static int exec_delay; -static usec_t event_timeout_usec = 30 * USEC_PER_SEC; +static usec_t event_timeout_usec = 60 * USEC_PER_SEC; static sigset_t sigmask_orig; static UDEV_LIST(event_list); static UDEV_LIST(worker_list); -- 1.7.9.2 ++++++ 1066-udev-add-compatibility-links-for-truncated-by-id-links.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:04.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:04.000000000 +0100 @@ -18,10 +18,8 @@ src/udev/scsi_id/scsi_serial.c | 19 +++++++++++++------ 4 files changed, 32 insertions(+), 7 deletions(-) -Index: systemd/rules/60-persistent-storage.rules -=================================================================== ---- systemd.orig/rules/60-persistent-storage.rules -+++ systemd/rules/60-persistent-storage.rules +--- a/rules/60-persistent-storage.rules ++++ b/rules/60-persistent-storage.rules @@ -46,6 +46,10 @@ KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="par KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d $devnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n" @@ -33,11 +31,9 @@ # firewire KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" -Index: systemd/src/udev/scsi_id/scsi_id.c -=================================================================== ---- systemd.orig/src/udev/scsi_id/scsi_id.c -+++ systemd/src/udev/scsi_id/scsi_id.c -@@ -43,6 +43,7 @@ static const struct option options[] = { +--- a/src/udev/scsi_id/scsi_id.c ++++ b/src/udev/scsi_id/scsi_id.c +@@ -44,6 +44,7 @@ static const struct option options[] = { { "replace-whitespace", no_argument, NULL, 'u' }, { "sg-version", required_argument, NULL, 's' }, { "verbose", no_argument, NULL, 'v' }, @@ -45,24 +41,24 @@ { "version", no_argument, NULL, 'V' }, /* don't advertise -V */ { "export", no_argument, NULL, 'x' }, { "help", no_argument, NULL, 'h' }, -@@ -54,6 +55,7 @@ static bool dev_specified = false; - static char config_file[MAX_PATH_LEN] = "/etc/scsi_id.config"; +@@ -56,6 +57,7 @@ static char config_file[MAX_PATH_LEN] = static enum page_code default_page_code = PAGE_UNSPECIFIED; static int sg_version = 4; + static int debug = 0; +static bool compat_truncated = false; static bool reformat_serial = false; static bool export = false; static char vendor_str[64]; -@@ -316,6 +318,7 @@ static void help(void) { - " -g --whitelisted Treat device as whitelisted\n" - " -u --replace-whitespace Replace all whitespace by underscores\n" - " -v --verbose Verbose logging\n" +@@ -323,6 +325,7 @@ static void help(void) { + " -g,--whitelisted threat device as whitelisted\n" + " -u,--replace-whitespace replace all whitespace by underscores\n" + " -v,--verbose verbose logging\n" + " --truncated-serial truncated serial for compatibility with systems configured with by-id links created by udev < 184\n" - " -x --export Print values as environment keys\n" - , program_invocation_short_name); - -@@ -387,6 +390,10 @@ static int set_options(struct udev *udev - log_open(); + " --version print version\n" + " -x,--export print values as environment keys\n" + " -h,--help print this help text\n\n"); +@@ -393,6 +396,10 @@ static int set_options(struct udev *udev + debug++; break; + case '9': @@ -72,7 +68,7 @@ case 'V': printf("%s\n", VERSION); exit(0); -@@ -528,6 +535,9 @@ static int scsi_id(struct udev *udev, ch +@@ -535,6 +542,9 @@ static int scsi_id(struct udev *udev, ch util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); util_replace_chars(serial_str, NULL); printf("ID_SERIAL=%s\n", serial_str); @@ -82,7 +78,7 @@ util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); util_replace_chars(serial_str, NULL); printf("ID_SERIAL_SHORT=%s\n", serial_str); -@@ -558,7 +568,10 @@ static int scsi_id(struct udev *udev, ch +@@ -565,7 +575,10 @@ static int scsi_id(struct udev *udev, ch if (reformat_serial) { char serial_str[MAX_SERIAL_LEN]; @@ -94,10 +90,8 @@ util_replace_chars(serial_str, NULL); printf("%s\n", serial_str); goto out; -Index: systemd/src/udev/scsi_id/scsi_id.h -=================================================================== ---- systemd.orig/src/udev/scsi_id/scsi_id.h -+++ systemd/src/udev/scsi_id/scsi_id.h +--- a/src/udev/scsi_id/scsi_id.h ++++ b/src/udev/scsi_id/scsi_id.h @@ -43,6 +43,7 @@ struct scsi_id_device { char kernel[64]; char serial[MAX_SERIAL_LEN]; @@ -106,11 +100,9 @@ int use_sg; /* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */ -Index: systemd/src/udev/scsi_id/scsi_serial.c -=================================================================== ---- systemd.orig/src/udev/scsi_id/scsi_serial.c -+++ systemd/src/udev/scsi_id/scsi_serial.c -@@ -96,7 +96,8 @@ static const char hex_str[]="0123456789a +--- a/src/udev/scsi_id/scsi_serial.c ++++ b/src/udev/scsi_id/scsi_serial.c +@@ -97,7 +97,8 @@ static const char hex_str[]="0123456789a static int do_scsi_page80_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, int fd, @@ -120,7 +112,7 @@ static int sg_err_category_new(struct udev *udev, int scsi_status, int msg_status, int -@@ -619,7 +620,7 @@ static int do_scsi_page83_inquiry(struct +@@ -620,7 +621,7 @@ static int do_scsi_page83_inquiry(struct unsigned char page_83[SCSI_INQ_BUFF_LEN]; /* also pick up the page 80 serial number */ @@ -129,7 +121,7 @@ memzero(page_83, SCSI_INQ_BUFF_LEN); retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, -@@ -764,7 +765,8 @@ static int do_scsi_page83_prespc3_inquir +@@ -765,7 +766,8 @@ static int do_scsi_page83_prespc3_inquir /* Get unit serial number VPD page */ static int do_scsi_page80_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, int fd, @@ -139,7 +131,7 @@ { int retval; int ser_ind; -@@ -798,9 +800,14 @@ static int do_scsi_page80_inquiry(struct +@@ -799,9 +801,14 @@ static int do_scsi_page80_inquiry(struct ser_ind = prepend_vendor_model(udev, dev_scsi, &serial[1]); if (ser_ind < 0) return 1; @@ -155,7 +147,7 @@ } if (serial_short != NULL) { memcpy(serial_short, &buf[4], len); -@@ -876,7 +883,7 @@ int scsi_get_serial(struct udev *udev, +@@ -877,7 +884,7 @@ int scsi_get_serial(struct udev *udev, return 1; if (page_code == PAGE_80) { @@ -164,7 +156,7 @@ retval = 1; goto completed; } else { -@@ -950,7 +957,7 @@ int scsi_get_serial(struct udev *udev, +@@ -951,7 +958,7 @@ int scsi_get_serial(struct udev *udev, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_80) if (!do_scsi_page80_inquiry(udev, dev_scsi, fd, ++++++ 1067-udev-always-resolve-correctly-database-names-on-chan.patch ++++++
From 368082520b25722575783f06879fb5fc2e4c219c Mon Sep 17 00:00:00 2001 From: Robert Milasan <rmilasan@suse.com> Date: Sat, 13 Sep 2014 15:18:37 +0200 Subject: [PATCH] udev: always resolve correctly database names on 'change' event
From ad6e5b348fa88f44d6cbfe7aabda7612a1d0463f Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Mon, 8 Sep 2014 14:00:58 +0200 Subject: [PATCH] udev: net_setup_link - export the .link filename applied to
Signed-off-by: Robert Milasan <rmilasan@suse.com> --- src/libudev/libudev-device.c | 2 +- src/libudev/libudev-private.h | 1 + src/udev/udev-event.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c index d61a2ad..2699374 100644 --- a/src/libudev/libudev-device.c +++ b/src/libudev/libudev-device.c @@ -161,7 +161,7 @@ _public_ dev_t udev_device_get_devnum(struct udev_device *udev_device) return udev_device->devnum; } -static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) +int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) { char num[32]; diff --git a/src/libudev/libudev-private.h b/src/libudev/libudev-private.h index 35ea7ba..05a6410 100644 --- a/src/libudev/libudev-private.h +++ b/src/libudev/libudev-private.h @@ -59,6 +59,7 @@ uid_t udev_device_get_devnode_uid(struct udev_device *udev_device); gid_t udev_device_get_devnode_gid(struct udev_device *udev_device); int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); +int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum); int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink); void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index e8d6676..2cf0763 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -812,6 +812,7 @@ void udev_event_execute_rules(struct udev_event *event, if (event->dev_db != NULL) { udev_device_set_syspath(event->dev_db, udev_device_get_syspath(dev)); udev_device_set_subsystem(event->dev_db, udev_device_get_subsystem(dev)); + udev_device_set_devnum(event->dev_db, udev_device_get_devnum(dev)); udev_device_read_db(event->dev_db, NULL); udev_device_set_info_loaded(event->dev_db); -- 1.8.4.5 ++++++ 1068-udev-net_setup_link-export-the-.link-filename-applie.patch ++++++ the link --- src/udev/udev-builtin-net_setup_link.c | 2 ++ 1 file changed, 2 insertions(+) diff --git src/udev/udev-builtin-net_setup_link.c src/udev/udev-builtin-net_setup_link.c index 6207269..14351de 100644 --- src/udev/udev-builtin-net_setup_link.c +++ src/udev/udev-builtin-net_setup_link.c @@ -57,6 +57,8 @@ static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv return EXIT_FAILURE; } + udev_builtin_add_property(dev, test, "ID_NET_LINK_FILE", link->filename); + if (name) udev_builtin_add_property(dev, test, "ID_NET_NAME", name); -- 1.7.9.2 ++++++ 1069-rules-net-setup-link-preserve-ID_NET_LINK_FILE-and-I.patch ++++++
From e4d7c49050769877c7f10184bbe2a1e77d0b5333 Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Mon, 8 Sep 2014 17:16:24 +0200 Subject: [PATCH] rules: net-setup-link - preserve ID_NET_LINK_FILE and ID_NET_NAME after MOVE
--- rules/80-net-setup-link.rules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git rules/80-net-setup-link.rules rules/80-net-setup-link.rules index f390fcb..27c43b9 100644 --- rules/80-net-setup-link.rules +++ rules/80-net-setup-link.rules @@ -4,7 +4,8 @@ SUBSYSTEM!="net", GOTO="net_setup_link_end" IMPORT{builtin}="path_id" -ACTION=="move", IMPORT{db}="ID_NET_DRIVER" +ACTION=="move", IMPORT{db}="ID_NET_DRIVER", IMPORT{db}="ID_NET_LINK_FILE", +IMPORT{db}="ID_NET_NAME" ACTION!="add", GOTO="net_setup_link_end" -- 1.7.9.2 ++++++ 1070-rules-net-setup-link-remove-stray-linebreak.patch ++++++
From 52e231b04635400292179cf51b30d7d9b6323fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com> Date: Mon, 8 Sep 2014 22:53:39 +0300 Subject: [PATCH] rules: net-setup-link - remove stray linebreak
If not backslash-escaped, it splits the rule in two. --- rules/80-net-setup-link.rules | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git rules/80-net-setup-link.rules rules/80-net-setup-link.rules index 27c43b9..4207694 100644 --- rules/80-net-setup-link.rules +++ rules/80-net-setup-link.rules @@ -4,8 +4,7 @@ SUBSYSTEM!="net", GOTO="net_setup_link_end" IMPORT{builtin}="path_id" -ACTION=="move", IMPORT{db}="ID_NET_DRIVER", IMPORT{db}="ID_NET_LINK_FILE", -IMPORT{db}="ID_NET_NAME" +ACTION=="move", IMPORT{db}="ID_NET_DRIVER", IMPORT{db}="ID_NET_LINK_FILE", IMPORT{db}="ID_NET_NAME" ACTION!="add", GOTO="net_setup_link_end" -- 1.7.9.2 ++++++ 1071-udev-import-the-full-db-on-MOVE-events-for-devices-w.patch ++++++
From b081b27e1433cdc7ac72b25ae8b4db887d79187f Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Tue, 9 Sep 2014 12:23:19 +0200 Subject: [PATCH] udev: import the full db on MOVE events for devices without dev_t
--- rules/80-net-setup-link.rules | 2 -- src/udev/udev-event.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git rules/80-net-setup-link.rules rules/80-net-setup-link.rules index 4207694..6e411a9 100644 --- rules/80-net-setup-link.rules +++ rules/80-net-setup-link.rules @@ -4,8 +4,6 @@ SUBSYSTEM!="net", GOTO="net_setup_link_end" IMPORT{builtin}="path_id" -ACTION=="move", IMPORT{db}="ID_NET_DRIVER", IMPORT{db}="ID_NET_LINK_FILE", IMPORT{db}="ID_NET_NAME" - ACTION!="add", GOTO="net_setup_link_end" IMPORT{builtin}="net_setup_link" diff --git src/udev/udev-event.c src/udev/udev-event.c index 00cd6d4..18b92ca 100644 --- src/udev/udev-event.c +++ src/udev/udev-event.c @@ -805,6 +805,22 @@ void udev_event_execute_rules(struct udev_event *event, udev_watch_end(event->udev, event->dev_db); } + if (major(udev_device_get_devnum(dev)) == 0 && + streq(udev_device_get_action(dev), "move")) { + struct udev_list_entry *entry; + + for ((entry = udev_device_get_properties_list_entry(event->dev_db)); entry; entry = udev_list_entry_get_next(entry)) { + const char *key, *value; + struct udev_list_entry *property; + + key = udev_list_entry_get_name(entry); + value = udev_list_entry_get_value(entry); + + property = udev_device_add_property(event->dev, key, value); + udev_list_entry_set_num(property, true); + } + } + udev_rules_apply_to_event(rules, event, timeout_usec, sigmask); /* rename a new network interface, if needed */ -- 1.7.9.2 ++++++ 1072-udev-netif_rename-don-t-log-to-kmsg.patch ++++++ Based on 1187f20655de0c37337ea73e1e55823b83cd7c00 Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Tue, 9 Sep 2014 22:45:03 +0200 Subject: [PATCH] udev: netif_rename - don't log to kmsg As of 3.17, the kernel will do this on its own, so just do regular log_debug() logging from udev. --- src/udev/udev-event.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- src/udev/udev-event.c +++ src/udev/udev-event.c 2014-09-16 08:52:36.154735794 +0000 @@ -770,7 +770,7 @@ static int rename_netif(struct udev_even r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), name); if (r == 0) { - print_kmsg("renamed network interface %s to %s\n", oldname, name); + log_debug("renamed network interface %s to %s", oldname, name); return r; } else if (r != -EEXIST) { log_error("error changing net interface name %s to %s: %s", @@ -789,7 +789,7 @@ static int rename_netif(struct udev_even } /* log temporary name */ - print_kmsg("renamed network interface %s to %s\n", oldname, interim); + log_debug("renamed network interface %s to %s", oldname, interim); loop = 90 * 20; while (loop--) { @@ -798,7 +798,7 @@ static int rename_netif(struct udev_even r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), name); if (r == 0) { - print_kmsg("renamed network interface %s to %s\n", interim, name); + log_debug("renamed network interface %s to %s", interim, name); break; } ++++++ 1073-udev-drop-print_kmsg.patch ++++++ Based on 9d19a679f23c7a72c326cbbbf44e0c9f423dec5d Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Tue, 9 Sep 2014 22:48:07 +0200 Subject: [PATCH] udev - drop print_kmsg The only remaining user was 'starting version XXX', which is now logged using log_info(). --- src/libudev/libudev-private.h | 1 - src/libudev/libudev-util.c | 25 ------------------------- src/udev/udevd.c | 2 +- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git src/libudev/libudev-private.h src/libudev/libudev-private.h index ae97557..cd1c1fb 100644 --- src/libudev/libudev-private.h +++ src/libudev/libudev-private.h @@ -170,6 +170,5 @@ int util_delete_path(struct udev *udev, const char *path); uid_t util_lookup_user(struct udev *udev, const char *user); gid_t util_lookup_group(struct udev *udev, const char *group); int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value); -ssize_t print_kmsg(const char *fmt, ...) _printf_(1, 2); #endif --- src/libudev/libudev-util.c +++ src/libudev/libudev-util.c 2014-09-16 08:56:01.862736270 +0000 @@ -422,33 +422,3 @@ static int parse_proc_cmdline_word(const return 0; } - -ssize_t print_kmsg(const char *fmt, ...) -{ - _cleanup_close_ int fd = -1; - va_list ap; - char text[1024]; - ssize_t len; - ssize_t ret; - - if (parse_proc_cmdline(parse_proc_cmdline_word) == -115) { - fd = open("/dev/null", O_WRONLY|O_NOCTTY|O_CLOEXEC); - } else { - fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC); - } - - if (fd < 0) - return -errno; - - len = snprintf(text, sizeof(text), "<30>systemd-udevd[%u]: ", getpid()); - - va_start(ap, fmt); - len += vsnprintf(text + len, sizeof(text) - len, fmt, ap); - va_end(ap); - - ret = write(fd, text, len); - if (ret < 0) - return -errno; - - return ret; -} diff --git src/udev/udevd.c src/udev/udevd.c index be0acc3..b023b6e 100644 --- src/udev/udevd.c +++ src/udev/udevd.c @@ -1200,7 +1200,7 @@ int main(int argc, char *argv[]) { sd_notify(1, "READY=1"); } - print_kmsg("starting version " VERSION "\n"); + log_info("starting version " VERSION "\n"); if (!debug) { int fd; -- 1.7.9.2 ++++++ 1074-udev-fix-copy-paste-error-in-log-message.patch ++++++
From ec3281d3b681b002dfe1a4bea0532a504e37557a Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Wed, 10 Sep 2014 07:59:22 +0200 Subject: [PATCH] udev: fix copy-paste error in log message
--- src/udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/udev/udev-rules.c src/udev/udev-rules.c index cc56215..6de7511 100644 --- src/udev/udev-rules.c +++ src/udev/udev-rules.c @@ -1323,7 +1323,7 @@ static int add_rule(struct udev_rules *rules, char *line, if (cmd < UDEV_BUILTIN_MAX) rule_add_key(&rule_tmp, TK_A_RUN_BUILTIN, op, value, &cmd); else - log_error("IMPORT{builtin}: '%s' unknown %s:%u", value, filename, lineno); + log_error("RUN{builtin}: '%s' unknown %s:%u", value, filename, lineno); } else if (streq(attr, "program")) { enum udev_builtin_cmd cmd = UDEV_BUILTIN_MAX; -- 1.7.9.2 ++++++ 1075-udev-timeout-increase-timeout.patch ++++++
From b5338a19864ac3f5632aee48069a669479621dca Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Wed, 10 Sep 2014 10:56:26 +0200 Subject: [PATCH] udev: timeout - increase timeout
Some kernel modules still take more than one minute to insmod, we no longer rely on the timeout killing insmod within a given period of time, so just bump this to a much higher value. Its only purpose is to make sure that nothing stays aronud forever. --- src/udev/udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/udev/udevd.c src/udev/udevd.c index b023b6e..a7f8cbd 100644 --- src/udev/udevd.c +++ src/udev/udevd.c @@ -74,7 +74,7 @@ static bool reload; static int children; static int children_max; static int exec_delay; -static usec_t event_timeout_usec = 60 * USEC_PER_SEC; +static usec_t event_timeout_usec = 180 * USEC_PER_SEC; static sigset_t sigmask_orig; static UDEV_LIST(event_list); static UDEV_LIST(worker_list); -- 1.7.9.2 ++++++ 1076-udev-timeout-warn-after-a-third-of-the-timeout-befor.patch ++++++ Based on 671174136525ddf208cdbe75d6d6bd159afa961f Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 11 Sep 2014 18:49:04 +0200 Subject: [PATCH] udev: timeout - warn after a third of the timeout before killing --- src/test/test-udev.c | 4 ++-- src/udev/udev-event.c | 40 ++++++++++++++++++++++++++++++---------- src/udev/udev-rules.c | 8 +++++--- src/udev/udev.h | 9 ++++++--- src/udev/udevadm-test.c | 2 +- src/udev/udevd.c | 40 +++++++++++++++++++++++++++------------- 6 files changed, 71 insertions(+), 32 deletions(-) diff --git src/test/test-udev.c src/test/test-udev.c index 566a73a..f085262 100644 --- src/test/test-udev.c +++ src/test/test-udev.c @@ -153,8 +153,8 @@ int main(int argc, char *argv[]) { } } - udev_event_execute_rules(event, USEC_PER_SEC, rules, &sigmask_orig); - udev_event_execute_run(event, USEC_PER_SEC, NULL); + udev_event_execute_rules(event, 3 * USEC_PER_SEC, USEC_PER_SEC, rules, &sigmask_orig); + udev_event_execute_run(event, 3 * USEC_PER_SEC, USEC_PER_SEC, NULL); out: if (event != NULL && event->fd_signal >= 0) close(event->fd_signal); diff --git src/udev/udev-event.c src/udev/udev-event.c index a883edc..e8d6676 100644 --- src/udev/udev-event.c +++ src/udev/udev-event.c @@ -541,6 +541,7 @@ out: static int spawn_wait(struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, const char *cmd, pid_t pid) { struct pollfd pfd[1]; int err = 0; @@ -550,6 +551,7 @@ static int spawn_wait(struct udev_event *event, while (pid > 0) { int timeout; + int timeout_warn = 0; int fdcount; if (timeout_usec > 0) { @@ -558,13 +560,17 @@ static int spawn_wait(struct udev_event *event, age_usec = now(CLOCK_MONOTONIC) - event->birth_usec; if (age_usec >= timeout_usec) timeout = 1000; - else - timeout = ((timeout_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC; + else { + if (timeout_warn_usec > 0) + timeout_warn = ((timeout_warn_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC; + + timeout = ((timeout_usec - timeout_warn_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC; + } } else { timeout = -1; } - fdcount = poll(pfd, 1, timeout); + fdcount = poll(pfd, 1, timeout_warn); if (fdcount < 0) { if (errno == EINTR) continue; @@ -573,8 +579,20 @@ static int spawn_wait(struct udev_event *event, goto out; } if (fdcount == 0) { - log_error("timeout: killing '%s' [%u]", cmd, pid); - kill(pid, SIGKILL); + log_warning("slow: '%s' [%u]", cmd, pid); + + fdcount = poll(pfd, 1, timeout); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + log_error("failed to poll: %m"); + goto out; + } + if (fdcount == 0) { + log_error("timeout: killing '%s' [%u]", cmd, pid); + kill(pid, SIGKILL); + } } if (pfd[0].revents & POLLIN) { @@ -654,6 +672,7 @@ out: int udev_event_spawn(struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, const char *cmd, char **envp, const sigset_t *sigmask, char *result, size_t ressize) { struct udev *udev = event->udev; @@ -730,7 +749,7 @@ int udev_event_spawn(struct udev_event *event, outpipe[READ_END], errpipe[READ_END], result, ressize); - err = spawn_wait(event, timeout_usec, cmd, pid); + err = spawn_wait(event, timeout_usec, timeout_warn_usec, cmd, pid); } out: @@ -769,6 +788,7 @@ static int rename_netif(struct udev_event *event) { void udev_event_execute_rules(struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, struct udev_rules *rules, const sigset_t *sigmask) { struct udev_device *dev = event->dev; @@ -783,7 +803,7 @@ void udev_event_execute_rules(struct udev_event *event, if (major(udev_device_get_devnum(dev)) != 0) udev_watch_end(event->udev, dev); - udev_rules_apply_to_event(rules, event, timeout_usec, sigmask); + udev_rules_apply_to_event(rules, event, timeout_usec, timeout_warn_usec, sigmask); if (major(udev_device_get_devnum(dev)) != 0) udev_node_remove(dev); @@ -816,7 +836,7 @@ void udev_event_execute_rules(struct udev_event *event, } } - udev_rules_apply_to_event(rules, event, timeout_usec, sigmask); + udev_rules_apply_to_event(rules, event, timeout_usec, timeout_warn_usec, sigmask); /* rename a new network interface, if needed */ if (udev_device_get_ifindex(dev) > 0 && streq(udev_device_get_action(dev), "add") && @@ -889,7 +909,7 @@ void udev_event_execute_rules(struct udev_event *event, } } -void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const sigset_t *sigmask) { +void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, const sigset_t *sigmask) { struct udev_list_entry *list_entry; udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { @@ -912,7 +932,7 @@ void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const udev_event_apply_format(event, cmd, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); - udev_event_spawn(event, timeout_usec, program, envp, sigmask, NULL, 0); + udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, sigmask, NULL, 0); } } } diff --git src/udev/udev-rules.c src/udev/udev-rules.c index 9514dde..db95442 100644 --- src/udev/udev-rules.c +++ src/udev/udev-rules.c @@ -615,6 +615,7 @@ static int import_file_into_properties(struct udev_device *dev, const char *file static int import_program_into_properties(struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, const char *program, const sigset_t *sigmask) { struct udev_device *dev = event->dev; char **envp; @@ -623,7 +624,7 @@ static int import_program_into_properties(struct udev_event *event, int err; envp = udev_device_get_properties_envp(dev); - err = udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result)); + err = udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, sigmask, result, sizeof(result)); if (err < 0) return err; @@ -1862,6 +1863,7 @@ enum escape_type { int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, const sigset_t *sigmask) { struct token *cur; struct token *rule; @@ -2070,7 +2072,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, rules_str(rules, rule->rule.filename_off), rule->rule.filename_line); - if (udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result)) < 0) { + if (udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, sigmask, result, sizeof(result)) < 0) { if (cur->key.op != OP_NOMATCH) goto nomatch; } else { @@ -2106,7 +2108,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, rules_str(rules, rule->rule.filename_off), rule->rule.filename_line); - if (import_program_into_properties(event, timeout_usec, import, sigmask) != 0) + if (import_program_into_properties(event, timeout_usec, timeout_warn_usec, import, sigmask) != 0) if (cur->key.op != OP_NOMATCH) goto nomatch; break; diff --git src/udev/udev.h src/udev/udev.h index ed01da3..765ba9e 100644 --- src/udev/udev.h +++ src/udev/udev.h @@ -73,7 +73,8 @@ struct udev_rules; struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); struct udev_rules *udev_rules_unref(struct udev_rules *rules); bool udev_rules_check_timestamp(struct udev_rules *rules); -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, usec_t timeout_usec, const sigset_t *sigmask); +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, + const sigset_t *sigmask); int udev_rules_apply_static_dev_perms(struct udev_rules *rules); /* udev-event.c */ @@ -84,10 +85,12 @@ int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, char *result, size_t maxsize, int read_value); int udev_event_spawn(struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, const char *cmd, char **envp, const sigset_t *sigmask, char *result, size_t ressize); -void udev_event_execute_rules(struct udev_event *event, usec_t timeout_usec, struct udev_rules *rules, const sigset_t *sigset); -void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const sigset_t *sigset); +void udev_event_execute_rules(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, + struct udev_rules *rules, const sigset_t *sigset); +void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, const sigset_t *sigset); int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]); /* udev-watch.c */ diff --git src/udev/udevadm-test.c src/udev/udevadm-test.c index 809adb6..4738b61 100644 --- src/udev/udevadm-test.c +++ src/udev/udevadm-test.c @@ -136,7 +136,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) { goto out; } - udev_event_execute_rules(event, 60 * USEC_PER_SEC, rules, &sigmask_orig); + udev_event_execute_rules(event, 60 * USEC_PER_SEC, 20 * USEC_PER_SEC, rules, &sigmask_orig); udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); --- src/udev/udevd.c +++ src/udev/udevd.c 2014-09-16 09:01:14.382735997 +0000 @@ -75,6 +75,7 @@ static int children; static int children_max; static int exec_delay; static usec_t event_timeout_usec = 180 * USEC_PER_SEC; +static usec_t event_timeout_warn_usec = 180 * USEC_PER_SEC / 3; static sigset_t sigmask_orig; static UDEV_LIST(event_list); static UDEV_LIST(worker_list); @@ -129,6 +130,7 @@ struct worker { enum worker_state state; struct event *event; usec_t event_start_usec; + bool event_warned; }; /* passed from worker to main process */ @@ -314,9 +316,9 @@ static void worker_new(struct event *eve } /* apply rules, create node, symlinks */ - udev_event_execute_rules(udev_event, event_timeout_usec, rules, &sigmask_orig); + udev_event_execute_rules(udev_event, event_timeout_usec, event_timeout_warn_usec, rules, &sigmask_orig); - udev_event_execute_run(udev_event, event_timeout_usec, &sigmask_orig); + udev_event_execute_run(udev_event, event_timeout_usec, event_timeout_warn_usec, &sigmask_orig); /* apply/restore inotify watch */ if (udev_event->inotify_watch) { @@ -410,6 +412,7 @@ out: worker->pid = pid; worker->state = WORKER_RUNNING; worker->event_start_usec = now(CLOCK_MONOTONIC); + worker->event_warned = false; worker->event = event; event->state = EVENT_RUNNING; udev_list_node_append(&worker->node, &worker_list); @@ -441,6 +444,7 @@ static void event_run(struct event *even worker->event = event; worker->state = WORKER_RUNNING; worker->event_start_usec = now(CLOCK_MONOTONIC); + worker->event_warned = false; event->state = EVENT_RUNNING; return; } @@ -1016,6 +1020,7 @@ static void kernel_cmdline_options(struc exec_delay = strtoul(opt + 16, NULL, 0); } else if (startswith(opt, "udev.event-timeout=")) { event_timeout_usec = strtoul(opt + 16, NULL, 0) * USEC_PER_SEC; + event_timeout_warn_usec = (event_timeout_usec / 3) ? : 1; } free(s); @@ -1078,6 +1083,7 @@ int main(int argc, char *argv[]) { break; case 't': event_timeout_usec = strtoul(optarg, NULL, 0) * USEC_PER_SEC; + event_timeout_warn_usec = (event_timeout_usec / 3) ? : 1; break; case 'D': debug = true; @@ -1413,21 +1419,29 @@ int main(int argc, char *argv[]) { /* check for hanging events */ udev_list_node_foreach(loop, &worker_list) { struct worker *worker = node_to_worker(loop); + usec_t ts; if (worker->state != WORKER_RUNNING) continue; - if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > event_timeout_usec) { - log_error("worker [%u] %s timeout; kill it", worker->pid, worker->event->devpath); - kill(worker->pid, SIGKILL); - worker->state = WORKER_KILLED; - - /* drop reference taken for state 'running' */ - worker_unref(worker); - log_error("seq %llu '%s' killed", udev_device_get_seqnum(worker->event->dev), worker->event->devpath); - worker->event->exitcode = -64; - event_queue_delete(worker->event); - worker->event = NULL; + ts = now(CLOCK_MONOTONIC); + + if ((ts - worker->event_start_usec) > event_timeout_warn_usec) { + if ((ts - worker->event_start_usec) > event_timeout_usec) { + log_error("worker [%u] %s timeout; kill it", worker->pid, worker->event->devpath); + kill(worker->pid, SIGKILL); + worker->state = WORKER_KILLED; + + /* drop reference taken for state 'running' */ + worker_unref(worker); + log_error("seq %llu '%s' killed", udev_device_get_seqnum(worker->event->dev), worker->event->devpath); + worker->event->exitcode = -64; + event_queue_delete(worker->event); + worker->event = NULL; + } else if (!worker->event_warned) { + log_warning("worker [%u] %s is taking a long time", worker->pid, worker->event->devpath); + worker->event_warned = true; + } } } -- 1.7.9.2 ++++++ 1077-udev-timeout-warn-after-a-third-of-the-timeout-befor.patch ++++++ Based on 671174136525ddf208cdbe75d6d6bd159afa961f Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 11 Sep 2014 18:49:04 +0200 Subject: [PATCH] udev: timeout - warn after a third of the timeout before killing --- src/test/test-udev.c | 4 ++-- src/udev/udev-event.c | 40 ++++++++++++++++++++++++++++++---------- src/udev/udev-rules.c | 8 +++++--- src/udev/udev.h | 9 ++++++--- src/udev/udevadm-test.c | 2 +- src/udev/udevd.c | 40 +++++++++++++++++++++++++++------------- 6 files changed, 71 insertions(+), 32 deletions(-) diff --git src/test/test-udev.c src/test/test-udev.c index 566a73a..f085262 100644 --- src/test/test-udev.c +++ src/test/test-udev.c @@ -153,8 +153,8 @@ int main(int argc, char *argv[]) { } } - udev_event_execute_rules(event, USEC_PER_SEC, rules, &sigmask_orig); - udev_event_execute_run(event, USEC_PER_SEC, NULL); + udev_event_execute_rules(event, 3 * USEC_PER_SEC, USEC_PER_SEC, rules, &sigmask_orig); + udev_event_execute_run(event, 3 * USEC_PER_SEC, USEC_PER_SEC, NULL); out: if (event != NULL && event->fd_signal >= 0) close(event->fd_signal); diff --git src/udev/udev-event.c src/udev/udev-event.c index a883edc..e8d6676 100644 --- src/udev/udev-event.c +++ src/udev/udev-event.c @@ -541,6 +541,7 @@ out: static int spawn_wait(struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, const char *cmd, pid_t pid) { struct pollfd pfd[1]; int err = 0; @@ -550,6 +551,7 @@ static int spawn_wait(struct udev_event *event, while (pid > 0) { int timeout; + int timeout_warn = 0; int fdcount; if (timeout_usec > 0) { @@ -558,13 +560,17 @@ static int spawn_wait(struct udev_event *event, age_usec = now(CLOCK_MONOTONIC) - event->birth_usec; if (age_usec >= timeout_usec) timeout = 1000; - else - timeout = ((timeout_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC; + else { + if (timeout_warn_usec > 0) + timeout_warn = ((timeout_warn_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC; + + timeout = ((timeout_usec - timeout_warn_usec - age_usec) / USEC_PER_MSEC) + MSEC_PER_SEC; + } } else { timeout = -1; } - fdcount = poll(pfd, 1, timeout); + fdcount = poll(pfd, 1, timeout_warn); if (fdcount < 0) { if (errno == EINTR) continue; @@ -573,8 +579,20 @@ static int spawn_wait(struct udev_event *event, goto out; } if (fdcount == 0) { - log_error("timeout: killing '%s' [%u]", cmd, pid); - kill(pid, SIGKILL); + log_warning("slow: '%s' [%u]", cmd, pid); + + fdcount = poll(pfd, 1, timeout); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + log_error("failed to poll: %m"); + goto out; + } + if (fdcount == 0) { + log_error("timeout: killing '%s' [%u]", cmd, pid); + kill(pid, SIGKILL); + } } if (pfd[0].revents & POLLIN) { @@ -654,6 +672,7 @@ out: int udev_event_spawn(struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, const char *cmd, char **envp, const sigset_t *sigmask, char *result, size_t ressize) { struct udev *udev = event->udev; @@ -730,7 +749,7 @@ int udev_event_spawn(struct udev_event *event, outpipe[READ_END], errpipe[READ_END], result, ressize); - err = spawn_wait(event, timeout_usec, cmd, pid); + err = spawn_wait(event, timeout_usec, timeout_warn_usec, cmd, pid); } out: @@ -769,6 +788,7 @@ static int rename_netif(struct udev_event *event) { void udev_event_execute_rules(struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, struct udev_rules *rules, const sigset_t *sigmask) { struct udev_device *dev = event->dev; @@ -783,7 +803,7 @@ void udev_event_execute_rules(struct udev_event *event, if (major(udev_device_get_devnum(dev)) != 0) udev_watch_end(event->udev, dev); - udev_rules_apply_to_event(rules, event, timeout_usec, sigmask); + udev_rules_apply_to_event(rules, event, timeout_usec, timeout_warn_usec, sigmask); if (major(udev_device_get_devnum(dev)) != 0) udev_node_remove(dev); @@ -816,7 +836,7 @@ void udev_event_execute_rules(struct udev_event *event, } } - udev_rules_apply_to_event(rules, event, timeout_usec, sigmask); + udev_rules_apply_to_event(rules, event, timeout_usec, timeout_warn_usec, sigmask); /* rename a new network interface, if needed */ if (udev_device_get_ifindex(dev) > 0 && streq(udev_device_get_action(dev), "add") && @@ -889,7 +909,7 @@ void udev_event_execute_rules(struct udev_event *event, } } -void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const sigset_t *sigmask) { +void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, const sigset_t *sigmask) { struct udev_list_entry *list_entry; udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { @@ -912,7 +932,7 @@ void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const udev_event_apply_format(event, cmd, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); - udev_event_spawn(event, timeout_usec, program, envp, sigmask, NULL, 0); + udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, sigmask, NULL, 0); } } } diff --git src/udev/udev-rules.c src/udev/udev-rules.c index 9514dde..db95442 100644 --- src/udev/udev-rules.c +++ src/udev/udev-rules.c @@ -615,6 +615,7 @@ static int import_file_into_properties(struct udev_device *dev, const char *file static int import_program_into_properties(struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, const char *program, const sigset_t *sigmask) { struct udev_device *dev = event->dev; char **envp; @@ -623,7 +624,7 @@ static int import_program_into_properties(struct udev_event *event, int err; envp = udev_device_get_properties_envp(dev); - err = udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result)); + err = udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, sigmask, result, sizeof(result)); if (err < 0) return err; @@ -1862,6 +1863,7 @@ enum escape_type { int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, const sigset_t *sigmask) { struct token *cur; struct token *rule; @@ -2070,7 +2072,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, rules_str(rules, rule->rule.filename_off), rule->rule.filename_line); - if (udev_event_spawn(event, timeout_usec, program, envp, sigmask, result, sizeof(result)) < 0) { + if (udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, sigmask, result, sizeof(result)) < 0) { if (cur->key.op != OP_NOMATCH) goto nomatch; } else { @@ -2106,7 +2108,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, rules_str(rules, rule->rule.filename_off), rule->rule.filename_line); - if (import_program_into_properties(event, timeout_usec, import, sigmask) != 0) + if (import_program_into_properties(event, timeout_usec, timeout_warn_usec, import, sigmask) != 0) if (cur->key.op != OP_NOMATCH) goto nomatch; break; diff --git src/udev/udev.h src/udev/udev.h index ed01da3..765ba9e 100644 --- src/udev/udev.h +++ src/udev/udev.h @@ -73,7 +73,8 @@ struct udev_rules; struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); struct udev_rules *udev_rules_unref(struct udev_rules *rules); bool udev_rules_check_timestamp(struct udev_rules *rules); -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, usec_t timeout_usec, const sigset_t *sigmask); +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, + const sigset_t *sigmask); int udev_rules_apply_static_dev_perms(struct udev_rules *rules); /* udev-event.c */ @@ -84,10 +85,12 @@ int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, char *result, size_t maxsize, int read_value); int udev_event_spawn(struct udev_event *event, usec_t timeout_usec, + usec_t timeout_warn_usec, const char *cmd, char **envp, const sigset_t *sigmask, char *result, size_t ressize); -void udev_event_execute_rules(struct udev_event *event, usec_t timeout_usec, struct udev_rules *rules, const sigset_t *sigset); -void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, const sigset_t *sigset); +void udev_event_execute_rules(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, + struct udev_rules *rules, const sigset_t *sigset); +void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, const sigset_t *sigset); int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]); /* udev-watch.c */ diff --git src/udev/udevadm-test.c src/udev/udevadm-test.c index 809adb6..4738b61 100644 --- src/udev/udevadm-test.c +++ src/udev/udevadm-test.c @@ -136,7 +136,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) { goto out; } - udev_event_execute_rules(event, 60 * USEC_PER_SEC, rules, &sigmask_orig); + udev_event_execute_rules(event, 60 * USEC_PER_SEC, 20 * USEC_PER_SEC, rules, &sigmask_orig); udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); --- src/udev/udevd.c +++ src/udev/udevd.c 2014-09-16 09:01:14.382735997 +0000 @@ -75,6 +75,7 @@ static int children; static int children_max; static int exec_delay; static usec_t event_timeout_usec = 180 * USEC_PER_SEC; +static usec_t event_timeout_warn_usec = 180 * USEC_PER_SEC / 3; static sigset_t sigmask_orig; static UDEV_LIST(event_list); static UDEV_LIST(worker_list); @@ -129,6 +130,7 @@ struct worker { enum worker_state state; struct event *event; usec_t event_start_usec; + bool event_warned; }; /* passed from worker to main process */ @@ -314,9 +316,9 @@ static void worker_new(struct event *eve } /* apply rules, create node, symlinks */ - udev_event_execute_rules(udev_event, event_timeout_usec, rules, &sigmask_orig); + udev_event_execute_rules(udev_event, event_timeout_usec, event_timeout_warn_usec, rules, &sigmask_orig); - udev_event_execute_run(udev_event, event_timeout_usec, &sigmask_orig); + udev_event_execute_run(udev_event, event_timeout_usec, event_timeout_warn_usec, &sigmask_orig); /* apply/restore inotify watch */ if (udev_event->inotify_watch) { @@ -410,6 +412,7 @@ out: worker->pid = pid; worker->state = WORKER_RUNNING; worker->event_start_usec = now(CLOCK_MONOTONIC); + worker->event_warned = false; worker->event = event; event->state = EVENT_RUNNING; udev_list_node_append(&worker->node, &worker_list); @@ -441,6 +444,7 @@ static void event_run(struct event *even worker->event = event; worker->state = WORKER_RUNNING; worker->event_start_usec = now(CLOCK_MONOTONIC); + worker->event_warned = false; event->state = EVENT_RUNNING; return; } @@ -1016,6 +1020,7 @@ static void kernel_cmdline_options(struc exec_delay = strtoul(opt + 16, NULL, 0); } else if (startswith(opt, "udev.event-timeout=")) { event_timeout_usec = strtoul(opt + 16, NULL, 0) * USEC_PER_SEC; + event_timeout_warn_usec = (event_timeout_usec / 3) ? : 1; } free(s); @@ -1078,6 +1083,7 @@ int main(int argc, char *argv[]) { break; case 't': event_timeout_usec = strtoul(optarg, NULL, 0) * USEC_PER_SEC; + event_timeout_warn_usec = (event_timeout_usec / 3) ? : 1; break; case 'D': debug = true; @@ -1413,21 +1419,29 @@ int main(int argc, char *argv[]) { /* check for hanging events */ udev_list_node_foreach(loop, &worker_list) { struct worker *worker = node_to_worker(loop); + usec_t ts; if (worker->state != WORKER_RUNNING) continue; - if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > event_timeout_usec) { - log_error("worker [%u] %s timeout; kill it", worker->pid, worker->event->devpath); - kill(worker->pid, SIGKILL); - worker->state = WORKER_KILLED; - - /* drop reference taken for state 'running' */ - worker_unref(worker); - log_error("seq %llu '%s' killed", udev_device_get_seqnum(worker->event->dev), worker->event->devpath); - worker->event->exitcode = -64; - event_queue_delete(worker->event, true); - worker->event = NULL; + ts = now(CLOCK_MONOTONIC); + + if ((ts - worker->event_start_usec) > event_timeout_warn_usec) { + if ((ts - worker->event_start_usec) > event_timeout_usec) { + log_error("worker [%u] %s timeout; kill it", worker->pid, worker->event->devpath); + kill(worker->pid, SIGKILL); + worker->state = WORKER_KILLED; + + /* drop reference taken for state 'running' */ + worker_unref(worker); + log_error("seq %llu '%s' killed", udev_device_get_seqnum(worker->event->dev), worker->event->devpath); + worker->event->exitcode = -64; + event_queue_delete(worker->event, true); + worker->event = NULL; + } else if (!worker->event_warned) { + log_warning("worker [%u] %s is taking a long time", worker->pid, worker->event->devpath); + worker->event_warned = true; + } } } -- 1.7.9.2 ++++++ 1078-udev-remove-userspace-firmware-loading-support.patch ++++++
From be2ea723b1d023b3d385d3b791ee4607cbfb20ca Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Sat, 30 Aug 2014 11:34:20 +0200 Subject: [PATCH] udev: remove userspace firmware loading support
--- Makefile.am | 12 --- README | 9 +-- TODO | 1 - configure.ac | 20 ----- src/udev/udev-builtin-firmware.c | 154 --------------------------------------- src/udev/udev-builtin.c | 3 - src/udev/udev.h | 6 -- src/udev/udevd.c | 13 ---- Index: systemd-210/configure.ac =================================================================== --- systemd-210.orig/configure.ac +++ systemd-210/configure.ac @@ -902,25 +902,6 @@ if test "x$have_myhostname" != "xno"; th fi # ------------------------------------------------------------------------------ -AC_ARG_WITH(firmware-path, - AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], - [Firmware search path (default="")]), - [], [with_firmware_path=""]) -OLD_IFS=$IFS -IFS=: -for i in $with_firmware_path; do - if test "x${FIRMWARE_PATH}" = "x"; then - FIRMWARE_PATH="\\\"${i}/\\\"" - else - FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\"" - fi -done -IFS=$OLD_IFS -AC_SUBST(FIRMWARE_PATH) -AS_IF([test "x${FIRMWARE_PATH}" != "x"], [ AC_DEFINE(HAVE_FIRMWARE, 1, [Define if FIRMWARE is available]) ]) -AM_CONDITIONAL(ENABLE_FIRMWARE, [test "x${FIRMWARE_PATH}" != "x"]) - -# ------------------------------------------------------------------------------ AC_ARG_ENABLE([gudev], AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]), [], [enable_gudev=yes]) @@ -1137,7 +1118,6 @@ AC_MSG_RESULT([ Build Python: ${PYTHON} Installation Python: ${PYTHON_BINARY} sphinx binary: ${SPHINX_BUILD} - firmware path: ${FIRMWARE_PATH} PAM modules dir: ${with_pamlibdir} PAM configuration dir: ${with_pamconfdir} D-Bus policy dir: ${with_dbuspolicydir} Index: systemd-210/Makefile.am =================================================================== --- systemd-210.orig/Makefile.am +++ systemd-210/Makefile.am @@ -2677,18 +2677,6 @@ libudev_core_la_LIBADD = \ $(BLKID_LIBS) \ $(KMOD_LIBS) -libudev_core_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - -DFIRMWARE_PATH="$(FIRMWARE_PATH)" - -if ENABLE_FIRMWARE -libudev_core_la_SOURCES += \ - src/udev/udev-builtin-firmware.c - -dist_udevrules_DATA += \ - rules/50-firmware.rules -endif - if HAVE_KMOD libudev_core_la_SOURCES += \ src/udev/udev-builtin-kmod.c Index: systemd-210/README =================================================================== --- systemd-210.orig/README +++ systemd-210/README @@ -51,14 +51,14 @@ REQUIREMENTS: Linux kernel >= 3.8 for Smack support - Udev will fail to work with the legacy layout: + Udev will fail to work with the legacy sysfs layout: CONFIG_SYSFS_DEPRECATED=n Legacy hotplug slows down the system and confuses udev: CONFIG_UEVENT_HELPER_PATH="" - Userspace firmware loading is deprecated, will go away, and - sometimes causes problems: + Userspace firmware loading is not supported and should + be disabled in the kernel CONFIG_FW_LOADER_USER_HELPER=n Some udev rules and virtualization detection relies on it: Index: systemd-210/src/udev/udev-builtin.c =================================================================== --- systemd-210.orig/src/udev/udev-builtin.c +++ systemd-210/src/udev/udev-builtin.c @@ -34,9 +34,6 @@ static const struct udev_builtin *builti [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, #endif [UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs, -#ifdef HAVE_FIRMWARE - [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, -#endif [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb, [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, [UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard, Index: systemd-210/src/udev/udev-builtin-firmware.c =================================================================== --- systemd-210.orig/src/udev/udev-builtin-firmware.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * firmware - Kernel firmware loader - * - * Copyright (C) 2009 Piter Punk <piterpunk@slackware.com> - * Copyright (C) 2009-2011 Kay Sievers <kay@vrfy.org> - * - * 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:* - */ - -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <getopt.h> -#include <errno.h> -#include <stdbool.h> -#include <sys/utsname.h> -#include <sys/stat.h> - -#include "udev.h" - -static bool set_loading(struct udev *udev, char *loadpath, const char *state) -{ - FILE *ldfile; - - ldfile = fopen(loadpath, "we"); - if (ldfile == NULL) { - log_error("error: can not open '%s'", loadpath); - return false; - }; - fprintf(ldfile, "%s\n", state); - fclose(ldfile); - return true; -} - -static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) -{ - char *buf; - FILE *fsource = NULL, *ftarget = NULL; - bool ret = false; - - buf = malloc(size); - if (buf == NULL) { - log_error("No memory available to load firmware file"); - return false; - } - - log_debug("writing '%s' (%zi) to '%s'", source, size, target); - - fsource = fopen(source, "re"); - if (fsource == NULL) - goto exit; - ftarget = fopen(target, "we"); - if (ftarget == NULL) - goto exit; - if (fread(buf, size, 1, fsource) != 1) - goto exit; - if (fwrite(buf, size, 1, ftarget) == 1) - ret = true; -exit: - if (ftarget != NULL) - fclose(ftarget); - if (fsource != NULL) - fclose(fsource); - free(buf); - return ret; -} - -static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) -{ - struct udev *udev = udev_device_get_udev(dev); - static const char *searchpath[] = { FIRMWARE_PATH }; - char loadpath[UTIL_PATH_SIZE]; - char datapath[UTIL_PATH_SIZE]; - char fwpath[UTIL_PATH_SIZE]; - const char *firmware; - FILE *fwfile = NULL; - struct utsname kernel; - struct stat statbuf; - unsigned int i; - int rc = EXIT_SUCCESS; - - firmware = udev_device_get_property_value(dev, "FIRMWARE"); - if (firmware == NULL) { - log_error("firmware parameter missing"); - rc = EXIT_FAILURE; - goto exit; - } - - /* lookup firmware file */ - uname(&kernel); - for (i = 0; i < ELEMENTSOF(searchpath); i++) { - strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); - fwfile = fopen(fwpath, "re"); - if (fwfile != NULL) - break; - - strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); - fwfile = fopen(fwpath, "re"); - if (fwfile != NULL) - break; - } - - strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); - - if (fwfile == NULL) { - log_debug("did not find firmware file '%s'", firmware); - rc = EXIT_FAILURE; - /* - * Do not cancel the request in the initrd, the real root might have - * the firmware file and the 'coldplug' run in the real root will find - * this pending request and fulfill or cancel it. - * */ - if (!in_initrd()) - set_loading(udev, loadpath, "-1"); - goto exit; - } - - if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { - if (!in_initrd()) - set_loading(udev, loadpath, "-1"); - rc = EXIT_FAILURE; - goto exit; - } - - if (!set_loading(udev, loadpath, "1")) - goto exit; - - strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); - if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { - log_error("error sending firmware '%s' to device", firmware); - set_loading(udev, loadpath, "-1"); - rc = EXIT_FAILURE; - goto exit; - }; - - set_loading(udev, loadpath, "0"); -exit: - if (fwfile) - fclose(fwfile); - return rc; -} - -const struct udev_builtin udev_builtin_firmware = { - .name = "firmware", - .cmd = builtin_firmware, - .help = "kernel firmware loader", - .run_once = true, -}; Index: systemd-210/src/udev/udevd.c =================================================================== --- systemd-210.orig/src/udev/udevd.c +++ systemd-210/src/udev/udevd.c @@ -100,9 +100,6 @@ struct event { dev_t devnum; int ifindex; bool is_block; -#ifdef HAVE_FIRMWARE - bool nodelay; -#endif }; static inline struct event *node_to_event(struct udev_list_node *node) @@ -474,10 +471,6 @@ static int event_queue_insert(struct ude event->devnum = udev_device_get_devnum(dev); event->is_block = streq("block", udev_device_get_subsystem(dev)); event->ifindex = udev_device_get_ifindex(dev); -#ifdef HAVE_FIRMWARE - if (streq(udev_device_get_subsystem(dev), "firmware")) - event->nodelay = true; -#endif udev_queue_export_device_queued(udev_queue_export, dev); log_debug("seq %llu queued, '%s' '%s'", udev_device_get_seqnum(dev), @@ -557,12 +550,6 @@ static bool is_devpath_busy(struct event return true; } -#ifdef HAVE_FIRMWARE - /* allow to bypass the dependency tracking */ - if (event->nodelay) - continue; -#endif - /* parent device event found */ if (event->devpath[common] == '/') { event->delaying_seqnum = loop_event->seqnum; Index: systemd-210/src/udev/udev.h =================================================================== --- systemd-210.orig/src/udev/udev.h +++ systemd-210/src/udev/udev.h @@ -141,9 +141,6 @@ enum udev_builtin_cmd { UDEV_BUILTIN_BLKID, #endif UDEV_BUILTIN_BTRFS, -#ifdef HAVE_FIRMWARE - UDEV_BUILTIN_FIRMWARE, -#endif UDEV_BUILTIN_HWDB, UDEV_BUILTIN_INPUT_ID, UDEV_BUILTIN_KEYBOARD, @@ -172,9 +169,6 @@ struct udev_builtin { extern const struct udev_builtin udev_builtin_blkid; #endif extern const struct udev_builtin udev_builtin_btrfs; -#ifdef HAVE_FIRMWARE -extern const struct udev_builtin udev_builtin_firmware; -#endif extern const struct udev_builtin udev_builtin_hwdb; extern const struct udev_builtin udev_builtin_input_id; extern const struct udev_builtin udev_builtin_keyboard; Index: systemd-210/TODO =================================================================== --- systemd-210.orig/TODO +++ systemd-210/TODO @@ -541,7 +541,6 @@ Features: * ExecOnFailure=/usr/bin/foo * udev: - - remove src/udev/udev-builtin-firmware.c (CONFIG_FW_LOADER_USER_HELPER=n) - move to LGPL - kill scsi_id - add trigger --subsystem-match=usb/usb_device device ++++++ 1079-udev-remove-userspace-firmware-loading-support.patch ++++++
From be2ea723b1d023b3d385d3b791ee4607cbfb20ca Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Sat, 30 Aug 2014 11:34:20 +0200 Subject: [PATCH] udev: remove userspace firmware loading support
--- Makefile.am | 12 --- README | 9 +-- TODO | 1 - configure.ac | 20 ----- src/udev/udev-builtin-firmware.c | 154 --------------------------------------- src/udev/udev-builtin.c | 3 - src/udev/udev.h | 6 -- src/udev/udevd.c | 13 ---- Index: systemd-210/configure.ac =================================================================== --- systemd-210.orig/configure.ac +++ systemd-210/configure.ac @@ -902,25 +902,6 @@ if test "x$have_myhostname" != "xno"; th fi # ------------------------------------------------------------------------------ -AC_ARG_WITH(firmware-path, - AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], - [Firmware search path (default="")]), - [], [with_firmware_path=""]) -OLD_IFS=$IFS -IFS=: -for i in $with_firmware_path; do - if test "x${FIRMWARE_PATH}" = "x"; then - FIRMWARE_PATH="\\\"${i}/\\\"" - else - FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\"" - fi -done -IFS=$OLD_IFS -AC_SUBST(FIRMWARE_PATH) -AS_IF([test "x${FIRMWARE_PATH}" != "x"], [ AC_DEFINE(HAVE_FIRMWARE, 1, [Define if FIRMWARE is available]) ]) -AM_CONDITIONAL(ENABLE_FIRMWARE, [test "x${FIRMWARE_PATH}" != "x"]) - -# ------------------------------------------------------------------------------ AC_ARG_ENABLE([gudev], AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]), [], [enable_gudev=yes]) @@ -1137,7 +1118,6 @@ AC_MSG_RESULT([ Build Python: ${PYTHON} Installation Python: ${PYTHON_BINARY} sphinx binary: ${SPHINX_BUILD} - firmware path: ${FIRMWARE_PATH} PAM modules dir: ${with_pamlibdir} PAM configuration dir: ${with_pamconfdir} D-Bus policy dir: ${with_dbuspolicydir} Index: systemd-210/Makefile.am =================================================================== --- systemd-210.orig/Makefile.am +++ systemd-210/Makefile.am @@ -2677,18 +2677,6 @@ libudev_core_la_LIBADD = \ $(BLKID_LIBS) \ $(KMOD_LIBS) -libudev_core_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - -DFIRMWARE_PATH="$(FIRMWARE_PATH)" - -if ENABLE_FIRMWARE -libudev_core_la_SOURCES += \ - src/udev/udev-builtin-firmware.c - -dist_udevrules_DATA += \ - rules/50-firmware.rules -endif - if HAVE_KMOD libudev_core_la_SOURCES += \ src/udev/udev-builtin-kmod.c Index: systemd-210/README =================================================================== --- systemd-210.orig/README +++ systemd-210/README @@ -51,14 +51,14 @@ REQUIREMENTS: Linux kernel >= 3.8 for Smack support - Udev will fail to work with the legacy layout: + Udev will fail to work with the legacy sysfs layout: CONFIG_SYSFS_DEPRECATED=n Legacy hotplug slows down the system and confuses udev: CONFIG_UEVENT_HELPER_PATH="" - Userspace firmware loading is deprecated, will go away, and - sometimes causes problems: + Userspace firmware loading is not supported and should + be disabled in the kernel CONFIG_FW_LOADER_USER_HELPER=n Some udev rules and virtualization detection relies on it: Index: systemd-210/src/udev/udev-builtin.c =================================================================== --- systemd-210.orig/src/udev/udev-builtin.c +++ systemd-210/src/udev/udev-builtin.c @@ -34,9 +34,6 @@ static const struct udev_builtin *builti [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, #endif [UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs, -#ifdef HAVE_FIRMWARE - [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, -#endif [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb, [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, [UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard, Index: systemd-210/src/udev/udev-builtin-firmware.c =================================================================== --- systemd-210.orig/src/udev/udev-builtin-firmware.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * firmware - Kernel firmware loader - * - * Copyright (C) 2009 Piter Punk <piterpunk@slackware.com> - * Copyright (C) 2009-2011 Kay Sievers <kay@vrfy.org> - * - * 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:* - */ - -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <getopt.h> -#include <errno.h> -#include <stdbool.h> -#include <sys/utsname.h> -#include <sys/stat.h> - -#include "udev.h" - -static bool set_loading(struct udev *udev, char *loadpath, const char *state) -{ - FILE *ldfile; - - ldfile = fopen(loadpath, "we"); - if (ldfile == NULL) { - log_error("error: can not open '%s'", loadpath); - return false; - }; - fprintf(ldfile, "%s\n", state); - fclose(ldfile); - return true; -} - -static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) -{ - char *buf; - FILE *fsource = NULL, *ftarget = NULL; - bool ret = false; - - buf = malloc(size); - if (buf == NULL) { - log_error("No memory available to load firmware file"); - return false; - } - - log_debug("writing '%s' (%zi) to '%s'", source, size, target); - - fsource = fopen(source, "re"); - if (fsource == NULL) - goto exit; - ftarget = fopen(target, "we"); - if (ftarget == NULL) - goto exit; - if (fread(buf, size, 1, fsource) != 1) - goto exit; - if (fwrite(buf, size, 1, ftarget) == 1) - ret = true; -exit: - if (ftarget != NULL) - fclose(ftarget); - if (fsource != NULL) - fclose(fsource); - free(buf); - return ret; -} - -static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) -{ - struct udev *udev = udev_device_get_udev(dev); - static const char *searchpath[] = { FIRMWARE_PATH }; - char loadpath[UTIL_PATH_SIZE]; - char datapath[UTIL_PATH_SIZE]; - char fwpath[UTIL_PATH_SIZE]; - const char *firmware; - FILE *fwfile = NULL; - struct utsname kernel; - struct stat statbuf; - unsigned int i; - int rc = EXIT_SUCCESS; - - firmware = udev_device_get_property_value(dev, "FIRMWARE"); - if (firmware == NULL) { - log_error("firmware parameter missing"); - rc = EXIT_FAILURE; - goto exit; - } - - /* lookup firmware file */ - uname(&kernel); - for (i = 0; i < ELEMENTSOF(searchpath); i++) { - strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); - fwfile = fopen(fwpath, "re"); - if (fwfile != NULL) - break; - - strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); - fwfile = fopen(fwpath, "re"); - if (fwfile != NULL) - break; - } - - strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); - - if (fwfile == NULL) { - log_debug("did not find firmware file '%s'", firmware); - rc = EXIT_FAILURE; - /* - * Do not cancel the request in the initrd, the real root might have - * the firmware file and the 'coldplug' run in the real root will find - * this pending request and fulfill or cancel it. - * */ - if (!in_initrd()) - set_loading(udev, loadpath, "-1"); - goto exit; - } - - if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { - if (!in_initrd()) - set_loading(udev, loadpath, "-1"); - rc = EXIT_FAILURE; - goto exit; - } - - if (!set_loading(udev, loadpath, "1")) - goto exit; - - strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); - if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { - log_error("error sending firmware '%s' to device", firmware); - set_loading(udev, loadpath, "-1"); - rc = EXIT_FAILURE; - goto exit; - }; - - set_loading(udev, loadpath, "0"); -exit: - if (fwfile) - fclose(fwfile); - return rc; -} - -const struct udev_builtin udev_builtin_firmware = { - .name = "firmware", - .cmd = builtin_firmware, - .help = "kernel firmware loader", - .run_once = true, -}; Index: systemd-210/src/udev/udevd.c =================================================================== --- systemd-210.orig/src/udev/udevd.c +++ systemd-210/src/udev/udevd.c @@ -100,9 +100,6 @@ struct event { dev_t devnum; int ifindex; bool is_block; -#ifdef HAVE_FIRMWARE - bool nodelay; -#endif }; static inline struct event *node_to_event(struct udev_list_node *node) @@ -474,10 +471,6 @@ static int event_queue_insert(struct ude event->devnum = udev_device_get_devnum(dev); event->is_block = streq("block", udev_device_get_subsystem(dev)); event->ifindex = udev_device_get_ifindex(dev); -#ifdef HAVE_FIRMWARE - if (streq(udev_device_get_subsystem(dev), "firmware")) - event->nodelay = true; -#endif log_debug("seq %llu queued, '%s' '%s'", udev_device_get_seqnum(dev), udev_device_get_action(dev), udev_device_get_subsystem(dev)); @@ -557,12 +550,6 @@ static bool is_devpath_busy(struct event return true; } -#ifdef HAVE_FIRMWARE - /* allow to bypass the dependency tracking */ - if (event->nodelay) - continue; -#endif - /* parent device event found */ if (event->devpath[common] == '/') { event->delaying_seqnum = loop_event->seqnum; Index: systemd-210/src/udev/udev.h =================================================================== --- systemd-210.orig/src/udev/udev.h +++ systemd-210/src/udev/udev.h @@ -141,9 +141,6 @@ enum udev_builtin_cmd { UDEV_BUILTIN_BLKID, #endif UDEV_BUILTIN_BTRFS, -#ifdef HAVE_FIRMWARE - UDEV_BUILTIN_FIRMWARE, -#endif UDEV_BUILTIN_HWDB, UDEV_BUILTIN_INPUT_ID, UDEV_BUILTIN_KEYBOARD, @@ -172,9 +169,6 @@ struct udev_builtin { extern const struct udev_builtin udev_builtin_blkid; #endif extern const struct udev_builtin udev_builtin_btrfs; -#ifdef HAVE_FIRMWARE -extern const struct udev_builtin udev_builtin_firmware; -#endif extern const struct udev_builtin udev_builtin_hwdb; extern const struct udev_builtin udev_builtin_input_id; extern const struct udev_builtin udev_builtin_keyboard; Index: systemd-210/TODO =================================================================== --- systemd-210.orig/TODO +++ systemd-210/TODO @@ -541,7 +541,6 @@ Features: * ExecOnFailure=/usr/bin/foo * udev: - - remove src/udev/udev-builtin-firmware.c (CONFIG_FW_LOADER_USER_HELPER=n) - move to LGPL - kill scsi_id - add trigger --subsystem-match=usb/usb_device device ++++++ 1080-udevd-parse_argv-warn-if-argumens-are-invalid.patch ++++++ Based on 6f5cf8a8b1de763383f7382821147e538b7dbd6d Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 18 Sep 2014 19:02:03 +0200 Subject: [PATCH] udevd: parse_argv - warn if argumens are invalid Found by Coverity. Fixes CID #1238780. --- src/udev/udevd.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) --- src/udev/udevd.c +++ src/udev/udevd.c 2014-09-19 10:36:25.602735652 +0000 @@ -1002,11 +1002,20 @@ static void kernel_cmdline_options(struc log_set_max_level(prio); udev_set_log_priority(udev, prio); } else if (startswith(opt, "udev.children-max=")) { - children_max = strtoul(opt + 18, NULL, 0); + r = safe_atoi(opt + 18, &children_max); + if (r < 0) + log_warning("Invalid udev.children-max ignored: %s", opt + 18); } else if (startswith(opt, "udev.exec-delay=")) { - exec_delay = strtoul(opt + 16, NULL, 0); + r = safe_atoi(opt + 16, &exec_delay); + if (r < 0) + log_warning("Invalid udev.exec-delay ignored: %s", opt + 16); } else if (startswith(opt, "udev.event-timeout=")) { - event_timeout_usec = strtoul(opt + 16, NULL, 0) * USEC_PER_SEC; + r = safe_atou64(opt + 16, &event_timeout_usec); + if (r < 0) { + log_warning("Invalid udev.event-timeout ignored: %s", opt + 16); + break; + } + event_timeout_usec *= USEC_PER_SEC; event_timeout_warn_usec = (event_timeout_usec / 3) ? : 1; } @@ -1052,7 +1061,7 @@ int main(int argc, char *argv[]) { label_init("/dev"); for (;;) { - int option; + int option, r; option = getopt_long(argc, argv, "c:de:DtN:hV", options, NULL); if (option == -1) @@ -1063,14 +1072,23 @@ int main(int argc, char *argv[]) { daemonize = true; break; case 'c': - children_max = strtoul(optarg, NULL, 0); + r = safe_atoi(optarg, &children_max); + if (r < 0) + log_warning("Invalid --children-max ignored: %s", optarg); break; case 'e': - exec_delay = strtoul(optarg, NULL, 0); + r = safe_atoi(optarg, &exec_delay); + if (r < 0) + log_warning("Invalid --exec-delay ignored: %s", optarg); break; case 't': - event_timeout_usec = strtoul(optarg, NULL, 0) * USEC_PER_SEC; - event_timeout_warn_usec = (event_timeout_usec / 3) ? : 1; + r = safe_atou64(optarg, &event_timeout_usec); + if (r < 0) + log_warning("Invalig --event-timeout ignored: %s", optarg); + else { + event_timeout_usec *= USEC_PER_SEC; + event_timeout_warn_usec = (event_timeout_usec / 3) ? : 1; + } break; case 'D': debug = true; ++++++ 1081-udevd-check-return-of-various-functions.patch ++++++ Based on d457ff8319b1e7c522c146f75e272f1226f4720c Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 18 Sep 2014 19:07:02 +0200 Subject: [PATCH] udevd: check return of various functions One reported by Coverity. Fixes CID #996252. --- src/udev/udevd.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) --- src/udev/udevd.c +++ src/udev/udevd.c 2014-09-19 11:33:21.566236309 +0000 @@ -1044,7 +1044,7 @@ int main(int argc, char *argv[]) { int fd_worker = -1; struct epoll_event ep_ctrl, ep_inotify, ep_signal, ep_netlink, ep_worker; struct udev_ctrl_connection *ctrl_conn = NULL; - int rc = 1; + int rc = 1, r; udev = udev_new(); if (udev == NULL) @@ -1058,7 +1058,11 @@ int main(int argc, char *argv[]) { log_set_max_level(udev_get_log_priority(udev)); log_debug("version %s", VERSION); - label_init("/dev"); + r = label_init("/dev"); + if (r < 0) { + log_error("could not initialize labelling: %s", strerror(-r)); + goto exit; + } for (;;) { int option, r; @@ -1137,10 +1141,18 @@ int main(int argc, char *argv[]) { } /* set umask before creating any file/directory */ - chdir("/"); + r = chdir("/"); + if (r < 0) { + log_error("could not change dir to /: %m"); + goto exit; + } umask(022); - mkdir("/run/udev", 0755); + r = mkdir("/run/udev", 0755); + if (r < 0) { + log_error("could not create /run/udev: %m"); + goto exit; + } dev_setup(NULL); ++++++ 1082-udevadm-hwdb-check-return-value-of-fseeko.patch ++++++
From f901aaadd68050bc575c1c15b84f8f31fd4d494d Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 18 Sep 2014 19:16:54 +0200 Subject: [PATCH] udevadm: hwdb - check return value of fseeko()
Fonud by Coverity. Fixes CID #996255. --- src/udev/udevadm-hwdb.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git src/udev/udevadm-hwdb.c src/udev/udevadm-hwdb.c index 65cbf61..64273fb 100644 --- src/udev/udevadm-hwdb.c +++ src/udev/udevadm-hwdb.c @@ -365,7 +365,12 @@ static int trie_store(struct trie *trie, const char *filename) { fchmod(fileno(t.f), 0444); /* write nodes */ - fseeko(t.f, sizeof(struct trie_header_f), SEEK_SET); + err = fseeko(t.f, sizeof(struct trie_header_f), SEEK_SET); + if (err < 0) { + fclose(t.f); + unlink_noerrno(filename_tmp); + return -errno; + } root_off = trie_store_nodes(&t, trie->root); h.nodes_root_off = htole64(root_off); pos = ftello(t.f); @@ -378,7 +383,12 @@ static int trie_store(struct trie *trie, const char *filename) { /* write header */ size = ftello(t.f); h.file_size = htole64(size); - fseeko(t.f, 0, SEEK_SET); + err = fseeko(t.f, 0, SEEK_SET); + if (err < 0) { + fclose(t.f); + unlink_noerrno(filename_tmp); + return -errno; + } fwrite(&h, sizeof(struct trie_header_f), 1, t.f); err = ferror(t.f); if (err) -- 1.7.9.2 ++++++ 1083-udev-node-warn-if-chmod-chown-fails.patch ++++++
From 543afdc63c02a5af3cf6bd2a264162f23474346a Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 18 Sep 2014 19:22:09 +0200 Subject: [PATCH] udev: node - warn if chmod/chown fails
No functional change, just log the warning. Fonud by Coverity. Fixes CID #1237544. --- src/udev/udev-node.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git src/udev/udev-node.c src/udev/udev-node.c index c164603..8ef7889 100644 --- src/udev/udev-node.c +++ src/udev/udev-node.c @@ -281,8 +281,12 @@ static int node_permissions_apply(struct udev_device *dev, bool apply, if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) { log_debug("set permissions %s, %#o, uid=%u, gid=%u", devnode, mode, uid, gid); - chmod(devnode, mode); - chown(devnode, uid, gid); + err = chmod(devnode, mode); + if (err < 0) + log_warning("setting mode of %s to %#o failed: %m", devnode, mode); + err = chown(devnode, uid, gid); + if (err < 0) + log_warning("setting owner of %s to uid=%u, gid=%u failed: %m", devnode, uid, gid); } else { log_debug("preserve permissions %s, %#o, uid=%u, gid=%u", devnode, mode, uid, gid); } -- 1.7.9.2 ++++++ 1084-udev-ctrl-log-if-setting-SO_PASSCRED-fails.patch ++++++ Based on 4bbdff757ed4e718a3348b93439a03055cc5e3bc Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 18 Sep 2014 19:26:11 +0200 Subject: [PATCH] udev: ctrl - log if setting SO_PASSCRED fails No functional change. Found by Coverity. Fixes CID #1237533. --- src/udev/udev-ctrl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- src/udev/udev-ctrl.c +++ src/udev/udev-ctrl.c 2014-09-19 10:45:55.494236229 +0000 @@ -74,6 +74,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd( { struct udev_ctrl *uctrl; const int on = 1; + int r; uctrl = new0(struct udev_ctrl, 1); if (uctrl == NULL) @@ -92,7 +93,9 @@ struct udev_ctrl *udev_ctrl_new_from_fd( uctrl->bound = true; uctrl->sock = fd; } - setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + r = setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + if (r < 0) + log_warning("could not set SO_PASSCRED: %m"); uctrl->saddr.sun_family = AF_LOCAL; strscpy(uctrl->saddr.sun_path, sizeof(uctrl->saddr.sun_path), "/run/udev/control"); @@ -209,7 +212,10 @@ struct udev_ctrl_connection *udev_ctrl_g } /* enable receiving of the sender credentials in the messages */ - setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + r = setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + if (r < 0) + log_warning("colud not set SO_PASSCRED: %m"); + udev_ctrl_ref(uctrl); return conn; err: ++++++ 1085-udev-fix-typos.patch ++++++ Based on 65fea570f03df51dadc06a3e0d261a71fe62aa01 Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 18 Sep 2014 20:25:33 +0200 Subject: [PATCH] udev: fix typos Spotted by Andreas Henriksson. --- src/udev/udev-ctrl.c | 2 +- src/udev/udevd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- src/udev/udev-ctrl.c +++ src/udev/udev-ctrl.c 2014-09-19 00:00:00.000000000 +0000 @@ -214,7 +214,7 @@ struct udev_ctrl_connection *udev_ctrl_g /* enable receiving of the sender credentials in the messages */ r = setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); if (r < 0) - log_warning("colud not set SO_PASSCRED: %m"); + log_warning("could not set SO_PASSCRED: %m"); udev_ctrl_ref(uctrl); return conn; --- src/udev/udevd.c +++ src/udev/udevd.c 2014-09-19 10:47:36.306235720 +0000 @@ -1088,7 +1088,7 @@ int main(int argc, char *argv[]) { case 't': r = safe_atou64(optarg, &event_timeout_usec); if (r < 0) - log_warning("Invalig --event-timeout ignored: %s", optarg); + log_warning("Invalid --event-timeout ignored: %s", optarg); else { event_timeout_usec *= USEC_PER_SEC; event_timeout_warn_usec = (event_timeout_usec / 3) ? : 1; ++++++ 1086-udevd-don-t-fail-if-run-udev-exists.patch ++++++
From 25773e7fc59b4ce53d67da4e18bfe4d13ab0b14b Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Thu, 18 Sep 2014 21:57:49 +0200 Subject: [PATCH] udevd: don't fail if /run/udev exists
--- src/udev/udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git src/udev/udevd.c src/udev/udevd.c index 37db81c..29ccb51 100644 --- src/udev/udevd.c +++ src/udev/udevd.c @@ -1155,7 +1155,7 @@ int main(int argc, char *argv[]) { umask(022); r = mkdir("/run/udev", 0755); - if (r < 0) { + if (r < 0 && errno != EEXIST) { log_error("could not create /run/udev: %m"); goto exit; } -- 1.7.9.2 ++++++ 1087-infinit-timeout-for-kmod-loaded-modules.patch ++++++ --- src/udev/udev-event.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/udev/udev.h | 1 + src/udev/udevd.c | 23 +++++++++++++++++++++-- 3 files changed, 64 insertions(+), 2 deletions(-) --- src/udev/udev-event.c +++ src/udev/udev-event.c 2014-09-24 14:32:53.115639820 +0000 @@ -959,6 +959,46 @@ void udev_event_execute_rules(struct ude } } +#ifdef HAVE_KMOD +static inline void udev_check_and_set_kmod(enum udev_builtin_cmd builtin_cmd, struct udev_event *event) { + char filename[UTIL_PATH_SIZE]; + switch (builtin_cmd) { + case UDEV_BUILTIN_KMOD: + snprintf(filename, sizeof(filename), "/run/udev/kmod/%u", (unsigned)getpid()); + touch(filename); + default: + break; + } +} + +static inline void udev_check_and_unset_kmod(enum udev_builtin_cmd builtin_cmd, struct udev_event *event) { + char filename[UTIL_PATH_SIZE]; + switch (builtin_cmd) { + case UDEV_BUILTIN_KMOD: + snprintf(filename, sizeof(filename), "/run/udev/kmod/%u", (unsigned)getpid()); + unlink(filename); + default: + break; + } +} + +bool udev_check_for_kmod(pid_t pid) { + char filename[UTIL_PATH_SIZE]; + struct stat st; + snprintf(filename, sizeof(filename), "/run/udev/kmod/%u", (unsigned)pid); + if (stat(filename, &st) == 0) { + return true; + } + return false; +} +#else +# define udev_set_kmod (a,b) +# define udev_unset_kmod(a,b) +bool udev_check_for_kmod(pid_t pid) { + return false; +} +#endif + void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, const sigset_t *sigmask) { struct udev_list_entry *list_entry; @@ -970,7 +1010,9 @@ void udev_event_execute_run(struct udev_ char command[UTIL_PATH_SIZE]; udev_event_apply_format(event, cmd, command, sizeof(command)); + udev_check_and_set_kmod(builtin_cmd, event); udev_builtin_run(event->dev, builtin_cmd, command, false); + udev_check_and_unset_kmod(builtin_cmd, event); } else { char program[UTIL_PATH_SIZE]; char **envp; --- src/udev/udevd.c +++ src/udev/udevd.c 2014-09-24 15:02:30.895592379 +0000 @@ -76,6 +76,7 @@ static int children_max; static int exec_delay; static usec_t event_timeout_usec = 180 * USEC_PER_SEC; static usec_t event_timeout_warn_usec = 180 * USEC_PER_SEC / 3; +static bool event_killkmod = false; static sigset_t sigmask_orig; static UDEV_LIST(event_list); static UDEV_LIST(worker_list); @@ -1017,6 +1018,12 @@ static void kernel_cmdline_options(struc } event_timeout_usec *= USEC_PER_SEC; event_timeout_warn_usec = (event_timeout_usec / 3) ? : 1; + } else if (startswith(opt, "udev.killkmod=")) { + r = parse_boolean(opt + 14); + if (r < 0) + log_warning("Invalid udev.killkmod Ignoring: %s", opt + 14); + else + event_killkmod = r; } free(s); @@ -1065,7 +1072,7 @@ int main(int argc, char *argv[]) { } for (;;) { - int option, r; + int option; option = getopt_long(argc, argv, "c:de:DtN:hV", options, NULL); if (option == -1) @@ -1356,6 +1363,12 @@ int main(int argc, char *argv[]) { udev_list_node_init(&event_list); udev_list_node_init(&worker_list); + r = mkdir_p("/run/udev/kmod", 0755); + if (r < 0 && errno != EEXIST) { + log_error("could not create /run/udev/kmod: %m"); + goto exit; + } + for (;;) { static usec_t last_usec; struct epoll_event ev[8]; @@ -1440,7 +1453,13 @@ int main(int argc, char *argv[]) { if (worker->state != WORKER_RUNNING) continue; - +#ifdef HAVE_KMOD + if (udev_check_for_kmod(worker->pid)) { + log_debug("worker [%u] %s is using kmod", worker->pid, worker->event->devpath); + if (!event_killkmod) + continue; + } +#endif ts = now(CLOCK_MONOTONIC); if ((ts - worker->event_start_usec) > event_timeout_warn_usec) { --- src/udev/udev.h +++ src/udev/udev.h 2014-09-24 14:33:33.824008084 +0000 @@ -88,6 +88,7 @@ int udev_event_spawn(struct udev_event * char *result, size_t ressize); void udev_event_execute_rules(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, struct udev_rules *rules, const sigset_t *sigset); +bool udev_check_for_kmod(pid_t pid); void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec, const sigset_t *sigset); int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]); ++++++ 1089-fix-cgroup-device-controller.patch ++++++
From eb0f0863f5af48865fb4569e2076d5f9e2313995 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Mon, 10 Mar 2014 21:36:01 +0100 Subject: nspawn: don't try mknod() of /dev/console with the correct major/minor
We overmount /dev/console with an external pty anyway, hence there's no point in using the real major/minor when we create the node to overmount. Instead, use the one of /dev/null now. This fixes a race against the cgroup device controller setup we are using. In case /dev/console was create before the cgroup policy was applied all was good, but if created in the opposite order the mknod() would fail, since creating /dev/console is not allowed by it. Creating /dev/null instances is however permitted, and hence use it. diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index d8d0dae..bef866a 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -879,23 +879,19 @@ static int setup_ptmx(const char *dest) { } static int setup_dev_console(const char *dest, const char *console) { + _cleanup_umask_ mode_t u; + const char *to; struct stat st; - _cleanup_free_ char *to = NULL; int r; - _cleanup_umask_ mode_t u; assert(dest); assert(console); u = umask(0000); - if (stat(console, &st) < 0) { - log_error("Failed to stat %s: %m", console); + if (stat("/dev/null", &st) < 0) { + log_error("Failed to stat /dev/null: %m"); return -errno; - - } else if (!S_ISCHR(st.st_mode)) { - log_error("/dev/console is not a char device"); - return -EIO; } r = chmod_and_chown(console, 0600, 0, 0); @@ -904,16 +900,15 @@ static int setup_dev_console(const char *dest, const char *console) { return r; } - if (asprintf(&to, "%s/dev/console", dest) < 0) - return log_oom(); - /* We need to bind mount the right tty to /dev/console since * ptys can only exist on pts file systems. To have something - * to bind mount things on we create a device node first, that - * has the right major/minor (note that the major minor - * doesn't actually matter here, since we mount it over - * anyway). */ + * to bind mount things on we create a device node first, and + * use /dev/null for that since we the cgroups device policy + * allows us to create that freely, while we cannot create + * /dev/console. (Note that the major minor doesn't actually + * matter here, since we mount it over anyway). */ + to = strappenda(dest, "/dev/console"); if (mknod(to, (st.st_mode & ~07777) | 0600, st.st_rdev) < 0) { log_error("mknod() for /dev/console failed: %m"); return -errno; -- cgit v0.10.2 ++++++ 1090-udev-path_id-set-supported_parent-for-well-known-SCS.patch ++++++ Based on cc821d02a37c8c76aaf15bae2d33fee1bdc4b2e0 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Tue, 28 Oct 2014 16:50:24 +0100 Subject: [PATCH] udev: path_id - set supported_parent for well-known SCSI setups --- src/udev/udev-builtin-path_id.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- src/udev/udev-builtin-path_id.c +++ src/udev/udev-builtin-path_id.c 2014-11-03 14:12:48.129956655 +0000 @@ -379,7 +379,7 @@ out: return hostdev; } -static struct udev_device *handle_scsi(struct udev_device *parent, char **path) +static struct udev_device *handle_scsi(struct udev_device *parent, char **path, bool *supported_parent) { const char *devtype; const char *name; @@ -394,6 +394,7 @@ static struct udev_device *handle_scsi(s if (id != NULL) { parent = skip_subsystem(parent, "scsi"); path_prepend(path, "ieee1394-0x%s", id); + *supported_parent = true; goto out; } @@ -402,16 +403,19 @@ static struct udev_device *handle_scsi(s if (strstr(name, "/rport-") != NULL) { parent = handle_scsi_fibre_channel(parent, path); + *supported_parent = true; goto out; } if (strstr(name, "/end_device-") != NULL) { parent = handle_scsi_sas(parent, path); + *supported_parent = true; goto out; } if (strstr(name, "/session") != NULL) { parent = handle_scsi_iscsi(parent, path); + *supported_parent = true; goto out; } @@ -545,7 +549,7 @@ static int builtin_path_id(struct udev_d } else if (streq(subsys, "scsi_tape")) { handle_scsi_tape(parent, &path); } else if (streq(subsys, "scsi")) { - parent = handle_scsi(parent, &path); + parent = handle_scsi(parent, &path, &supported_parent); supported_transport = true; } else if (streq(subsys, "cciss")) { parent = handle_cciss(parent, &path); ++++++ 1091-udev-path_id-update-comments.patch ++++++
From a42cdff19f2d34f12ceca0f40707421a8aaa2c2f Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Thu, 30 Oct 2014 01:18:34 +0100 Subject: [PATCH] udev: path_id - update comments
--- src/udev/udev-builtin-path_id.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git src/udev/udev-builtin-path_id.c src/udev/udev-builtin-path_id.c index 0d247f6..df996cb 100644 --- src/udev/udev-builtin-path_id.c +++ src/udev/udev-builtin-path_id.c @@ -548,9 +548,9 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool } /* - * Do return devices with have an unknown type of parent device, they - * might produce conflicting IDs below multiple independent parent - * devices. + * Do not return devices with an unknown parent device type. They + * might produce conflicting IDs if the parent does not provide a + * unique and predictable name. */ if (!supported_parent) { free(path); @@ -558,9 +558,9 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool } /* - * Do not return a have-only a single-parent block devices, some - * have entire hidden buses behind it, and not create predictable - * IDs that way. + * Do not return block devices without a well-known transport. Some + * devices do not expose their buses and do not provide a unique + * and predictable name that way. */ if (streq(udev_device_get_subsystem(dev), "block") && !supported_transport) { free(path); -- 1.7.9.2 ++++++ 1092-libudev-do-not-accept-invalid-log-levels.patch ++++++ Based on ee7122c0ec6aa11f02e9e8d94254b353f12d2c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sat, 1 Nov 2014 12:06:41 -0400 Subject: [PATCH] libudev: do not accept invalid log levels Invalid log levels lead to a assert failure later on. https://bugs.freedesktop.org/show_bug.cgi?id=85657 --- src/libudev/libudev-util.c | 10 +++++++--- src/libudev/libudev.c | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) --- src/libudev/libudev-util.c +++ src/libudev/libudev-util.c 2014-11-10 11:33:26.269519209 +0000 @@ -255,9 +255,13 @@ int util_log_priority(const char *priori char *endptr; int prio; - prio = strtol(priority, &endptr, 10); - if (endptr[0] == '\0' || isspace(endptr[0])) - return prio; + prio = strtoul(priority, &endptr, 10); + if (endptr[0] == '\0' || isspace(endptr[0])) { + if (prio >= 0 && prio <= 7) + return prio; + else + return -ERANGE; + } if (startswith(priority, "err")) return LOG_ERR; if (startswith(priority, "info")) --- src/libudev/libudev.c +++ src/libudev/libudev.c @@ -193,7 +193,13 @@ _public_ struct udev *udev_new(void) } if (streq(key, "udev_log")) { - udev_set_log_priority(udev, util_log_priority(val)); + int prio; + + prio = util_log_priority(val); + if (prio < 0) + udev_err(udev, "/etc/udev/udev.conf:%u: invalid logging level '%s', ignoring.\n", line_nr, val); + else + udev_set_log_priority(udev, prio); continue; } } @@ -201,8 +207,15 @@ _public_ struct udev *udev_new(void) /* environment overrides config */ env = secure_getenv("UDEV_LOG"); - if (env != NULL) - udev_set_log_priority(udev, util_log_priority(env)); + if (env != NULL) { + int prio; + + prio = util_log_priority(env); + if (prio < 0) + udev_err(udev, "$UDEV_LOG specifies invalid logging level '%s', ignoring.\n", env); + else + udev_set_log_priority(udev, prio); + } return udev; } ++++++ 1093-udev-Fix-parsing-of-udev.event-timeout-kernel-parame.patch ++++++ Based on f671774f52838d35d78e62ddcb781b5b65b3373f Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" <rjones@redhat.com> Date: Tue, 4 Nov 2014 23:45:15 +0000 Subject: [PATCH] udev: Fix parsing of udev.event-timeout kernel parameter. --- src/udev/udevd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- src/udev/udevd.c +++ src/udev/udevd.c 2014-11-10 12:28:20.385559165 +0000 @@ -1011,9 +1011,9 @@ static void kernel_cmdline_options(struc if (r < 0) log_warning("Invalid udev.exec-delay ignored: %s", opt + 16); } else if (startswith(opt, "udev.event-timeout=")) { - r = safe_atou64(opt + 16, &event_timeout_usec); + r = safe_atou64(opt + 19, &event_timeout_usec); if (r < 0) { - log_warning("Invalid udev.event-timeout ignored: %s", opt + 16); + log_warning("Invalid udev.event-timeout ignored: %s", opt + 19); break; } event_timeout_usec *= USEC_PER_SEC; ++++++ 1094-udev-avoid-magic-constants-in-kernel-cmdline-parsers.patch ++++++ Based on cfe2061add5479710f6597899d632e64c54e62ef Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrmann@gmail.com> Date: Wed, 5 Nov 2014 12:56:49 +0100 Subject: [PATCH] udev: avoid magic constants in kernel-cmdline parsers Lets recognize the fact that startswith() returns a pointer to the tail on success. Use it instead of hard-coding string-lengths as magic constants. --- src/udev/udevd.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) --- src/udev/udevd.c +++ src/udev/udevd.c 2014-11-10 12:31:15.745519116 +0000 @@ -984,7 +984,7 @@ static void kernel_cmdline_options(struc return; FOREACH_WORD_QUOTED(w, l, line, state) { - char *s, *opt; + char *s, *opt, *value; s = strndup(w, l); if (!s) @@ -996,24 +996,24 @@ static void kernel_cmdline_options(struc else opt = s; - if (startswith(opt, "udev.log-priority=")) { + if ((value = startswith(opt, "udev.log-priority="))) { int prio; - prio = util_log_priority(opt + 18); + prio = util_log_priority(value); log_set_max_level(prio); udev_set_log_priority(udev, prio); - } else if (startswith(opt, "udev.children-max=")) { - r = safe_atoi(opt + 18, &children_max); + } else if ((value = startswith(opt, "udev.children-max="))) { + r = safe_atoi(value, &children_max); if (r < 0) - log_warning("Invalid udev.children-max ignored: %s", opt + 18); - } else if (startswith(opt, "udev.exec-delay=")) { - r = safe_atoi(opt + 16, &exec_delay); + log_warning("Invalid udev.children-max ignored: %s", value); + } else if ((value = startswith(opt, "udev.exec-delay="))) { + r = safe_atoi(value, &exec_delay); if (r < 0) - log_warning("Invalid udev.exec-delay ignored: %s", opt + 16); - } else if (startswith(opt, "udev.event-timeout=")) { - r = safe_atou64(opt + 19, &event_timeout_usec); + log_warning("Invalid udev.exec-delay ignored: %s", value); + } else if ((value = startswith(opt, "udev.event-timeout="))) { + r = safe_atou64(value, &event_timeout_usec); if (r < 0) { - log_warning("Invalid udev.event-timeout ignored: %s", opt + 19); + log_warning("Invalid udev.event-timeout ignored: %s", value); break; } event_timeout_usec *= USEC_PER_SEC; ++++++ 1095-set-ssd-disk-to-use-deadline-scheduler.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:04.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:04.000000000 +0100 @@ -1,24 +1,19 @@ ---- - Makefile.am | 1 + - rules/60-ssd-scheduler.rules | 11 +++++++++++ - 2 files changed, 12 insertions(+) - -Index: systemd/Makefile.am +Index: systemd-210/Makefile.am =================================================================== ---- systemd.orig/Makefile.am -+++ systemd/Makefile.am -@@ -3576,6 +3576,7 @@ dist_udevrules_DATA += \ +--- systemd-210.orig/Makefile.am ++++ systemd-210/Makefile.am +@@ -2546,6 +2546,7 @@ dist_udevrules_DATA += \ rules/60-persistent-input.rules \ rules/60-persistent-alsa.rules \ rules/60-persistent-storage.rules \ + rules/60-ssd-scheduler.rules \ rules/64-btrfs.rules \ - rules/70-mouse.rules \ - rules/70-touchpad.rules \ -Index: systemd/rules/60-ssd-scheduler.rules + rules/75-net-description.rules \ + rules/75-tty-description.rules \ +Index: systemd-210/rules/60-ssd-scheduler.rules =================================================================== --- /dev/null -+++ systemd/rules/60-ssd-scheduler.rules ++++ systemd-210/rules/60-ssd-scheduler.rules @@ -0,0 +1,11 @@ +# do not edit this file, it will be overwritten on update + ++++++ 1096-new-udev-root-symlink-generator.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:04.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:04.000000000 +0100 @@ -1,16 +1,9 @@ ---- - Makefile.am | 19 +++++ - src/udev/rootsymlink_generator/rootsymlink_generator.c | 57 +++++++++++++++++ - units/systemd-udev-root-symlink.service | 10 ++ - units/systemd-udev-root-symlink.service.in | 10 ++ - 4 files changed, 96 insertions(+) - -Index: systemd/Makefile.am +Index: systemd-210/Makefile.am =================================================================== ---- systemd.orig/Makefile.am -+++ systemd/Makefile.am -@@ -3862,6 +3862,25 @@ EXTRA_DIST += \ - +--- systemd-210.orig/Makefile.am ++++ systemd-210/Makefile.am +@@ -2791,6 +2791,25 @@ EXTRA_DIST += \ + test/rule-syntax-check.py # ------------------------------------------------------------------------------ +rootsymlink_generator_SOURCES = \ @@ -35,11 +28,11 @@ ata_id_SOURCES = \ src/udev/ata_id/ata_id.c -Index: systemd/src/udev/rootsymlink_generator/rootsymlink_generator.c +Index: systemd-210/src/udev/rootsymlink_generator/rootsymlink_generator.c =================================================================== --- /dev/null -+++ systemd/src/udev/rootsymlink_generator/rootsymlink_generator.c -@@ -0,0 +1,57 @@ ++++ systemd-210/src/udev/rootsymlink_generator/rootsymlink_generator.c +@@ -0,0 +1,65 @@ +/* + * Copyright (C) 2014-2015 Robert Milasan <rmilasan@suse.com> + * @@ -71,36 +64,44 @@ +#define _PATH_ "/run/udev/rules.d" +#define _FILE_ "10-root-symlink.rules" + -+int main(void) ++int main() +{ -+ char filename[BUFFER_SIZE], buf[BUFFER_SIZE]; + struct stat statbuf; -+ int fd; + -+ if (stat(_ROOTDEV_, &statbuf) < 0) ++ if (stat(_ROOTDEV_, &statbuf) != 0) + return 1; -+ if (major(statbuf.st_dev) <= 0) -+ return 0; -+ if (mkdir(_PATH_, 0755) < 0 && errno != EEXIST) -+ return errno; -+ snprintf(filename, BUFFER_SIZE, "%s/%s", _PATH_, _FILE_); -+ fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0644); -+ if (fd < 0) -+ return errno; -+ snprintf(buf, BUFFER_SIZE, -+ "ACTION==\"add|change\", SUBSYSTEM==\"block\", " -+ "ENV{MAJOR}==\"%d\", ENV{MINOR}==\"%d\", SYMLINK+=\"root\"\n", -+ major(statbuf.st_dev), minor(statbuf.st_dev)); -+ if (write(fd, buf, strlen(buf)) < 0) -+ return errno; -+ if (close(fd) < 0) -+ return errno; ++ ++ if (major(statbuf.st_dev) > 0) { ++ int fd = -1; ++ char filename[BUFFER_SIZE]; ++ ++ if (mkdir(_PATH_, 0755) != 0 && errno != EEXIST) ++ return errno; ++ ++ snprintf(filename, BUFFER_SIZE, "%s/%s", _PATH_, _FILE_); ++ ++ if ((fd = open(filename, O_CREAT|O_WRONLY|O_TRUNC, 0644)) == -1) ++ return errno; ++ else { ++ char buf[BUFFER_SIZE]; ++ ++ snprintf(buf, BUFFER_SIZE, "ACTION==\"add|change\", SUBSYSTEM==\"block\", ENV{MAJOR}==\"%d\", ENV{MINOR}==\"%d\", SYMLINK+=\"root\"\n", ++ major(statbuf.st_dev), minor(statbuf.st_dev)); ++ ++ if (write(fd, buf, strlen(buf)) == -1) ++ return errno; ++ ++ if (close(fd) == -1) ++ return errno; ++ } ++ } ++ + return 0; +} -Index: systemd/units/systemd-udev-root-symlink.service +Index: systemd-210/units/systemd-udev-root-symlink.service.in =================================================================== --- /dev/null -+++ systemd/units/systemd-udev-root-symlink.service ++++ systemd-210/units/systemd-udev-root-symlink.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=Rule generator for /dev/root symlink @@ -111,11 +112,11 @@ +[Service] +Type=oneshot +RemainAfterExit=yes -+ExecStart=/usr/lib/udev/rootsymlink-generator -Index: systemd/units/systemd-udev-root-symlink.service.in ++ExecStart=@udevlibexec@/rootsymlink-generator +Index: systemd-210/units/systemd-udev-root-symlink.service =================================================================== --- /dev/null -+++ systemd/units/systemd-udev-root-symlink.service.in ++++ systemd-210/units/systemd-udev-root-symlink.service @@ -0,0 +1,10 @@ +[Unit] +Description=Rule generator for /dev/root symlink @@ -126,4 +127,4 @@ +[Service] +Type=oneshot +RemainAfterExit=yes -+ExecStart=@udevlibexec@/rootsymlink-generator ++ExecStart=/usr/lib/udev/rootsymlink-generator ++++++ 1097-udevd-increase-maximum-number-of-children.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:04.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:04.000000000 +0100 @@ -1,26 +1,22 @@ ---- - src/udev/udevd.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -Index: systemd-218/src/udev/udevd.c +Index: systemd-210/src/udev/udevd.c =================================================================== ---- systemd-218.orig/src/udev/udevd.c -+++ systemd-218/src/udev/udevd.c -@@ -446,7 +446,7 @@ static void event_run(struct event *even +--- systemd-210.orig/src/udev/udevd.c ++++ systemd-210/src/udev/udevd.c +@@ -454,7 +454,7 @@ static void event_run(struct event *even - if (children >= arg_children_max) { - if (arg_children_max > 1) + if (children >= children_max) { + if (children_max > 1) - log_debug("maximum number (%i) of children reached", children); + log_error("maximum number (%i) of children reached", children); return; } -@@ -1265,7 +1265,7 @@ int main(int argc, char *argv[]) { - arg_children_max = 8; +@@ -1277,7 +1277,7 @@ int main(int argc, char *argv[]) { + children_max = 8; if (sched_getaffinity(0, sizeof (cpu_set), &cpu_set) == 0) { -- arg_children_max += CPU_COUNT(&cpu_set) * 2; -+ arg_children_max += CPU_COUNT(&cpu_set) * 64; +- children_max += CPU_COUNT(&cpu_set) * 2; ++ children_max += CPU_COUNT(&cpu_set) * 64; } } - log_debug("set children_max to %u", arg_children_max); + log_debug("set children_max to %u", children_max); ++++++ 1098-udev-link_setup-respect-kernel-name-assign-policy.patch ++++++ Based on 04b67d49254d956d31bcfe80340fb9df7ed332d3 Mon Sep 17 00:00:00 2001 From: Tom Gundersen <teg@jklm.no> Date: Tue, 15 Jul 2014 17:57:43 +0200 Subject: [PATCH] udev: link_setup - respect kernel name assign policy Newer kernels export meta-information about the origin of an ifname. Respect this from the ifname rename logic. We do not rename any interfaces that was originally named by userspace, nor once which have already been renamed from userspace. Moreover, we optionally do not (the default) rename interfaces which the kernel claims to have named in a predictable way. --- man/udev.xml | 13 ++++++++++- network/99-default.link | 2 - src/shared/missing.h | 21 +++++++++++++++++ src/udev/net/link-config.c | 53 +++++++++++++++++++++++++++++++++++++-------- src/udev/net/link-config.h | 1 5 files changed, 79 insertions(+), 11 deletions(-) Index: man/udev.xml =================================================================== --- man/udev.xml.orig +++ man/udev.xml @@ -914,10 +914,12 @@ successful one is used. The name is not set directly, but is exported to udev as the property <literal>ID_NET_NAME</literal>, which is, by default, used by a udev rule to set - <literal>NAME</literal>. The available policies are: + <literal>NAME</literal>. If the name has already + been set by userspace, no renaming is performed. + The available policies are: </para> <variablelist> - <varlistentry> + <varlistentry> <term><literal>database</literal></term> <listitem> <para>The name is set based on entries in the Hardware Index: src/shared/missing.h =================================================================== --- src/shared/missing.h.orig +++ src/shared/missing.h @@ -362,3 +362,24 @@ static inline int setns(int fd, int nsty return syscall(__NR_setns, fd, nstype); } #endif + +#ifndef NET_ADDR_RANDOM +# define NET_ADDR_RANDOM 1 +#endif + +#ifndef NET_NAME_ENUM +# define NET_NAME_ENUM 1 +#endif + +#ifndef NET_NAME_PREDICTABLE +# define NET_NAME_PREDICTABLE 2 +#endif + +#ifndef NET_NAME_USER +# define NET_NAME_USER 3 +#endif + +#ifndef NET_NAME_RENAMED +# define NET_NAME_RENAMED 4 +#endif + Index: src/udev/net/link-config.c =================================================================== --- src/udev/net/link-config.c.orig +++ src/udev/net/link-config.c @@ -20,10 +20,11 @@ ***/ #include <netinet/ether.h> -#include <net/if.h> +#include <linux/netdevice.h> #include "sd-id128.h" +#include "missing.h" #include "link-config.h" #include "ethtool-util.h" @@ -297,23 +298,30 @@ static bool mac_is_random(struct udev_de return false; /* check for NET_ADDR_RANDOM */ - return type == 1; + return type == NET_ADDR_RANDOM; } -static bool mac_is_permanent(struct udev_device *device) { +static bool should_rename(struct udev_device *device) { const char *s; unsigned type; int r; - s = udev_device_get_sysattr_value(device, "addr_assign_type"); + s = udev_device_get_sysattr_value(device, "name_assign_type"); if (!s) - return true; /* if we don't know, assume it is permanent */ + return true; /* if we don't know, assume we should rename */ r = safe_atou(s, &type); if (r < 0) return true; - /* check for NET_ADDR_PERM */ - return type == 0; + switch (type) { + case NET_NAME_USER: + case NET_NAME_RENAMED: + return false; /* these were already named by userspace, do not touch again */ + case NET_NAME_PREDICTABLE: + case NET_NAME_ENUM: + default: + return true; /* the name is known to be bad, or of an unknown type */ + } } #define HASH_KEY SD_ID128_MAKE(d3,1e,48,fa,90,fe,4b,4c,9d,af,d5,d7,a1,b1,2e,8a) @@ -429,16 +437,16 @@ int link_config_apply(link_config_ctx *c } } - if (new_name) - *name = new_name; /* a name was set by a policy */ - else if (config->name) - *name = config->name; /* a name was set manually in the config */ - else - *name = NULL; + if (should_rename(device)) { + if (!new_name) + /* if not set by policy, fall back manually set name */ + new_name = config->name; + } else + new_name = NULL; switch (config->mac_policy) { case MACPOLICY_PERSISTENT: - if (!mac_is_permanent(device)) { + if (mac_is_random(device)) { r = get_mac(device, false, &generated_mac); if (r == -ENOENT) break; @@ -467,6 +475,8 @@ int link_config_apply(link_config_ctx *c return r; } + *name = new_name; + return 0; } ++++++ 513-nspawn-veth.patch ++++++ diff -Naur systemd-210/src/libsystemd/sd-rtnl/rtnl-message.c systemd-210.mod/src/libsystemd/sd-rtnl/rtnl-message.c --- systemd-210/src/libsystemd/sd-rtnl/rtnl-message.c 2014-11-19 13:10:23.998310815 +0100 +++ systemd-210.mod/src/libsystemd/sd-rtnl/rtnl-message.c 2014-12-08 12:03:18.059734333 +0100 @@ -722,6 +722,7 @@ int sd_rtnl_message_open_container(sd_rtnl_message *m, unsigned short type) { uint16_t rtm_type; + int r; assert_return(m, -EINVAL); assert_return(!m->sealed, -EPERM); @@ -729,15 +730,21 @@ sd_rtnl_message_get_type(m, &rtm_type); if (rtnl_message_type_is_link(rtm_type)) { - if ((type == IFLA_LINKINFO && m->n_containers == 0) || (type == IFLA_INFO_DATA && m->n_containers == 1 && - GET_CONTAINER(m, 0)->rta_type == IFLA_LINKINFO)) - return add_rtattr(m, type, NULL, 0); - else if (type == VETH_INFO_PEER && m->n_containers == 2 && + GET_CONTAINER(m, 0)->rta_type == IFLA_LINKINFO)) { + r = add_rtattr(m, type, NULL, 0); + if ( r > 0) + m->container_offsets[m->n_containers ++] = r; + return r; + } else if (type == VETH_INFO_PEER && m->n_containers == 2 && GET_CONTAINER(m, 1)->rta_type == IFLA_INFO_DATA && - GET_CONTAINER(m, 0)->rta_type == IFLA_LINKINFO) - return add_rtattr(m, type, NULL, sizeof(struct ifinfomsg)); + GET_CONTAINER(m, 0)->rta_type == IFLA_LINKINFO) { + r = add_rtattr(m, type, NULL, sizeof(struct ifinfomsg)); + if ( r > 0) + m->container_offsets[m->n_containers ++] = r; + return r; + } } return -ENOTSUP; ++++++ Fix-run-lock-directories-permissions-to-follow-openSUSE-po.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -5,21 +5,18 @@ disable /var/lock/{subsys,lockdev} and change default permissions on /var/lock (bnc#733523). --- - tmpfiles.d/legacy.conf | 7 ++++--- + tmpfiles.d/legacy.conf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -Index: systemd-218/tmpfiles.d/legacy.conf -=================================================================== ---- systemd-218.orig/tmpfiles.d/legacy.conf -+++ systemd-218/tmpfiles.d/legacy.conf -@@ -10,13 +10,14 @@ +--- systemd-206_git201308300826.orig/tmpfiles.d/legacy.conf ++++ systemd-206_git201308300826/tmpfiles.d/legacy.conf +@@ -10,12 +10,13 @@ # These files are considered legacy and are unnecessary on legacy-free # systems. -d /run/lock 0755 root root - -+# changed for openSUSE: only /run/lock should be available. ++# changed for openSUSE : only /run/lock should be available +d /run/lock 0775 root lock - - L /var/lock - - - - ../run/lock # /run/lock/subsys is used for serializing SysV service execution, and # hence without use on SysV-less systems. @@ -29,7 +26,7 @@ # /run/lock/lockdev is used to serialize access to tty devices via # LCK..xxx style lock files, For more information see: -@@ -24,7 +25,7 @@ d /run/lock/subsys 0755 root root - +@@ -23,7 +24,7 @@ d /run/lock/subsys 0755 root root - # On modern systems a BSD file lock is a better choice if # serialization is needed on those devices. ++++++ Forward-suspend-hibernate-calls-to-pm-utils.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -4,23 +4,21 @@ forward suspend/hibernation calls to pm-utils, if installed (bnc#790157) --- - src/sleep/sleep.c | 27 ++++++++++++++++++++++----- - 1 file changed, 22 insertions(+), 5 deletions(-) + src/sleep/sleep.c | 26 ++++++++++++++++++++++---- + 1 file changed, 22 insertions(+), 4 deletions(-) -Index: systemd/src/sleep/sleep.c -=================================================================== ---- systemd.orig/src/sleep/sleep.c -+++ systemd/src/sleep/sleep.c +--- systemd-206.orig/src/sleep/sleep.c ++++ systemd-206/src/sleep/sleep.c @@ -24,6 +24,7 @@ #include <errno.h> #include <string.h> #include <getopt.h> +#include <stdlib.h> - #include "sd-id128.h" - #include "sd-messages.h" -@@ -36,6 +37,8 @@ - #include "def.h" + #include "systemd/sd-id128.h" + #include "systemd/sd-messages.h" +@@ -35,6 +36,8 @@ + #include "sleep-config.h" static char* arg_verb = NULL; +static bool delegate_to_pmutils = false; @@ -28,37 +26,36 @@ static int write_mode(char **modes) { int r = 0; -@@ -53,10 +56,6 @@ static int write_mode(char **modes) { - if (r == 0) +@@ -50,9 +53,6 @@ static int write_mode(char **modes) { r = k; } -- + - if (r < 0) -- log_error_errno(r, "Failed to write mode to /sys/power/disk: %m"); -- +- log_error("Failed to write mode to /sys/power/disk: %s", +- strerror(-r)); + return r; } - -@@ -97,6 +96,8 @@ static int execute(char **modes, char ** - int r; +@@ -90,6 +90,8 @@ static int execute(char **modes, char ** _cleanup_fclose_ FILE *f = NULL; + const char* note = strappenda("SLEEP=", arg_verb); + if (!delegate_to_pmutils) { + /* This file is opened first, so that if we hit an error, * we can abort before modifying any state. */ f = fopen("/sys/power/state", "we"); -@@ -107,6 +108,7 @@ static int execute(char **modes, char ** +@@ -102,6 +104,7 @@ static int execute(char **modes, char ** r = write_mode(modes); if (r < 0) return r; + } - execute_directories(dirs, DEFAULT_TIMEOUT_USEC, arguments); - -@@ -115,8 +117,10 @@ static int execute(char **modes, char ** - LOG_MESSAGE("Suspending system..."), - "SLEEP=%s", arg_verb, + arguments[0] = NULL; + arguments[1] = (char*) "pre"; +@@ -114,8 +117,10 @@ static int execute(char **modes, char ** + "MESSAGE=Suspending system...", + note, NULL); - + if (!delegate_to_pmutils) @@ -68,7 +65,7 @@ if (r < 0) return r; -@@ -156,6 +160,7 @@ static int parse_argv(int argc, char *ar +@@ -158,6 +163,7 @@ static int parse_argv(int argc, char *ar }; int c; @@ -76,7 +73,7 @@ assert(argc >= 0); assert(argv); -@@ -193,6 +198,18 @@ static int parse_argv(int argc, char *ar +@@ -196,6 +202,18 @@ static int parse_argv(int argc, char *ar return -EINVAL; } ++++++ Revert-service-drop-support-for-SysV-scripts-for-the-early.patch ++++++ From: Frederic Crozat <fcrozat@suse.com> Date: Fri, 12 Apr 2013 16:56:26 +0200 Subject: Revert "service: drop support for SysV scripts for the early boot" This reverts commit 3cdebc217c42c8529086f2965319b6a48eaaeabe. Conflicts: src/core/service.c --- src/core/service.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) Index: systemd-208/src/core/service.c =================================================================== --- systemd-208.orig/src/core/service.c +++ systemd-208/src/core/service.c @@ -51,7 +51,8 @@ typedef enum RunlevelType { RUNLEVEL_UP, - RUNLEVEL_DOWN + RUNLEVEL_DOWN, + RUNLEVEL_SYSINIT } RunlevelType; static const struct { @@ -66,6 +67,16 @@ static const struct { { "rc4.d", SPECIAL_RUNLEVEL4_TARGET, RUNLEVEL_UP }, { "rc5.d", SPECIAL_RUNLEVEL5_TARGET, RUNLEVEL_UP }, +#ifdef HAVE_SYSV_COMPAT + /* SUSE style boot.d */ + { "boot.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT }, +#endif + +#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU) || defined(TARGET_ANGSTROM) + /* Debian style rcS.d */ + { "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT }, +#endif + /* Standard SysV runlevels for shutdown */ { "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN }, { "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN } @@ -74,10 +85,12 @@ static const struct { directories in this order, and we want to make sure that sysv_start_priority is known when we first load the unit. And that value we only know from S links. Hence - UP must be read before DOWN */ + UP/SYSINIT must be read before DOWN */ }; #define RUNLEVELS_UP "12345" +/* #define RUNLEVELS_DOWN "06" */ +#define RUNLEVELS_BOOT "bBsS" #endif static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = { @@ -340,6 +353,9 @@ static char *sysv_translate_name(const c if (endswith(name, ".sh")) /* Drop .sh suffix */ strcpy(stpcpy(r, name) - 3, ".service"); + if (startswith(name, "boot.")) + /* Drop SuSE-style boot. prefix */ + strcpy(stpcpy(r, name + 5), ".service"); else /* Normal init script name */ strcpy(stpcpy(r, name), ".service"); @@ -942,6 +958,13 @@ static int service_load_sysv_path(Servic if ((r = sysv_exec_commands(s, supports_reload)) < 0) goto finish; + if (s->sysv_runlevels && + chars_intersect(RUNLEVELS_BOOT, s->sysv_runlevels) && + chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) { + /* Service has both boot and "up" runlevels + configured. Kill the "up" ones. */ + delete_chars(s->sysv_runlevels, RUNLEVELS_UP); + } if (s->sysv_runlevels && !chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) { /* If there a runlevels configured for this service @@ -1023,6 +1046,9 @@ static int service_load_sysv_name(Servic if (endswith(name, ".sh.service")) return -ENOENT; + if (startswith(name, "boot.")) + return -ENOENT; + STRV_FOREACH(p, UNIT(s)->manager->lookup_paths.sysvinit_path) { char *path; int r; @@ -1043,6 +1069,18 @@ static int service_load_sysv_name(Servic } free(path); + if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) { + /* Try SUSE style boot.* init scripts */ + + path = strjoin(*p, "/boot.", name, NULL); + if (!path) + return -ENOMEM; + + /* Drop .service suffix */ + path[strlen(path)-8] = 0; + r = service_load_sysv_path(s, path); + free(path); + } if (r < 0) return r; @@ -3574,7 +3612,7 @@ static int service_enumerate(Manager *m) if (de->d_name[0] == 'S') { - if (rcnd_table[i].type == RUNLEVEL_UP) { + if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT) { SERVICE(service)->sysv_start_priority_from_rcnd = MAX(a*10 + b, SERVICE(service)->sysv_start_priority_from_rcnd); @@ -3591,7 +3629,8 @@ static int service_enumerate(Manager *m) goto finish; } else if (de->d_name[0] == 'K' && - (rcnd_table[i].type == RUNLEVEL_DOWN)) { + (rcnd_table[i].type == RUNLEVEL_DOWN || + rcnd_table[i].type == RUNLEVEL_SYSINIT)) { r = set_ensure_allocated(&shutdown_services, trivial_hash_func, trivial_compare_func); @@ -3631,7 +3670,9 @@ static int service_enumerate(Manager *m) * runlevels we assume the stop jobs will be implicitly added * by the core logic. Also, we don't really distinguish here * between the runlevels 0 and 6 and just add them to the - * special shutdown target. */ + * special shutdown target. On SUSE the boot.d/ runlevel is + * also used for shutdown, so we add links for that too to the + * shutdown target.*/ SET_FOREACH(service, shutdown_services, j) { service = unit_follow_merge(service); ++++++ avoid-assertion-if-invalid-address-familily-is-passed-to-g.patch ++++++ From: Ludwig Nussel <ludwig.nussel@suse.de> Date: Mon, 26 Nov 2012 09:49:42 +0100 Subject: avoid assertion if invalid address familily is passed to gethostbyaddr_r (bnc#791101) --- src/nss-myhostname/nss-myhostname.c | 6 ++++++ 1 file changed, 6 insertions(+) --- systemd-206_git201308300826.orig/src/nss-myhostname/nss-myhostname.c +++ systemd-206_git201308300826/src/nss-myhostname/nss-myhostname.c @@ -442,6 +442,12 @@ enum nss_status _nss_myhostname_gethostb uint32_t local_address_ipv4 = LOCALADDRESS_IPV4; const char *canonical = NULL, *additional = NULL; + if (af != AF_INET && af != AF_INET6) { + *errnop = EAFNOSUPPORT; + *h_errnop = NO_DATA; + return NSS_STATUS_UNAVAIL; + } + if (len != PROTO_ADDRESS_SIZE(af)) { *errnop = EINVAL; *h_errnop = NO_RECOVERY; ++++++ avoid-leaking-socket-descriptors.patch ++++++ Based on 249968612f16a71df909d6e73785c18a9ff36a65 with src/core/dbus.c as well and corrected systemctl error messages for killing a unit. --- src/analyze/analyze.c | 2 +- src/bus-proxyd/bus-proxyd.c | 4 +--- src/cgroups-agent/cgroups-agent.c | 4 +--- src/core/dbus.c | 2 +- src/fsck/fsck.c | 2 +- src/hostname/hostnamectl.c | 2 +- src/hostname/hostnamed.c | 4 ++-- src/libsystemd/sd-bus/bus-util.h | 9 +++++++++ src/libsystemd/sd-bus/busctl.c | 2 +- src/locale/localectl.c | 2 +- src/locale/localed.c | 4 ++-- src/login/inhibit.c | 2 +- src/login/loginctl.c | 2 +- src/login/pam-module.c | 4 ++-- src/machine/machinectl.c | 4 ++-- src/nspawn/nspawn.c | 4 ++-- src/run/run.c | 2 +- src/systemctl/systemctl.c | 2 +- src/timedate/timedatectl.c | 2 +- src/timedate/timedated.c | 4 ++-- 20 files changed, 34 insertions(+), 29 deletions(-) --- src/analyze/analyze.c +++ src/analyze/analyze.c 2014-10-21 11:13:56.113045992 +0000 @@ -1264,7 +1264,7 @@ static int parse_argv(int argc, char *ar } int main(int argc, char *argv[]) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; setlocale(LC_ALL, ""); --- src/bus-proxyd/bus-proxyd.c +++ src/bus-proxyd/bus-proxyd.c 2014-10-21 11:16:16.303837968 +0000 @@ -427,7 +427,7 @@ static int patch_sender(sd_bus *a, sd_bu int main(int argc, char *argv[]) { - _cleanup_bus_unref_ sd_bus *a = NULL, *b = NULL; + _cleanup_bus_close_unref_ sd_bus *a = NULL, *b = NULL; sd_id128_t server_id; int r, in_fd, out_fd; bool got_hello = false; @@ -777,8 +777,6 @@ int main(int argc, char *argv[]) { r = 0; finish: - sd_bus_flush(a); - sd_bus_flush(b); return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; } --- src/cgroups-agent/cgroups-agent.c +++ src/cgroups-agent/cgroups-agent.c 2014-10-21 11:17:37.400197469 +0000 @@ -26,7 +26,7 @@ #include "bus-util.h" int main(int argc, char *argv[]) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; if (argc != 2) { @@ -62,7 +62,5 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - sd_bus_flush(bus); - return EXIT_SUCCESS; } --- src/core/dbus.c +++ src/core/dbus.c 2014-10-17 09:52:47.000000000 +0000 @@ -639,7 +639,7 @@ static int bus_setup_disconnected_match( } static int bus_on_connection(sd_event_source *s, int fd, uint32_t revents, void *userdata) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; _cleanup_close_ int nfd = -1; Manager *m = userdata; sd_id128_t id; --- src/fsck/fsck.c +++ src/fsck/fsck.c 2014-10-21 11:18:06.003838037 +0000 @@ -45,7 +45,7 @@ static bool arg_show_progress = false; static void start_target(const char *target) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; assert(target); --- src/hostname/hostnamectl.c +++ src/hostname/hostnamectl.c 2014-10-21 11:18:19.915858156 +0000 @@ -468,7 +468,7 @@ static int hostnamectl_main(sd_bus *bus, } int main(int argc, char *argv[]) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; setlocale(LC_ALL, ""); --- src/hostname/hostnamed.c +++ src/hostname/hostnamed.c 2014-10-21 11:24:07.737447673 +0000 @@ -566,7 +566,7 @@ static const sd_bus_vtable hostname_vtab }; static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; assert(c); @@ -607,7 +607,7 @@ int main(int argc, char *argv[]) { Context context = {}; _cleanup_event_unref_ sd_event *event = NULL; - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; log_set_target(LOG_TARGET_AUTO); --- src/libsystemd/sd-bus/bus-util.h +++ src/libsystemd/sd-bus/bus-util.h 2014-10-17 09:51:34.000000000 +0000 @@ -137,11 +137,20 @@ typedef struct UnitInfo { int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u); +static inline void sd_bus_close_unrefp(sd_bus **bus) { + if (*bus) { + sd_bus_flush(*bus); + sd_bus_close(*bus); + sd_bus_unref(*bus); + } +} + DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_unref); DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_message*, sd_bus_message_unref); DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_creds*, sd_bus_creds_unref); #define _cleanup_bus_unref_ _cleanup_(sd_bus_unrefp) +#define _cleanup_bus_close_unref_ _cleanup_(sd_bus_close_unrefp) #define _cleanup_bus_message_unref_ _cleanup_(sd_bus_message_unrefp) #define _cleanup_bus_creds_unref_ _cleanup_(sd_bus_creds_unrefp) #define _cleanup_bus_error_free_ _cleanup_(sd_bus_error_free) --- src/libsystemd/sd-bus/busctl.c +++ src/libsystemd/sd-bus/busctl.c 2014-10-21 11:19:01.472337887 +0000 @@ -484,7 +484,7 @@ static int busctl_main(sd_bus *bus, int } int main(int argc, char *argv[]) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; log_parse_environment(); --- src/locale/localectl.c +++ src/locale/localectl.c 2014-10-21 11:19:13.811947994 +0000 @@ -796,7 +796,7 @@ static int localectl_main(sd_bus *bus, i } int main(int argc, char*argv[]) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; setlocale(LC_ALL, ""); --- src/locale/localed.c +++ src/locale/localed.c 2014-10-21 11:19:28.415837424 +0000 @@ -1076,7 +1076,7 @@ static const sd_bus_vtable locale_vtable }; static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; assert(c); @@ -1116,7 +1116,7 @@ static int connect_bus(Context *c, sd_ev int main(int argc, char *argv[]) { Context context = {}; _cleanup_event_unref_ sd_event *event = NULL; - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; log_set_target(LOG_TARGET_AUTO); --- src/login/inhibit.c +++ src/login/inhibit.c 2014-10-21 11:19:44.470844885 +0000 @@ -221,7 +221,7 @@ static int parse_argv(int argc, char *ar int main(int argc, char *argv[]) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; log_parse_environment(); --- src/login/loginctl.c +++ src/login/loginctl.c 2014-10-21 11:20:16.695837857 +0000 @@ -1298,7 +1298,7 @@ static int loginctl_main(sd_bus *bus, in } int main(int argc, char *argv[]) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; setlocale(LC_ALL, ""); --- src/login/pam-module.c +++ src/login/pam-module.c 2014-10-21 10:48:20.000000000 +0000 @@ -213,7 +213,7 @@ _public_ PAM_EXTERN int pam_sm_open_sess *seat = NULL, *type = NULL, *class = NULL, *class_pam = NULL, *type_pam = NULL, *cvtnr = NULL, *desktop = NULL; - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int session_fd = -1, existing, r; bool debug = false, remote; struct passwd *pw; @@ -517,7 +517,7 @@ _public_ PAM_EXTERN int pam_sm_close_ses int argc, const char **argv) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; const void *existing = NULL; const char *id; int r; --- src/machine/machinectl.c +++ src/machine/machinectl.c 2014-10-21 11:20:45.747838104 +0000 @@ -550,7 +550,7 @@ static int openpt_in_namespace(pid_t pid static int login_machine(sd_bus *bus, char **args, unsigned n) { _cleanup_bus_message_unref_ sd_bus_message *reply = NULL, *reply2 = NULL, *reply3 = NULL; _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; - _cleanup_bus_unref_ sd_bus *container_bus = NULL; + _cleanup_bus_close_unref_ sd_bus *container_bus = NULL; _cleanup_close_ int master = -1; _cleanup_free_ char *getty = NULL; const char *path, *pty, *p; @@ -879,7 +879,7 @@ static int machinectl_main(sd_bus *bus, } int main(int argc, char*argv[]) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; setlocale(LC_ALL, ""); --- src/nspawn/nspawn.c +++ src/nspawn/nspawn.c 2014-10-21 11:21:05.561523449 +0000 @@ -1163,7 +1163,7 @@ static int drop_capabilities(void) { static int register_machine(pid_t pid) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; if (!arg_register) @@ -1285,7 +1285,7 @@ static int register_machine(pid_t pid) { static int terminate_machine(pid_t pid) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; const char *path; int r; --- src/run/run.c +++ src/run/run.c 2014-10-21 11:22:35.163838021 +0000 @@ -462,7 +462,7 @@ static int start_transient_scope( int main(int argc, char* argv[]) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; _cleanup_free_ char *description = NULL, *command = NULL; int r; --- src/systemctl/systemctl.c +++ src/systemctl/systemctl.c 2014-10-22 09:36:33.399838318 +0000 @@ -2601,7 +2601,7 @@ static int kill_unit(sd_bus *bus, char * "ssi", *names, arg_kill_who, arg_signal); if (q < 0) { log_error("Failed to kill unit %s: %s", - *names, bus_error_message(&error, r)); + *names, bus_error_message(&error, q)); if (r == 0) r = q; } @@ -6436,7 +6436,7 @@ static int runlevel_main(void) { } int main(int argc, char*argv[]) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; setlocale(LC_ALL, ""); --- src/timedate/timedatectl.c +++ src/timedate/timedatectl.c 2014-10-21 11:23:06.107837988 +0000 @@ -593,7 +593,7 @@ static int timedatectl_main(sd_bus *bus, } int main(int argc, char *argv[]) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; setlocale(LC_ALL, ""); --- src/timedate/timedated.c +++ src/timedate/timedated.c 2014-10-21 11:23:26.047838675 +0000 @@ -779,7 +779,7 @@ static const sd_bus_vtable timedate_vtab }; static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; assert(c); @@ -825,7 +825,7 @@ int main(int argc, char *argv[]) { }; _cleanup_event_unref_ sd_event *event = NULL; - _cleanup_bus_unref_ sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; int r; log_set_target(LOG_TARGET_AUTO); ++++++ boot.udev ++++++ #!/bin/sh # ### BEGIN INIT INFO # Provides: boot.udev # Required-Start: # Required-Stop: # Should-Start: # Should-Stop: # Default-Start: B # Default-Stop: # Short-Description: manage /dev and kernel device-events # Description: udevd daemon to manage /dev and kernel device events ### END INIT INFO . /etc/rc.status PATH="/sbin:/bin:/usr/sbin:/usr/bin" DAEMON="@@SYSTEMD@@/systemd-udevd" UDEVADM="@@BINDIR@@/udevadm" WRITERULE="@@PREFIX@@/write_dev_root_rule" udev_timeout=180 case "$1" in start) # create /dev/root symlink with dynamic rule if [ -x ${WRITERULE} ]; then ${WRITERULE} >/dev/null 2>&1 || true fi # start udevd echo -n "Starting udevd: " ${DAEMON} --daemon if [ $? -ne 0 ]; then rc_status -v rc_exit fi rc_status -v # trigger events for all devices echo -n "Loading drivers, configuring devices: " ${UDEVADM} trigger --type=subsystems --action=add ${UDEVADM} trigger --type=devices --action=add # wait for events to finish ${UDEVADM} settle --timeout=$udev_timeout rc_status -v ;; stop) echo -n "Stopping udevd: " killproc ${DAEMON} rc_status -v ;; restart) echo -n "Restarting udevd: " killproc ${DAEMON} ${DAEMON} --daemon rc_status -v ;; status) echo -n "Checking for udevd: " checkproc ${DAEMON} rc_status -v ;; reload|force-reload) echo -n "Reloading udevd: " killproc -G -HUP ${DAEMON} rc_status -v ;; *) echo "Usage: $0 {start|stop|restart|status|reload|force-reload}" exit 1 ;; esac rc_exit ++++++ disable-nss-myhostname-warning-bnc-783841.patch ++++++ From: Ludwig Nussel <ludwig.nussel@suse.de> Date: Tue, 12 Feb 2013 17:24:35 +0100 Subject: disable nss-myhostname warning (bnc#783841) --- src/hostname/hostnamed.c | 1 + 1 file changed, 1 insertion(+) --- systemd-206.orig/src/hostname/hostnamed.c +++ systemd-206/src/hostname/hostnamed.c @@ -134,6 +134,7 @@ static int read_data(void) { static bool check_nss(void) { void *dl; + return true; dl = dlopen("libnss_myhostname.so.2", RTLD_LAZY); if (dl) { ++++++ ensure-shortname-is-set-as-hostname-bnc-820213.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -4,13 +4,11 @@ strip hostname so the domain part isn't set as part of the hostname --- - src/core/hostname-setup.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) + src/core/hostname-setup.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) -Index: systemd-218/src/core/hostname-setup.c -=================================================================== ---- systemd-218.orig/src/core/hostname-setup.c -+++ systemd-218/src/core/hostname-setup.c +--- systemd-206.orig/src/core/hostname-setup.c ++++ systemd-206/src/core/hostname-setup.c @@ -32,7 +32,7 @@ #include "fileio.h" @@ -20,13 +18,14 @@ int r; assert(path); -@@ -49,6 +49,10 @@ static int read_and_strip_hostname(const +@@ -49,6 +49,11 @@ static int read_and_strip_hostname(const return -ENOENT; } + /* strip any leftover of a domain name */ -+ if ((domain = strchr(s, '.')) != NULL) -+ *domain = '\0'; ++ if (domain = strchr(s, '.')) { ++ *domain = NULL; ++ } + *hn = s; return 0; ++++++ fix-owner-of-var-log-btmp.patch ++++++ From: Frederic Crozat <fcrozat@suse.com> Date: Tue, 20 Nov 2012 09:36:43 +0000 Subject: fix owner of /var/log/btmp ensure btmp is owned only by root (bnc#777405). --- tmpfiles.d/systemd.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- systemd-206_git201308300826.orig/tmpfiles.d/systemd.conf +++ systemd-206_git201308300826/tmpfiles.d/systemd.conf @@ -11,7 +11,7 @@ d /run/user 0755 root root ~10d F! /run/utmp 0664 root utmp - f /var/log/wtmp 0664 root utmp - -f /var/log/btmp 0600 root utmp - +f /var/log/btmp 0600 root root - d /var/cache/man - - - 30d ++++++ fix-support-for-boot-prefixed-initscript-bnc-746506.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -3,17 +3,15 @@ Subject: fix support for boot prefixed initscript (bnc#746506) --- - src/systemctl/systemctl.c | 20 +++++++++++++++++++- - 1 file changed, 19 insertions(+), 1 deletion(-) + src/systemctl/systemctl.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) -Index: systemd-218/src/systemctl/systemctl.c -=================================================================== ---- systemd-218.orig/src/systemctl/systemctl.c -+++ systemd-218/src/systemctl/systemctl.c -@@ -5202,8 +5202,26 @@ static int enable_sysv_units(const char - - p[strlen(p) - strlen(".service")] = 0; +--- systemd-206_git201308300826.orig/src/systemctl/systemctl.c ++++ systemd-206_git201308300826/src/systemctl/systemctl.c +@@ -4169,8 +4169,28 @@ static int enable_sysv_units(char **args + p[strlen(p) - sizeof(".service") + 1] = 0; found_sysv = access(p, F_OK) >= 0; + - if (!found_sysv) + if (!found_sysv) { +#ifdef HAVE_SYSV_COMPAT @@ -23,8 +21,10 @@ + asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/boot.%s", arg_root, name); + else + asprintf(&p, SYSTEM_SYSVINIT_PATH "/boot.%s", name); -+ if (!p) -+ return -ENOMEM; ++ if (!p) { ++ r = log_oom(); ++ goto finish; ++ } + p[strlen(p) - sizeof(".service") + 1] = 0; + found_sysv = access(p, F_OK) >= 0; + @@ -36,5 +36,5 @@ +#endif + } - log_info("%s is not a native service, redirecting to /sbin/chkconfig.", name); - + /* Mark this entry, so that we don't try enabling it as native unit */ + args[f] = (char*) ""; ++++++ handle-SYSTEMCTL_OPTIONS-environment-variable.patch ++++++ From: Frederic Crozat <fcrozat@suse.com> Date: Tue, 22 Jan 2013 17:02:04 +0000 Subject: handle SYSTEMCTL_OPTIONS environment variable (bnc#798620) --- src/systemctl/systemctl.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) Index: systemd-208/src/systemctl/systemctl.c =================================================================== --- systemd-208.orig/src/systemctl/systemctl.c +++ systemd-208/src/systemctl/systemctl.c @@ -6115,6 +6115,28 @@ int main(int argc, char*argv[]) { * ellipsized. */ original_stdout_is_tty = isatty(STDOUT_FILENO); + if (secure_getenv("SYSTEMCTL_OPTIONS") && + (!program_invocation_short_name || + (program_invocation_short_name && strstr(program_invocation_short_name, "systemctl")))) { + char **parsed_systemctl_options = strv_split_quoted(getenv("SYSTEMCTL_OPTIONS")); + + if (*parsed_systemctl_options && **parsed_systemctl_options) { + char **k,**a; + char **new_argv = new(char*, strv_length(argv) + strv_length(parsed_systemctl_options) + 1); + new_argv[0] = strdup(argv[0]); + for (k = new_argv+1, a = parsed_systemctl_options; *a; k++, a++) { + *k = strdup(*a); + } + for (a = argv+1; *a; k++, a++) { + *k = strdup(*a); + } + *k = NULL; + argv = new_argv; + argc = strv_length(new_argv); + strv_free (parsed_systemctl_options); + } + } + r = parse_argv(argc, argv); if (r <= 0) goto finish; ++++++ handle-disable_caplock-and-compose_table-and-kbd_rate.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -4,13 +4,13 @@ (bnc#746595) --- - src/vconsole/vconsole-setup.c | 151 +++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 148 insertions(+), 3 deletions(-) + src/vconsole/vconsole-setup.c | 156 +++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 153 insertions(+), 3 deletions(-) -Index: systemd-218/src/vconsole/vconsole-setup.c +Index: systemd-210/src/vconsole/vconsole-setup.c =================================================================== ---- systemd-218.orig/src/vconsole/vconsole-setup.c -+++ systemd-218/src/vconsole/vconsole-setup.c +--- systemd-210.orig/src/vconsole/vconsole-setup.c ++++ systemd-210/src/vconsole/vconsole-setup.c @@ -40,6 +40,7 @@ #include "macro.h" #include "virt.h" @@ -19,7 +19,7 @@ static bool is_vconsole(int fd) { unsigned char data[1]; -@@ -101,8 +102,8 @@ static int enable_utf8(int fd) { +@@ -99,8 +100,8 @@ static int enable_utf8(int fd) { return r; } @@ -30,7 +30,7 @@ int i = 0; pid_t pid; -@@ -121,6 +122,8 @@ static int keymap_load(const char *vc, c +@@ -119,6 +120,8 @@ static int keymap_load(const char *vc, c args[i++] = map; if (map_toggle) args[i++] = map_toggle; @@ -39,7 +39,7 @@ args[i++] = NULL; pid = fork(); -@@ -236,11 +239,113 @@ static void font_copy_to_all_vcs(int fd) +@@ -212,6 +215,101 @@ static void font_copy_to_all_vcs(int fd) } } @@ -140,20 +140,25 @@ + int main(int argc, char **argv) { const char *vc; - _cleanup_free_ char - *vc_keymap = NULL, *vc_keymap_toggle = NULL, - *vc_font = NULL, *vc_font_map = NULL, *vc_font_unimap = NULL; -+#ifdef HAVE_SYSV_COMPAT -+ _cleanup_free_ char -+ *vc_kbd_delay = NULL, *vc_kbd_rate = NULL, -+ *vc_kbd_disable_caps_lock = NULL, *vc_compose_table = NULL; + char *vc_keymap = NULL; +@@ -219,8 +317,16 @@ int main(int argc, char **argv) { + char *vc_font = NULL; + char *vc_font_map = NULL; + char *vc_font_unimap = NULL; ++#ifdef HAVE_SYSV_COMPAT ++ char *vc_kbd_delay = NULL; ++ char *vc_kbd_rate = NULL; ++ char *vc_kbd_disable_caps_lock = NULL; ++ char *vc_compose_table = NULL; + pid_t kbd_rate_pid = 0, compose_table_pid = 0; +#endif -+ bool disable_capslock = false; - _cleanup_close_ int fd = -1; + int fd = -1; bool utf8; ++ bool disable_capslock = false; pid_t font_pid = 0, keymap_pid = 0; -@@ -273,6 +378,28 @@ int main(int argc, char **argv) { + bool font_copy = false; + int r = EXIT_FAILURE; +@@ -251,6 +357,28 @@ int main(int argc, char **argv) { utf8 = is_locale_utf8(); @@ -182,37 +187,45 @@ r = parse_env_file("/etc/vconsole.conf", NEWLINE, "KEYMAP", &vc_keymap, "KEYMAP_TOGGLE", &vc_keymap_toggle, -@@ -312,14 +439,32 @@ int main(int argc, char **argv) { - if (font_pid > 0) - wait_for_terminate_and_warn(KBD_SETFONT, font_pid, true); - -- r = keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid); -+ r = keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, disable_capslock, &keymap_pid); - if (r < 0) { - log_error_errno(r, "Failed to start " KBD_LOADKEYS ": %m"); - return EXIT_FAILURE; - } +@@ -282,7 +410,12 @@ int main(int argc, char **argv) { + disable_utf8(fd); + + r = EXIT_FAILURE; +- if (keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) >= 0 && ++ ++ if (keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, disable_capslock, &keymap_pid) >= 0 && +#ifdef HAVE_SYSV_COMPAT -+ r = load_compose_table(vc, vc_compose_table, &compose_table_pid); -+ if (r < 0) { -+ log_error_errno(r, "Failed to start " KBD_LOADKEYS " loading the compose table: %m"); -+ return EXIT_FAILURE; -+ } -+ r = set_kbd_rate(vc, vc_kbd_rate, vc_kbd_delay, &kbd_rate_pid); -+ if (r < 0) { -+ log_error_errno(r, "Failed to start kbdrate: %m"); -+ return EXIT_FAILURE; -+ } ++ load_compose_table(vc, vc_compose_table, &compose_table_pid) >= 0 && ++ set_kbd_rate(vc, vc_kbd_rate, vc_kbd_delay, &kbd_rate_pid) >= 0 && +#endif + font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) >= 0) + r = EXIT_SUCCESS; +@@ -290,6 +423,14 @@ finish: if (keymap_pid > 0) - wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid, true); + wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid); + +#ifdef HAVE_SYSV_COMPAT + if (compose_table_pid > 0) -+ wait_for_terminate_and_warn(KBD_LOADKEYS, compose_table_pid, true); ++ wait_for_terminate_and_warn(KBD_LOADKEYS, compose_table_pid); ++ + if (kbd_rate_pid > 0) -+ wait_for_terminate_and_warn("/usr/bin/kbdrate", kbd_rate_pid, true); ++ wait_for_terminate_and_warn("/bin/kbdrate", kbd_rate_pid); ++#endif ++ + if (font_pid > 0) { + wait_for_terminate_and_warn(KBD_SETFONT, font_pid); + if (font_copy) +@@ -300,6 +441,12 @@ finish: + free(vc_font); + free(vc_font_map); + free(vc_font_unimap); ++#ifdef HAVE_SYSV_COMPAT ++ free(vc_kbd_delay); ++ free(vc_kbd_rate); ++ free(vc_kbd_disable_caps_lock); ++ free(vc_compose_table); +#endif - /* Only copy the font when we started setfont successfully */ - if (font_copy && font_pid > 0) + if (fd >= 0) + close_nointr_nofail(fd); ++++++ handle-etc-HOSTNAME.patch ++++++ From: Frederic Crozat <fcrozat@suse.com> Date: Fri, 15 Feb 2013 16:04:39 +0000 Subject: handle /etc/HOSTNAME (bnc#803653) --- src/core/hostname-setup.c | 22 +++++++++++++++++----- src/hostname/hostnamed.c | 12 +++++++++++- 2 files changed, 28 insertions(+), 6 deletions(-) --- systemd-206/src/core/hostname-setup.c +++ systemd-206/src/core/hostname-setup.c @@ -61,12 +61,24 @@ int hostname_setup(void) { r = read_and_strip_hostname("/etc/hostname", &b); if (r < 0) { - if (r == -ENOENT) - enoent = true; - else - log_warning("Failed to read configured hostname: %s", strerror(-r)); + if (r == -ENOENT) { + /* use SUSE fallback */ + r = read_and_strip_hostname("/etc/HOSTNAME", &b); + if (r < 0) { + if (r == -ENOENT) + enoent = true; + else + log_warning("Failed to read configured hostname: %s", strerror(-r)); + hn = NULL; + } + else + hn = b; - hn = NULL; + } + else { + log_warning("Failed to read configured hostname: %s", strerror(-r)); + hn = NULL; + } } else hn = b; --- systemd-209/src/hostname/hostnamed.c +++ systemd-209/src/hostname/hostnamed.c 2014-02-28 11:36:30.594735241 +0000 @@ -89,6 +89,10 @@ static int context_read_data(Context *c) if (r < 0 && r != -ENOENT) return r; + r = read_one_line_file("/etc/HOSTNAME", &c->data[PROP_STATIC_HOSTNAME]); + if (r < 0 && r != -ENOENT) + return r; + return 0; } @@ -246,6 +250,7 @@ static int context_write_data_hostname(C } static int context_write_data_static_hostname(Context *c) { + int r; assert(c); @@ -256,7 +261,12 @@ static int context_write_data_static_hos return 0; } - return write_string_file_atomic_label("/etc/hostname", c->data[PROP_STATIC_HOSTNAME]); + + r = write_string_file_atomic_label("/etc/hostname", c->data[PROP_STATIC_HOSTNAME]); + if (!r) { + r = symlink_atomic("/etc/hostname", "/etc/HOSTNAME"); + } + return r; } static int context_write_data_other(Context *c) { ++++++ handle-numlock-value-in-etc-sysconfig-keyboard.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -6,19 +6,105 @@ Stanislav Brabec <sbrabec@suse.cz> Cristian Rodríguez <crrodriguez@opensuse.org> ---- - Makefile.am | 13 ++++++++++ - rules/73-seat-numlock.rules | 8 ++++++ - src/login/numlock-on.c | 34 +++++++++++++++++++++++++++ - src/vconsole/vconsole-setup.c | 40 ++++++++++++++++++++++++++++++-- - units/systemd-vconsole-setup.service.in | 2 - - 5 files changed, 94 insertions(+), 3 deletions(-) - -Index: systemd-218/Makefile.am +Index: systemd-210/src/vconsole/vconsole-setup.c =================================================================== ---- systemd-218.orig/Makefile.am -+++ systemd-218/Makefile.am -@@ -3715,6 +3715,19 @@ dist_udevrules_DATA += \ +--- systemd-210.orig/src/vconsole/vconsole-setup.c ++++ systemd-210/src/vconsole/vconsole-setup.c +@@ -42,6 +42,10 @@ + #include "fileio.h" + #include "strv.h" + ++#define BIOS_DATA_AREA 0x400 ++#define BDA_KEYBOARD_STATUS_FLAGS_4 0x97 ++#define BDA_KSF4_NUMLOCK_MASK 0x02 ++ + static bool is_vconsole(int fd) { + unsigned char data[1]; + +@@ -321,12 +325,14 @@ int main(int argc, char **argv) { + char *vc_kbd_delay = NULL; + char *vc_kbd_rate = NULL; + char *vc_kbd_disable_caps_lock = NULL; ++ char *vc_kbd_numlock = NULL; + char *vc_compose_table = NULL; + pid_t kbd_rate_pid = 0, compose_table_pid = 0; + #endif + int fd = -1; + bool utf8; + bool disable_capslock = false; ++ bool numlock = false; + pid_t font_pid = 0, keymap_pid = 0; + bool font_copy = false; + int r = EXIT_FAILURE; +@@ -363,6 +369,7 @@ int main(int argc, char **argv) { + "KBD_DELAY", &vc_kbd_delay, + "KBD_RATE", &vc_kbd_rate, + "KBD_DISABLE_CAPS_LOCK", &vc_kbd_disable_caps_lock, ++ "KBD_NUMLOCK", &vc_kbd_numlock, + "COMPOSETABLE", &vc_compose_table, + NULL); + if (r < 0 && r != -ENOENT) +@@ -377,6 +384,36 @@ int main(int argc, char **argv) { + log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r)); + + disable_capslock = vc_kbd_disable_caps_lock && strcasecmp(vc_kbd_disable_caps_lock, "YES") == 0; ++#if defined(__i386__) || defined(__x86_64__) ++ if (vc_kbd_numlock && strcaseeq(vc_kbd_numlock, "bios")) { ++ int _cleanup_close_ fdmem; ++ char c; ++ ++ fdmem = open ("/dev/mem", O_RDONLY); ++ ++ if(fdmem < 0) { ++ r = EXIT_FAILURE; ++ log_error("Failed to open /dev/mem: %m"); ++ goto finish; ++ } ++ ++ if(lseek(fdmem, BIOS_DATA_AREA + BDA_KEYBOARD_STATUS_FLAGS_4, SEEK_SET) == (off_t) -1) { ++ r = EXIT_FAILURE; ++ log_error("Failed to seek /dev/mem: %m"); ++ goto finish; ++ } ++ ++ if(read (fdmem, &c, sizeof(char)) == -1) { ++ r = EXIT_FAILURE; ++ log_error("Failed to read /dev/mem: %m"); ++ goto finish; ++ } ++ ++ if (c & BDA_KSF4_NUMLOCK_MASK) ++ numlock = true; ++ } else ++#endif ++ numlock = vc_kbd_numlock && strcaseeq(vc_kbd_numlock, "yes"); + #endif + + r = parse_env_file("/etc/vconsole.conf", NEWLINE, +@@ -422,6 +459,10 @@ int main(int argc, char **argv) { + finish: + if (keymap_pid > 0) + wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid); ++ if (numlock) ++ touch("/run/numlock-on"); ++ else ++ unlink("/run/numlock-on"); + + #ifdef HAVE_SYSV_COMPAT + if (compose_table_pid > 0) +@@ -441,6 +482,7 @@ finish: + free(vc_font); + free(vc_font_map); + free(vc_font_unimap); ++ free(vc_kbd_numlock); + #ifdef HAVE_SYSV_COMPAT + free(vc_kbd_delay); + free(vc_kbd_rate); +Index: systemd-210/Makefile.am +=================================================================== +--- systemd-210.orig/Makefile.am ++++ systemd-210/Makefile.am +@@ -2847,6 +2847,19 @@ dist_udevrules_DATA += \ rules/61-accelerometer.rules # ------------------------------------------------------------------------------ @@ -38,10 +124,10 @@ if ENABLE_GUDEV if ENABLE_GTK_DOC SUBDIRS += \ -Index: systemd-218/rules/73-seat-numlock.rules +Index: systemd-210/rules/73-seat-numlock.rules =================================================================== --- /dev/null -+++ systemd-218/rules/73-seat-numlock.rules ++++ systemd-210/rules/73-seat-numlock.rules @@ -0,0 +1,8 @@ +# This file is part of SUSE customization of systemd. +# @@ -51,10 +137,10 @@ +# (at your option) any later version. + +SUBSYSTEM=="tty", ACTION=="add", KERNEL=="tty[0-9]|tty1[0-2]", TEST=="/run/numlock-on", RUN+="numlock-on $env{DEVNAME}" -Index: systemd-218/src/login/numlock-on.c +Index: systemd-210/src/login/numlock-on.c =================================================================== --- /dev/null -+++ systemd-218/src/login/numlock-on.c ++++ systemd-210/src/login/numlock-on.c @@ -0,0 +1,34 @@ +/* + * numlock-on.c: Turn numlock-on @@ -90,95 +176,14 @@ + + exit(0); +} -Index: systemd-218/src/vconsole/vconsole-setup.c -=================================================================== ---- systemd-218.orig/src/vconsole/vconsole-setup.c -+++ systemd-218/src/vconsole/vconsole-setup.c -@@ -42,6 +42,10 @@ - #include "fileio.h" - #include "strv.h" - -+#define BIOS_DATA_AREA 0x400 -+#define BDA_KEYBOARD_STATUS_FLAGS_4 0x97 -+#define BDA_KSF4_NUMLOCK_MASK 0x02 -+ - static bool is_vconsole(int fd) { - unsigned char data[1]; - -@@ -342,10 +346,11 @@ int main(int argc, char **argv) { - #ifdef HAVE_SYSV_COMPAT - _cleanup_free_ char - *vc_kbd_delay = NULL, *vc_kbd_rate = NULL, -- *vc_kbd_disable_caps_lock = NULL, *vc_compose_table = NULL; -+ *vc_kbd_disable_caps_lock = NULL, *vc_compose_table = NULL, -+ *vc_kbd_numlock = NULL; - pid_t kbd_rate_pid = 0, compose_table_pid = 0; - #endif -- bool disable_capslock = false; -+ bool disable_capslock = false, numlock = false; - _cleanup_close_ int fd = -1; - bool utf8; - pid_t font_pid = 0, keymap_pid = 0; -@@ -384,6 +389,7 @@ int main(int argc, char **argv) { - "KBD_DELAY", &vc_kbd_delay, - "KBD_RATE", &vc_kbd_rate, - "KBD_DISABLE_CAPS_LOCK", &vc_kbd_disable_caps_lock, -+ "KBD_NUMLOCK", &vc_kbd_numlock, - "COMPOSETABLE", &vc_compose_table, - NULL); - if (r < 0 && r != -ENOENT) -@@ -398,6 +404,32 @@ int main(int argc, char **argv) { - log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r)); - - disable_capslock = vc_kbd_disable_caps_lock && strcasecmp(vc_kbd_disable_caps_lock, "YES") == 0; -+#if defined(__i386__) || defined(__x86_64__) -+ if (vc_kbd_numlock && strcaseeq(vc_kbd_numlock, "bios")) { -+ int _cleanup_close_ fdmem; -+ char c; -+ -+ fdmem = open ("/dev/mem", O_RDONLY); -+ if (fdmem < 0) { -+ log_error("Failed to open /dev/mem: %m"); -+ return EXIT_FAILURE; -+ } -+ -+ if (lseek(fdmem, BIOS_DATA_AREA + BDA_KEYBOARD_STATUS_FLAGS_4, SEEK_SET) == (off_t) -1) { -+ log_error("Failed to seek /dev/mem: %m"); -+ return EXIT_FAILURE; -+ } -+ -+ if (read (fdmem, &c, sizeof(char)) == -1) { -+ log_error("Failed to read /dev/mem: %m"); -+ return EXIT_FAILURE; -+ } -+ -+ if (c & BDA_KSF4_NUMLOCK_MASK) -+ numlock = true; -+ } else -+#endif -+ numlock = vc_kbd_numlock && strcaseeq(vc_kbd_numlock, "yes"); - #endif - - r = parse_env_file("/etc/vconsole.conf", NEWLINE, -@@ -444,6 +476,10 @@ int main(int argc, char **argv) { - log_error_errno(r, "Failed to start " KBD_LOADKEYS ": %m"); - return EXIT_FAILURE; - } -+ if (numlock) -+ touch("/run/numlock-on"); -+ else -+ unlink("/run/numlock-on"); - #ifdef HAVE_SYSV_COMPAT - r = load_compose_table(vc, vc_compose_table, &compose_table_pid); - if (r < 0) { -Index: systemd-218/units/systemd-vconsole-setup.service.in +Index: systemd-210/units/systemd-vconsole-setup.service.in =================================================================== ---- systemd-218.orig/units/systemd-vconsole-setup.service.in -+++ systemd-218/units/systemd-vconsole-setup.service.in -@@ -10,7 +10,7 @@ Description=Setup Virtual Console - Documentation=man:systemd-vconsole-setup.service(8) man:vconsole.conf(5) +--- systemd-210.orig/units/systemd-vconsole-setup.service.in ++++ systemd-210/units/systemd-vconsole-setup.service.in +@@ -11,7 +11,7 @@ Documentation=man:systemd-vconsole-setup DefaultDependencies=no Conflicts=shutdown.target + After=systemd-readahead-collect.service systemd-readahead-replay.service -Before=sysinit.target shutdown.target +Before=sysinit.target shutdown.target systemd-udev-trigger.service ConditionPathExists=/dev/tty0 ++++++ handle-root_uses_lang-value-in-etc-sysconfig-language.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -4,16 +4,16 @@ handle ROOT_USES_LANG=ctype (bnc#792182). --- - src/core/locale-setup.c | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) + src/core/locale-setup.c | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) -Index: systemd-218/src/core/locale-setup.c +Index: systemd-208/src/core/locale-setup.c =================================================================== ---- systemd-218.orig/src/core/locale-setup.c -+++ systemd-218/src/core/locale-setup.c -@@ -36,6 +36,11 @@ int locale_setup(char ***environment) { +--- systemd-208.orig/src/core/locale-setup.c ++++ systemd-208/src/core/locale-setup.c +@@ -73,6 +73,11 @@ int locale_setup(char ***environment) { char **add; - char *variables[_VARIABLE_LC_MAX] = {}; + char *variables[_VARIABLE_MAX] = {}; int r = 0, i; +#ifdef HAVE_SYSV_COMPAT + char _cleanup_free_ *root_uses_lang; @@ -23,9 +23,9 @@ if (detect_container(NULL) <= 0) { r = parse_env_file("/proc/cmdline", WHITESPACE, -@@ -82,6 +87,27 @@ int locale_setup(char ***environment) { +@@ -119,6 +124,27 @@ int locale_setup(char ***environment) { if (r < 0 && r != -ENOENT) - log_warning_errno(r, "Failed to read /etc/locale.conf: %m"); + log_warning("Failed to read /etc/locale.conf: %s", strerror(-r)); } +#ifdef HAVE_SYSV_COMPAT + if (r <= 0 && @@ -50,4 +50,4 @@ +#endif add = NULL; - for (i = 0; i < _VARIABLE_LC_MAX; i++) { + for (i = 0; i < _VARIABLE_MAX; i++) { ++++++ insserv-generator.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -6,30 +6,29 @@ parse /etc/insserv.conf.dd content and /etc/insserv.conf and generate systemd unit drop-in files to add dependencies --- - Makefile.am | 9 - src/insserv-generator/Makefile | 28 ++ - src/insserv-generator/insserv-generator.c | 312 ++++++++++++++++++++++++++++++ - 3 files changed, 349 insertions(+) + Makefile.am | 9 + + src/insserv-generator/Makefile | 28 +++ + src/insserv-generator/insserv-generator.c | 309 ++++++++++++++++++++++++++++++ + 3 files changed, 346 insertions(+) create mode 100644 src/insserv-generator/Makefile create mode 100644 src/insserv-generator/insserv-generator.c ---- systemd-219.orig/Makefile.am -+++ systemd-219/Makefile.am -@@ -621,7 +621,8 @@ nodist_systemunit_DATA += \ +Index: systemd-210/Makefile.am +=================================================================== +--- systemd-210.orig/Makefile.am ++++ systemd-210/Makefile.am +@@ -343,6 +343,7 @@ rootlibexec_PROGRAMS = \ + systemd-socket-proxyd - systemgenerator_PROGRAMS += \ - systemd-sysv-generator \ -- systemd-rc-local-generator -+ systemd-rc-local-generator \ -+ systemd-insserv-generator - endif - - EXTRA_DIST += \ -@@ -2565,6 +2566,14 @@ systemd_rc_local_generator_LDADD = \ - libsystemd-label.la \ + systemgenerator_PROGRAMS = \ ++ systemd-insserv-generator \ + systemd-getty-generator \ + systemd-fstab-generator \ + systemd-system-update-generator +@@ -1728,6 +1729,14 @@ systemd_delta_LDADD = \ libsystemd-shared.la -+#------------------------------------------------------------------------------- + # ------------------------------------------------------------------------------ +systemd_insserv_generator_SOURCES = \ + src/insserv-generator/insserv-generator.c + @@ -37,11 +36,14 @@ + libsystemd-label.la \ + libsystemd-shared.la + - # ------------------------------------------------------------------------------ - systemd_remount_fs_SOURCES = \ - src/remount-fs/remount-fs.c \ ++# ------------------------------------------------------------------------------ + systemd_getty_generator_SOURCES = \ + src/getty-generator/getty-generator.c + +Index: systemd-210/src/insserv-generator/Makefile +=================================================================== --- /dev/null -+++ systemd-219/src/insserv-generator/Makefile ++++ systemd-210/src/insserv-generator/Makefile @@ -0,0 +1,28 @@ +# This file is part of systemd. +# @@ -71,8 +73,10 @@ + $(MAKE) -C .. clean + +.PHONY: all clean +Index: systemd-210/src/insserv-generator/insserv-generator.c +=================================================================== --- /dev/null -+++ systemd-219/src/insserv-generator/insserv-generator.c ++++ systemd-210/src/insserv-generator/insserv-generator.c @@ -0,0 +1,312 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + @@ -350,7 +354,7 @@ + + while ((de = readdir(d))) { + char *path = NULL; -+ if (hidden_file(de->d_name)) ++ if (ignore_file(de->d_name)) + continue; + + path = strjoin("/etc/insserv.conf.d/", de->d_name, NULL); ++++++ journald-advice-about-use-of-memory.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -1,135 +1,143 @@ -From: werner@suse.de -Upstream: marked as openSUSE-specific fix originally, but may well - worth be to be sent upstream. - -Original description: - (none) - -Notes [jengelh@inai.de]: -MAP_NONBLOCK is documented (mmap(2) in man-pages-3.69+) to render -MAP_POPULATE ineffective. Why do we have it? -What is the rationale for MAP_STACK? --- - src/journal/catalog.c | 12 +++++++++++- - src/journal/journal-authenticate.c | 7 +++++-- - src/journal/journald-kmsg.c | 3 ++- - src/journal/mmap-cache.c | 16 +++++++++++++++- - 4 files changed, 33 insertions(+), 5 deletions(-) + src/journal/catalog.c | 21 +++++++++++++++++++-- + src/journal/journal-authenticate.c | 4 ++-- + src/journal/journal-file.c | 2 +- + src/journal/journald-kmsg.c | 2 +- + src/journal/mmap-cache.c | 24 ++++++++++++++++++++++-- + 5 files changed, 45 insertions(+), 8 deletions(-) -Index: systemd/src/journal/catalog.c -=================================================================== ---- systemd.orig/src/journal/catalog.c -+++ systemd/src/journal/catalog.c -@@ -470,6 +470,10 @@ finish: +--- src/journal/catalog.c ++++ src/journal/catalog.c 2014-10-24 11:44:59.079838065 +0000 +@@ -472,9 +472,19 @@ finish: static int open_mmap(const char *database, int *_fd, struct stat *_st, void **_p) { const CatalogHeader *h; -+ static const unsigned int advice[] = -+ {MADV_WILLNEED, MADV_SEQUENTIAL, MADV_DONTDUMP, MADV_DONTFORK}; -+ unsigned int n; -+ size_t psize; - int fd; +- int fd; ++ static const struct { ++ const int index; ++ int advise; ++ } advises[] = { ++ {0,MADV_WILLNEED}, ++ {1,MADV_SEQUENTIAL}, ++ {2,MADV_DONTDUMP}, ++ {3,MADV_DONTFORK} ++ }; ++ int n, fd; void *p; struct stat st; -@@ -492,12 +496,18 @@ static int open_mmap(const char *databas ++ size_t psize; + + assert(_fd); + assert(_st); +@@ -494,12 +504,19 @@ static int open_mmap(const char *databas return -EINVAL; } - p = mmap(NULL, PAGE_ALIGN(st.st_size), PROT_READ, MAP_SHARED, fd, 0); + psize = PAGE_ALIGN(st.st_size); -+ p = mmap(NULL, psize, PROT_READ, MAP_SHARED | MAP_POPULATE | -+ MAP_NONBLOCK, fd, 0); ++ p = mmap(NULL, psize, PROT_READ, MAP_SHARED|MAP_POPULATE|MAP_NONBLOCK, fd, 0); if (p == MAP_FAILED) { - safe_close(fd); + close_nointr_nofail(fd); return -errno; } -+ for (n = 0; n < sizeof(advice) / sizeof(*advice); ++n) -+ if (madvise(p, psize, advice[n]) < 0) ++ for (n=0; n < sizeof(advises)/sizeof(advises[0]); n++) { ++ int r = madvise(p, psize, advises[n].advise); ++ if (r < 0) + log_warning("Failed to give advice about use of memory: %m"); ++ } + h = p; if (memcmp(h->signature, CATALOG_SIGNATURE, sizeof(h->signature)) != 0 || le64toh(h->header_size) < sizeof(CatalogHeader) || -Index: systemd/src/journal/journal-authenticate.c -=================================================================== ---- systemd.orig/src/journal/journal-authenticate.c -+++ systemd/src/journal/journal-authenticate.c -@@ -355,7 +355,8 @@ int journal_file_fss_load(JournalFile *f +--- src/journal/journal-authenticate.c ++++ src/journal/journal-authenticate.c 2014-10-24 07:41:09.271837523 +0000 +@@ -355,7 +355,7 @@ int journal_file_fss_load(JournalFile *f goto finish; } - m = mmap(NULL, PAGE_ALIGN(sizeof(FSSHeader)), PROT_READ, MAP_SHARED, fd, 0); -+ m = mmap(NULL, PAGE_ALIGN(sizeof(FSSHeader)), PROT_READ, -+ MAP_SHARED | MAP_STACK, fd, 0); ++ m = mmap(NULL, PAGE_ALIGN(sizeof(FSSHeader)), PROT_READ, MAP_SHARED|MAP_STACK, fd, 0); if (m == MAP_FAILED) { m = NULL; r = -errno; -@@ -399,7 +400,9 @@ int journal_file_fss_load(JournalFile *f +@@ -399,7 +399,7 @@ int journal_file_fss_load(JournalFile *f goto finish; } - f->fss_file = mmap(NULL, PAGE_ALIGN(f->fss_file_size), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); -+ f->fss_file = mmap(NULL, PAGE_ALIGN(f->fss_file_size), -+ PROT_READ | PROT_WRITE, MAP_SHARED | MAP_STACK, -+ fd, 0); ++ f->fss_file = mmap(NULL, PAGE_ALIGN(f->fss_file_size), PROT_READ|PROT_WRITE, MAP_SHARED|MAP_STACK, fd, 0); if (f->fss_file == MAP_FAILED) { f->fss_file = NULL; r = -errno; -Index: systemd/src/journal/journald-kmsg.c -=================================================================== ---- systemd.orig/src/journal/journald-kmsg.c -+++ systemd/src/journal/journald-kmsg.c -@@ -454,7 +454,8 @@ int server_open_kernel_seqnum(Server *s) +--- src/journal/journal-file.c ++++ src/journal/journal-file.c 2014-10-24 07:39:25.603837720 +0000 +@@ -2554,7 +2554,7 @@ int journal_file_open( + goto fail; + } + +- f->header = mmap(NULL, PAGE_ALIGN(sizeof(Header)), prot_from_flags(flags), MAP_SHARED, f->fd, 0); ++ f->header = mmap(NULL, PAGE_ALIGN(sizeof(Header)), prot_from_flags(flags), MAP_SHARED|MAP_STACK, f->fd, 0); + if (f->header == MAP_FAILED) { + f->header = NULL; + r = -errno; +--- src/journal/journald-kmsg.c ++++ src/journal/journald-kmsg.c 2014-10-24 07:38:01.967837989 +0000 +@@ -473,7 +473,7 @@ int server_open_kernel_seqnum(Server *s) return 0; } - p = mmap(NULL, sizeof(uint64_t), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); -+ p = mmap(NULL, sizeof(uint64_t), PROT_READ | PROT_WRITE, -+ MAP_SHARED | MAP_STACK, fd, 0); ++ p = mmap(NULL, sizeof(uint64_t), PROT_READ|PROT_WRITE, MAP_SHARED|MAP_STACK, fd, 0); if (p == MAP_FAILED) { - log_error_errno(errno, "Failed to map sequential number file, ignoring: %m"); - return 0; -Index: systemd/src/journal/mmap-cache.c -=================================================================== ---- systemd.orig/src/journal/mmap-cache.c -+++ systemd/src/journal/mmap-cache.c -@@ -467,11 +467,14 @@ static int add_mmap( + log_error("Failed to map sequential number file, ignoring: %m"); + close_nointr_nofail(fd); +--- src/journal/mmap-cache.c ++++ src/journal/mmap-cache.c 2014-10-24 11:16:47.759837744 +0000 +@@ -439,12 +439,21 @@ static int add_mmap( struct stat *st, void **ret) { -+ static const unsigned int advice[] = -+ {MADV_WILLNEED, MADV_SEQUENTIAL, MADV_DONTDUMP, MADV_DONTFORK}; ++ static const struct { ++ const int index; ++ int vise; ++ } ad[] = { ++ {0, MADV_WILLNEED}, ++ {1, MADV_SEQUENTIAL}, ++ {2, MADV_DONTDUMP}, ++ {3, MADV_DONTFORK} ++ }; uint64_t woffset, wsize; Context *c; FileDescriptor *f; Window *w; void *d; -+ unsigned int n; - int r; +- int r; ++ int n, r; assert(m); -@@ -510,7 +513,8 @@ static int add_mmap( + assert(m->n_ref > 0); +@@ -481,7 +490,7 @@ static int add_mmap( } for (;;) { - d = mmap(NULL, wsize, prot, MAP_SHARED, fd, woffset); -+ d = mmap(NULL, wsize, prot, MAP_SHARED | MAP_POPULATE | -+ MAP_NONBLOCK, fd, woffset); ++ d = mmap(NULL, wsize, prot, MAP_SHARED|MAP_POPULATE|MAP_NONBLOCK, fd, woffset); if (d != MAP_FAILED) break; if (errno != ENOMEM) -@@ -523,6 +527,16 @@ static int add_mmap( +@@ -494,6 +503,17 @@ static int add_mmap( return -ENOMEM; } -+ for (n = 0; n < sizeof(advice) / sizeof(*advice); ++n) { -+ if (advice[n] == MADV_DONTFORK) { ++ for (n=0; n < sizeof(ad)/sizeof(ad[0]); n++) { ++ if (ad[n].vise == MADV_DONTFORK) { + int flags = fcntl(fd, F_GETFD); + if (flags < 0 || !(flags & FD_CLOEXEC)) + continue; + } -+ if (madvise(d, wsize, advice[n]) < 0) ++ r = madvise(d, wsize, ad[n].vise); ++ if (r < 0) + log_warning("Failed to give advice about use of memory: %m"); + } + ++++++ kbd-model-map.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -1,18 +1,13 @@ -From: werner@suse.de -Date: Tue Jan 20 11:33:59 UTC 2015 - --- src/locale/kbd-model-map | 13 +++++++++++++ 1 file changed, 13 insertions(+) -Index: systemd/src/locale/kbd-model-map -=================================================================== ---- systemd.orig/src/locale/kbd-model-map -+++ systemd/src/locale/kbd-model-map -@@ -66,3 +66,16 @@ lt.baltic lt pc105 - terminate:ctrl_a - lt.l4 lt pc105 - terminate:ctrl_alt_bksp +--- src/locale/kbd-model-map ++++ src/locale/kbd-model-map 2015-01-20 11:31:38.357518811 +0000 +@@ -63,3 +63,16 @@ by by,us pc105 - terminate:ctrl_alt_ + il il pc105 - terminate:ctrl_alt_bksp + kazakh kz,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll lt lt pc105 - terminate:ctrl_alt_bksp - khmer kh,us pc105 - terminate:ctrl_alt_bksp +# Additional layouts offered by YaST +Pl02 pl pc105 - terminate:ctrl_alt_bksp +arabic ara,us pc105 - terminate:ctrl_alt_bksp,grp:shift_toggle ++++++ let-linker-find-libudev-for-libdevmapper.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -1,13 +1,6 @@ ---- - Makefile.am | 4 ++++ - configure.ac | 4 ---- - 2 files changed, 4 insertions(+), 4 deletions(-) - -Index: systemd/Makefile.am -=================================================================== ---- systemd.orig/Makefile.am -+++ systemd/Makefile.am -@@ -4789,6 +4789,10 @@ systemd_cryptsetup_CFLAGS = \ +--- systemd-210/Makefile.am ++++ systemd-210/Makefile.am 2014-03-13 08:54:36.010736086 +0000 +@@ -3691,6 +3691,10 @@ systemd_cryptsetup_CFLAGS = \ $(AM_CFLAGS) \ $(LIBCRYPTSETUP_CFLAGS) @@ -18,18 +11,27 @@ systemd_cryptsetup_LDADD = \ libsystemd-label.la \ libudev-internal.la \ -Index: systemd/configure.ac -=================================================================== ---- systemd.orig/configure.ac -+++ systemd/configure.ac -@@ -206,10 +206,6 @@ AS_CASE([$CC], [*clang*], - -Wno-gnu-variable-sized-type-not-at-end \ - ])]) +--- systemd-210/Makefile.in ++++ systemd-210/Makefile.in 2014-03-13 09:19:48.950238725 +0000 +@@ -8964,7 +8964,7 @@ src/cryptsetup/systemd_cryptsetup-crypts + systemd-cryptsetup$(EXEEXT): $(systemd_cryptsetup_OBJECTS) $(systemd_cryptsetup_DEPENDENCIES) $(EXTRA_systemd_cryptsetup_DEPENDENCIES) + @rm -f systemd-cryptsetup$(EXEEXT) +- $(AM_V_CCLD)$(systemd_cryptsetup_LINK) $(systemd_cryptsetup_OBJECTS) $(systemd_cryptsetup_LDADD) $(LIBS) ++ $(AM_V_CCLD)$(systemd_cryptsetup_LINK) $(systemd_cryptsetup_OBJECTS) $(systemd_cryptsetup_LDFLAGS) $(systemd_cryptsetup_LDADD) $(LIBS) + src/cryptsetup/cryptsetup-generator.$(OBJEXT): \ + src/cryptsetup/$(am__dirstamp) \ + src/cryptsetup/$(DEPDIR)/$(am__dirstamp) +--- systemd-210/configure.ac ++++ systemd-210/configure.ac 2014-03-13 13:46:24.394235954 +0000 +@@ -156,10 +156,6 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CF + -fdata-sections \ + -fstack-protector \ + --param=ssp-buffer-size=4]) -AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], - [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\ -- -flto -ffat-lto-objects])], +- -flto])], - [AC_MSG_RESULT([skipping -flto, optimization not enabled])]) - AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags") + AC_SUBST([OUR_CFLAGS], "$with_cflags $address_sanitizer_cflags") AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], ++++++ localfs.service ++++++ [Unit] Description=Shadow /etc/init.d/boot.localfs DefaultDependencies=no After=local-fs.target [Service] RemainAfterExit=true ExecStart=/bin/true ++++++ log-target-null-instead-kmsg.patch ++++++ --- src/journal/journald-kmsg.c | 16 +++++++++++++++- src/libudev/libudev-util.c | 16 +++++++++++++++- src/shared/log.c | 16 +++++++++++++++- src/shared/util.c | 6 +++++- 4 files changed, 50 insertions(+), 4 deletions(-) Index: systemd-210/src/journal/journald-kmsg.c =================================================================== --- systemd-210.orig/src/journal/journald-kmsg.c +++ systemd-210/src/journal/journald-kmsg.c @@ -391,12 +391,24 @@ static int dispatch_dev_kmsg(sd_event_so return server_read_dev_kmsg(s); } +static int parse_proc_cmdline_word(const char *word) { + if (streq(word, "systemd.log_target=null")) + return -115; + + return 0; +} + int server_open_dev_kmsg(Server *s) { int r; assert(s); - s->dev_kmsg_fd = open("/dev/kmsg", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY); + if (parse_proc_cmdline(parse_proc_cmdline_word) == -115) { + s->dev_kmsg_fd = open("/dev/null", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY); + } else { + s->dev_kmsg_fd = open("/dev/kmsg", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY); + } + if (s->dev_kmsg_fd < 0) { log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, "Failed to open /dev/kmsg, ignoring: %m"); Index: systemd-210/src/libudev/libudev-util.c =================================================================== --- systemd-210.orig/src/libudev/libudev-util.c +++ systemd-210/src/libudev/libudev-util.c @@ -416,6 +416,13 @@ uint64_t util_string_bloom64(const char return bits; } +static int parse_proc_cmdline_word(const char *word) { + if (streq(word, "systemd.log_target=null")) + return -115; + + return 0; +} + ssize_t print_kmsg(const char *fmt, ...) { _cleanup_close_ int fd = -1; @@ -424,7 +431,12 @@ ssize_t print_kmsg(const char *fmt, ...) ssize_t len; ssize_t ret; - fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC); + if (parse_proc_cmdline(parse_proc_cmdline_word) == -115) { + fd = open("/dev/null", O_WRONLY|O_NOCTTY|O_CLOEXEC); + } else { + fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC); + } + if (fd < 0) return -errno; Index: systemd-210/src/shared/log.c =================================================================== --- systemd-210.orig/src/shared/log.c +++ systemd-210/src/shared/log.c @@ -92,12 +92,24 @@ void log_close_kmsg(void) { kmsg_fd = -1; } +static int parse_proc_cmdline_word(const char *word) { + if (streq(word, "systemd.log_target=null")) + return -115; + + return 0; +} + static int log_open_kmsg(void) { if (kmsg_fd >= 0) return 0; - kmsg_fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC); + if (parse_proc_cmdline(parse_proc_cmdline_word) == -115) { + kmsg_fd = open("/dev/null", O_WRONLY|O_NOCTTY|O_CLOEXEC); + } else { + kmsg_fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC); + } + if (kmsg_fd < 0) return -errno; Index: systemd-210/src/shared/util.c =================================================================== --- systemd-210.orig/src/shared/util.c +++ systemd-210/src/shared/util.c @@ -6069,7 +6069,11 @@ int parse_proc_cmdline(int (*parse_word) r = parse_word(word); if (r < 0) { - log_error("Failed on cmdline argument %s: %s", word, strerror(-r)); + if (r == -115) { + log_error("Warning: %s set, redirecting messages to /dev/null.", word); + } else { + log_error("Failed on cmdline argument %s: %s", word, strerror(-r)); + } return r; } } ++++++ macros.systemd.upstream ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -26,9 +26,7 @@ %_udevrulesdir @udevrulesdir@ %_journalcatalogdir @catalogdir@ %_tmpfilesdir @tmpfilesdir@ -%_sysusersdir @sysusersdir@ %_sysctldir @sysctldir@ -%_binfmtdir @binfmtdir@ %systemd_requires \ Requires(post): systemd \ @@ -39,71 +37,42 @@ %systemd_post() \ if [ $1 -eq 1 ] ; then \ # Initial installation \ - systemctl preset %{?*} >/dev/null 2>&1 || : \ + @rootbindir@/systemctl preset %{?*} >/dev/null 2>&1 || : \ fi \ %{nil} -%systemd_user_post() %systemd_post --user --global %{?*} - %systemd_preun() \ if [ $1 -eq 0 ] ; then \ # Package removal, not upgrade \ - systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \ - systemctl stop %{?*} > /dev/null 2>&1 || : \ -fi \ -%{nil} - -%systemd_user_preun() \ -if [ $1 -eq 0 ] ; then \ - # Package removal, not upgrade \ - systemctl --no-reload --user --global disable %{?*} > /dev/null 2>&1 || : \ + @rootbindir@/systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \ + @rootbindir@/systemctl stop %{?*} > /dev/null 2>&1 || : \ fi \ %{nil} %systemd_postun() \ -systemctl daemon-reload >/dev/null 2>&1 || : \ +@rootbindir@/systemctl daemon-reload >/dev/null 2>&1 || : \ %{nil} -%systemd_user_postun() %{nil} - %systemd_postun_with_restart() \ -systemctl daemon-reload >/dev/null 2>&1 || : \ +@rootbindir@/systemctl daemon-reload >/dev/null 2>&1 || : \ if [ $1 -ge 1 ] ; then \ # Package upgrade, not uninstall \ - systemctl try-restart %{?*} >/dev/null 2>&1 || : \ + @rootbindir@/systemctl try-restart %{?*} >/dev/null 2>&1 || : \ fi \ %{nil} -%systemd_user_postun_with_restart() %{nil} - %udev_hwdb_update() \ -udevadm hwdb --update >/dev/null 2>&1 || : \ +@rootbindir@/udevadm hwdb --update >/dev/null 2>&1 || : \ %{nil} %udev_rules_update() \ -udevadm control --reload >/dev/null 2>&1 || : \ +@rootbindir@/udevadm control --reload >/dev/null 2>&1 || : \ %{nil} %journal_catalog_update() \ -journalctl --update-catalog >/dev/null 2>&1 || : \ +@rootbindir@/journalctl --update-catalog >/dev/null 2>&1 || : \ %{nil} %tmpfiles_create() \ -systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || : \ -%{nil} - -%sysusers_create() \ -systemd-sysusers %{?*} >/dev/null 2>&1 || : \ -%{nil} - -%sysusers_create_inline() \ -echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || : \ -%{nil} - -%sysctl_apply() \ -@rootlibexecdir@/systemd-sysctl %{?*} >/dev/null 2>&1 || : \ -%{nil} - -%binfmt_apply() \ -@rootlibexecdir@/systemd-binfmt %{?*} >/dev/null 2>&1 || : \ +@rootbindir@/systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || : \ %{nil} ++++++ make-emergency.service-conflict-with-syslog.socket.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -7,19 +7,16 @@ emergency.service. Reference: bnc#852232 ---- - units/emergency.service.in | 1 + - 1 file changed, 1 insertion(+) - -Index: systemd-218/units/emergency.service.in +Index: systemd-208/units/emergency.service.in =================================================================== ---- systemd-218.orig/units/emergency.service.in -+++ systemd-218/units/emergency.service.in -@@ -11,6 +11,7 @@ Documentation=man:sulogin(8) +--- systemd-208/units/emergency.service.in ++++ systemd-208/units/emergency.service.in +@@ -9,7 +9,7 @@ + Description=Emergency Shell + Documentation=man:sulogin(8) DefaultDependencies=no - Conflicts=shutdown.target - Conflicts=rescue.service -+Conflicts=syslog.socket +-Conflicts=shutdown.target ++Conflicts=shutdown.target syslog.socket Before=shutdown.target [Service] ++++++ module-load-handle-SUSE-etc-sysconfig-kernel-module-list.patch ++++++ From: Frederic Crozat <fcrozat@suse.com> Date: Wed, 12 Oct 2011 15:18:29 +0200 Subject: module-load: handle SUSE /etc/sysconfig/kernel module list --- src/modules-load/modules-load.c | 27 ++++++++++++++++++++++++++- units/systemd-modules-load.service.in | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) --- systemd-206_git201308300826.orig/src/modules-load/modules-load.c +++ systemd-206_git201308300826/src/modules-load/modules-load.c @@ -262,6 +262,9 @@ static int parse_argv(int argc, char *ar int main(int argc, char *argv[]) { int r, k; struct kmod_ctx *ctx; +#ifdef HAVE_SYSV_COMPAT + _cleanup_free_ char *modules_on_boot = NULL; +#endif r = parse_argv(argc, argv); if (r <= 0) @@ -318,7 +321,31 @@ int main(int argc, char *argv[]) { r = k; } } - +#ifdef HAVE_SYSV_COMPAT + log_debug("apply: /etc/sysconfig/kernel MODULES_LOADED_ON_BOOT"); + if ((r = parse_env_file("/etc/sysconfig/kernel", NEWLINE, + "MODULES_LOADED_ON_BOOT", &modules_on_boot, + NULL)) < 0) { + if (r != -ENOENT) + log_warning("Failed to read /etc/sysconfig/kernel: %s", strerror(-r)); + else + r = EXIT_SUCCESS; + } else + r = EXIT_SUCCESS; + if (modules_on_boot) { + char **modules = strv_split(modules_on_boot,WHITESPACE); + char **module; + + if (modules) { + STRV_FOREACH(module, modules) { + k = load_module(ctx, *module); + if (k < 0) + r = EXIT_FAILURE; + } + } + strv_free(modules); + } +#endif finish: kmod_unref(ctx); strv_free(arg_proc_cmdline_modules); --- systemd-206_git201308300826.orig/units/systemd-modules-load.service.in +++ systemd-206_git201308300826/units/systemd-modules-load.service.in @@ -13,6 +13,7 @@ Conflicts=shutdown.target After=systemd-readahead-collect.service systemd-readahead-replay.service Before=sysinit.target shutdown.target ConditionCapability=CAP_SYS_MODULE +ConditionPathExists=|/etc/sysconfig/kernel ConditionDirectoryNotEmpty=|/lib/modules-load.d ConditionDirectoryNotEmpty=|/usr/lib/modules-load.d ConditionDirectoryNotEmpty=|/usr/local/lib/modules-load.d ++++++ optionally-warn-if-nss-myhostname-is-called.patch ++++++ From: Ludwig Nussel <ludwig.nussel@suse.de> Date: Fri, 20 May 2011 15:38:46 +0200 Subject: optionally warn if nss-myhostname is called --- configure.ac | 11 +++++++++++ src/nss-myhostname/nss-myhostname.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) --- systemd-206_git201308300826.orig/configure.ac +++ systemd-206_git201308300826/configure.ac @@ -817,6 +817,17 @@ if test "x$enable_myhostname" != "xno"; fi AM_CONDITIONAL(HAVE_MYHOSTNAME, [test "$have_myhostname" = "yes"]) +if test "x$have_myhostname" != "xno"; then + AC_MSG_CHECKING([log warning messages for nss-myhostname]) + AC_ARG_WITH(nss-my-hostname-warning, AS_HELP_STRING([--with-nss-my-hostname-warning], [log warning to syslog when nss-myhostname is called (default=no)]),[],[with_nss_my_hostname_warning=no]) + AC_MSG_RESULT([$with_nss_my_hostname_warning]) + + if test x$with_nss_my_hostname_warning != xno; then + AC_CHECK_HEADERS([syslog.h]) + AC_DEFINE([LOG_NSS_MY_HOSTNAME_WARNING],[1],[whether to log warning message for nss-myhostname]) + fi +fi + # ------------------------------------------------------------------------------ AC_ARG_WITH(firmware-path, AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], --- systemd-206_git201308300826.orig/src/nss-myhostname/nss-myhostname.c +++ systemd-206_git201308300826/src/nss-myhostname/nss-myhostname.c @@ -29,6 +29,9 @@ #include <net/if.h> #include <stdlib.h> #include <arpa/inet.h> +#ifdef LOG_NSS_MY_HOSTNAME_WARNING +#include <syslog.h> +#endif #include "ifconf.h" #include "macro.h" @@ -47,6 +50,10 @@ #define LOCALADDRESS_IPV6 &in6addr_loopback #define LOOPBACK_INTERFACE "lo" +#ifdef LOG_NSS_MY_HOSTNAME_WARNING +static void warn(const char* hn); +#endif + enum nss_status _nss_myhostname_gethostbyname4_r( const char *name, struct gaih_addrtuple **pat, @@ -129,6 +136,9 @@ enum nss_status _nss_myhostname_gethostb return NSS_STATUS_NOTFOUND; } +#ifdef LOG_NSS_MY_HOSTNAME_WARNING + warn(hn); +#endif /* If this fails, n_addresses is 0. Which is fine */ ifconf_acquire_addresses(&addresses, &n_addresses); @@ -382,6 +392,9 @@ enum nss_status _nss_myhostname_gethostb local_address_ipv4 = LOCALADDRESS_IPV4; } +#ifdef LOG_NSS_MY_HOSTNAME_WARNING + warn(hn); +#endif return fill_in_hostent( canonical, additional, af, @@ -509,6 +522,9 @@ found: canonical = hn; } +#ifdef LOG_NSS_MY_HOSTNAME_WARNING + warn(hn); +#endif return fill_in_hostent( canonical, additional, af, @@ -537,3 +553,19 @@ enum nss_status _nss_myhostname_gethostb errnop, h_errnop, NULL); } + +#ifdef LOG_NSS_MY_HOSTNAME_WARNING +static void warn(const char* hn) { + if (strstr(program_invocation_short_name, "nscd")) { + syslog(LOG_WARNING, + "Some application tried to resolve hostname \"%s\" which is not in DNS. Stop nscd to find out which one.\n", + hn); + } else { + syslog(LOG_WARNING, + "%s(%u) tried to resolve hostname \"%s\" which is not in DNS. This might be the reason for the delays you experience.\n", + program_invocation_short_name, + getpid(), + hn); + } +} +#endif ++++++ parse-crypttab-for-noauto-option.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -1,14 +1,14 @@ --- - src/fstab-generator/fstab-generator.c | 45 +++++++++++++++++++++++++++++++++- - 1 file changed, 44 insertions(+), 1 deletion(-) + src/fstab-generator/fstab-generator.c | 52 ++++++++++++++++++++++++++++++++-- + 1 file changed, 50 insertions(+), 2 deletions(-) -Index: systemd/src/fstab-generator/fstab-generator.c +Index: systemd-210/src/fstab-generator/fstab-generator.c =================================================================== ---- systemd.orig/src/fstab-generator/fstab-generator.c -+++ systemd/src/fstab-generator/fstab-generator.c -@@ -48,6 +48,49 @@ static char *arg_usr_what = NULL; - static char *arg_usr_fstype = NULL; - static char *arg_usr_options = NULL; +--- systemd-210.orig/src/fstab-generator/fstab-generator.c ++++ systemd-210/src/fstab-generator/fstab-generator.c +@@ -37,6 +37,50 @@ + static const char *arg_dest = "/tmp"; + static bool arg_enabled = true; +static int check_crypttab(const char *what) { + _cleanup_fclose_ FILE *f = NULL; @@ -53,15 +53,26 @@ + return 1; +} + - static int add_swap( - const char *what, - struct mntent *me, -@@ -118,7 +161,7 @@ static int add_swap( - if (r < 0) - return r; ++ + static int mount_find_pri(struct mntent *me, int *ret) { + char *end, *pri; + unsigned long r; +@@ -212,7 +256,7 @@ static int add_mount( + *name = NULL, *unit = NULL, *lnk = NULL, + *automount_name = NULL, *automount_unit = NULL; + _cleanup_fclose_ FILE *f = NULL; +- int r; ++ int r, c; + + assert(what); + assert(where); +@@ -288,7 +332,8 @@ static int add_mount( + return -errno; + } - if (!noauto) { -+ if (!noauto && check_crypttab(what) != 0) { - lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET, - nofail ? ".wants/" : ".requires/", name, NULL); - if (!lnk) ++ c = check_crypttab(what); ++ if (!noauto && (c != 0)) { + if (post) { + lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL); + if (!lnk) ++++++ plymouth-quit-and-wait-for-emergency-service.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -1,47 +1,35 @@ ---- - units/console-shell.service.m4.in | 2 ++ - units/emergency.service.in | 3 ++- - units/rescue.service.in | 3 ++- - 3 files changed, 6 insertions(+), 2 deletions(-) - -Index: systemd/units/console-shell.service.m4.in -=================================================================== ---- systemd.orig/units/console-shell.service.m4.in -+++ systemd/units/console-shell.service.m4.in +--- systemd-208/units/console-shell.service.m4.in ++++ systemd-208/units/console-shell.service.m4.in 2014-02-05 11:28:31.446735287 +0000 @@ -17,6 +17,8 @@ Before=getty.target [Service] Environment=HOME=/root WorkingDirectory=/root +ExecStartPre=-/usr/bin/plymouth quit +ExecStartPre=-/usr/bin/plymouth --wait - ExecStart=-@SULOGIN@ + ExecStart=-/usr/sbin/sulogin ExecStopPost=-@SYSTEMCTL@ poweroff Type=idle -Index: systemd/units/emergency.service.in -=================================================================== ---- systemd.orig/units/emergency.service.in -+++ systemd/units/emergency.service.in -@@ -17,7 +17,8 @@ Before=shutdown.target +--- systemd-208/units/rescue.service.m4.in ++++ systemd-208/units/rescue.service.m4.in 2014-02-05 11:28:45.214235524 +0000 +@@ -16,7 +16,8 @@ Before=shutdown.target [Service] Environment=HOME=/root WorkingDirectory=/root -ExecStartPre=-/bin/plymouth quit +ExecStartPre=-/usr/bin/plymouth quit +ExecStartPre=-/usr/bin/plymouth --wait - ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.' - ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default" - Type=idle -Index: systemd/units/rescue.service.in -=================================================================== ---- systemd.orig/units/rescue.service.in -+++ systemd/units/rescue.service.in -@@ -16,7 +16,8 @@ Before=shutdown.target + ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.' + ExecStart=-/usr/sbin/sulogin + ExecStopPost=-@SYSTEMCTL@ --fail --no-block default +--- systemd-208/units/emergency.service.in ++++ systemd-208/units/emergency.service.in 2014-02-05 11:28:51.782235282 +0000 +@@ -15,7 +15,8 @@ Before=shutdown.target [Service] Environment=HOME=/root WorkingDirectory=/root -ExecStartPre=-/bin/plymouth quit +ExecStartPre=-/usr/bin/plymouth quit +ExecStartPre=-/usr/bin/plymouth --wait - ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.' - ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default" - Type=idle + ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" to try again\\nto boot into default mode.' + ExecStart=-/usr/sbin/sulogin + ExecStopPost=@SYSTEMCTL@ --fail --no-block default ++++++ prepare-suspend-to-disk.patch ++++++ diff -Naur systemd-210/units/systemd-hibernate.service.in systemd-210-mod/units/systemd-hibernate.service.in --- systemd-210/units/systemd-hibernate.service.in 2013-08-13 22:02:52.808756274 +0200 +++ systemd-210-mod/units/systemd-hibernate.service.in 2014-03-25 12:27:44.995995220 +0100 @@ -11,7 +11,10 @@ DefaultDependencies=no Requires=sleep.target After=sleep.target +ConditionKernelCommandLine=resume [Service] Type=oneshot +ExecStart=@rootbindir@/systemd-sleep-grub pre ExecStart=@rootlibexecdir@/systemd-sleep hibernate +ExecStopPost=@rootbindir@/systemd-sleep-grub post diff -Naur systemd-210/units/systemd-hybrid-sleep.service.in systemd-210-mod/units/systemd-hybrid-sleep.service.in --- systemd-210/units/systemd-hybrid-sleep.service.in 2013-08-13 22:02:52.809756282 +0200 +++ systemd-210-mod/units/systemd-hybrid-sleep.service.in 2014-03-25 12:27:56.115994902 +0100 @@ -11,7 +11,10 @@ DefaultDependencies=no Requires=sleep.target After=sleep.target +ConditionKernelCommandLine=resume [Service] Type=oneshot +ExecStart=@rootbindir@/systemd-sleep-grub pre ExecStart=@rootlibexecdir@/systemd-sleep hybrid-sleep +ExecStopPost=@rootbindir@/systemd-sleep-grub post ++++++ remain_after_exit-initscript-heuristic-and-add-new-LSB-hea.patch ++++++ From: Frederic Crozat <fcrozat@suse.com> Date: Wed, 7 Dec 2011 15:15:07 +0000 Subject: remain_after_exit initscript heuristic and add new LSB headers Add remain_after_exit heuristic for initscripts and add LSB headers PIDFile: and X-Systemd-RemainAfterExit to control it. (bnc#721426) (bnc#727771) --- src/core/service.c | 34 ++++++++++++++++++++++++++++++++-- src/core/service.h | 1 + 2 files changed, 33 insertions(+), 2 deletions(-) Index: systemd-208/src/core/service.c =================================================================== --- systemd-208.orig/src/core/service.c +++ systemd-208/src/core/service.c @@ -135,6 +135,7 @@ static void service_init(Unit *u) { #ifdef HAVE_SYSV_COMPAT s->sysv_start_priority = -1; s->sysv_start_priority_from_rcnd = -1; + s->sysv_remain_after_exit_heuristic = true; #endif s->socket_fd = -1; s->guess_main_pid = true; @@ -883,6 +884,34 @@ static int service_load_sysv_path(Servic free(short_description); short_description = d; + } else if (startswith_no_case(t, "PIDFile:")) { + char *fn; + + state = LSB; + + fn = strstrip(t+8); + if (!path_is_absolute(fn)) { + log_warning("[%s:%u] PID file not absolute. Ignoring.", path, line); + continue; + } + + if (!(fn = strdup(fn))) { + r = -ENOMEM; + goto finish; + } + + free(s->pid_file); + s->pid_file = fn; + s->sysv_remain_after_exit_heuristic = false; + s->remain_after_exit = false; + } else if (startswith_no_case(t, "X-Systemd-RemainAfterExit:")) { + char *j; + + state = LSB; + if ((j = strstrip(t+26)) && *j) { + s->remain_after_exit = parse_boolean(j); + s->sysv_remain_after_exit_heuristic = false; + } } else if (state == LSB_DESCRIPTION) { if (startswith(l, "#\t") || startswith(l, "# ")) { @@ -933,7 +962,8 @@ static int service_load_sysv_path(Servic /* Special setting for all SysV services */ s->type = SERVICE_FORKING; - s->remain_after_exit = !s->pid_file; + if (s->sysv_remain_after_exit_heuristic) + s->remain_after_exit = !s->pid_file; s->guess_main_pid = false; s->restart = SERVICE_RESTART_NO; s->exec_context.ignore_sigpipe = false; @@ -2080,7 +2110,7 @@ static void service_enter_running(Servic if ((main_pid_ok > 0 || (main_pid_ok < 0 && cgroup_ok != 0)) && (s->bus_name_good || s->type != SERVICE_DBUS)) { #ifdef HAVE_SYSV_COMPAT - if (s->sysv_enabled && !s->pid_file) + if (s->sysv_enabled && !s->pid_file && s->sysv_remain_after_exit_heuristic) s->remain_after_exit = false; #endif service_set_state(s, SERVICE_RUNNING); Index: systemd-208/src/core/service.h =================================================================== --- systemd-208.orig/src/core/service.h +++ systemd-208/src/core/service.h @@ -178,6 +178,7 @@ struct Service { bool is_sysv:1; bool sysv_has_lsb:1; bool sysv_enabled:1; + bool sysv_remain_after_exit_heuristic:1; int sysv_start_priority_from_rcnd; int sysv_start_priority; ++++++ respect-nfs-bg-option.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -1,22 +1,19 @@ ---- - src/fstab-generator/fstab-generator.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -Index: systemd-218/src/fstab-generator/fstab-generator.c -=================================================================== ---- systemd-218.orig/src/fstab-generator/fstab-generator.c -+++ systemd-218/src/fstab-generator/fstab-generator.c -@@ -238,8 +238,11 @@ static int add_mount( - "Documentation=man:fstab(5) man:systemd-fstab-generator(8)\n", - source); +--- systemd-210/src/fstab-generator/fstab-generator.c 2014-02-17 15:49:21.070855641 +0100 ++++ systemd-210/src/fstab-generator/fstab-generator.c 2014-04-25 16:25:13.256106126 +0200 +@@ -255,10 +255,12 @@ + "SourcePath=%s\n", + source); - if (post && !noauto && !nofail && !automount) -- fprintf(f, "Before=%s\n", post); +- fprintf(f, +- "Before=%s\n", +- post); + if (post && !noauto && !nofail && !automount) { -+ bool is_nfs = fstype != NULL && streq(fstype, "nfs"); -+ if (!is_nfs || strstr(opts, "bg") == NULL) -+ fprintf(f, "Before=%s\n", post); ++ if (!streq(type, "nfs") || (streq(type, "nfs") && !strstr(opts, "bg"))) ++ fprintf(f, ++ "Before=%s\n", ++ post); + } - if (passno != 0) { - r = generator_write_fsck_deps(f, arg_dest, what, where, fstype); + r = add_fsck(f, what, where, type, passno); + if (r < 0) ++++++ restore-var-run-and-var-lock-bind-mount-if-they-aren-t-sym.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -3,20 +3,18 @@ Subject: restore /var/run and /var/lock bind mount if they aren't symlink --- - Makefile.am | 9 +++++++++ - units/var-lock.mount | 19 +++++++++++++++++++ - units/var-run.mount | 19 +++++++++++++++++++ + Makefile.am | 9 +++++++++ + units/var-lock.mount | 19 +++++++++++++++++++ + units/var-run.mount | 19 +++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 units/var-lock.mount create mode 100644 units/var-run.mount -Index: systemd-218/Makefile.am -=================================================================== ---- systemd-218.orig/Makefile.am -+++ systemd-218/Makefile.am -@@ -516,6 +516,12 @@ endif - dist_systemunit_DATA_busnames += \ - units/busnames.target +--- systemd-206_git201308300826.orig/Makefile.am ++++ systemd-206_git201308300826/Makefile.am +@@ -419,6 +419,12 @@ dist_systemunit_DATA = \ + units/system-update.target \ + units/initrd-switch-root.target +if HAVE_SYSV_COMPAT +dist_systemunit_DATA += \ @@ -27,7 +25,7 @@ nodist_systemunit_DATA = \ units/getty@.service \ units/serial-getty@.service \ -@@ -6086,6 +6092,9 @@ RUNLEVEL4_TARGET_WANTS += \ +@@ -4379,6 +4385,9 @@ RUNLEVEL4_TARGET_WANTS += \ systemd-update-utmp-runlevel.service RUNLEVEL5_TARGET_WANTS += \ systemd-update-utmp-runlevel.service @@ -35,12 +33,10 @@ + var-run.mount \ + var-lock.mount endif - SYSINIT_TARGET_WANTS += \ -Index: systemd-218/units/var-lock.mount -=================================================================== + systemd-update-utmp.service --- /dev/null -+++ systemd-218/units/var-lock.mount ++++ systemd-206_git201308300826/units/var-lock.mount @@ -0,0 +1,19 @@ +# This file is part of systemd. +# @@ -61,10 +57,8 @@ +Where=/var/lock +Type=bind +Options=bind -Index: systemd-218/units/var-run.mount -=================================================================== --- /dev/null -+++ systemd-218/units/var-run.mount ++++ systemd-206_git201308300826/units/var-run.mount @@ -0,0 +1,19 @@ +# This file is part of systemd. +# ++++++ service-flags-sysv-service-with-detected-pid-as-RemainAfte.patch ++++++ From: Frederic Crozat <fcrozat@suse.com> Date: Fri, 30 Sep 2011 12:58:17 +0200 Subject: service: flags sysv service with detected pid as RemainAfterExit=false LSB header doesn't give pidfile, so all LSB initscripts have RemainAfterExit=false, causing daemon termination to not be reported as such by systemd. Checking at startup if daemon is still running for sysv initscript to disable RemainAfterExit helps a lot. Fixes https://bugzilla.novell.com/show_bug.cgi?id=721426 --- src/core/service.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- systemd-206_git201308300826.orig/src/core/service.c +++ systemd-206_git201308300826/src/core/service.c @@ -2100,8 +2100,13 @@ static void service_enter_running(Servic cgroup_ok = cgroup_good(s); if ((main_pid_ok > 0 || (main_pid_ok < 0 && cgroup_ok != 0)) && - (s->bus_name_good || s->type != SERVICE_DBUS)) + (s->bus_name_good || s->type != SERVICE_DBUS)) { +#ifdef HAVE_SYSV_COMPAT + if (s->sysv_enabled && !s->pid_file) + s->remain_after_exit = false; +#endif service_set_state(s, SERVICE_RUNNING); + } else if (s->remain_after_exit) service_set_state(s, SERVICE_EXITED); else ++++++ set-and-use-default-logconsole.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -6,8 +6,10 @@ src/journal/journald-server.c | 5 ++ 3 files changed, 105 insertions(+) ---- systemd-219.orig/src/journal/journald-console.c -+++ systemd-219/src/journal/journald-console.c +Index: src/journal/journald-console.c +=================================================================== +--- src/journal/journald-console.c.orig ++++ src/journal/journald-console.c @@ -23,6 +23,14 @@ #include <fcntl.h> #include <unistd.h> @@ -23,13 +25,13 @@ #include "fileio.h" #include "journald-server.h" -@@ -43,6 +51,76 @@ static bool prefix_timestamp(void) { +@@ -43,6 +51,74 @@ static bool prefix_timestamp(void) { return cached_printk_time; } ++#ifdef HAVE_SYSV_COMPAT +void defaul_tty_path(Server *s) +{ -+#ifdef HAVE_SYSV_COMPAT + static const char list[] = "/dev/tty10\0" "/dev/console\0"; + const char *vc; + @@ -49,12 +51,10 @@ + s->tty_path = strdup(vc); + break; + } -+#endif +} + +void klogconsole(Server *s) +{ -+#ifdef HAVE_SYSV_COMPAT + _cleanup_free_ char *klogconsole_params = NULL; + _cleanup_close_ int fd = -1; + const char *vc = s->tty_path; @@ -94,29 +94,27 @@ + num = klogconsole_params + strcspn(klogconsole_params, "0123456789"); + if (safe_atoi(num, &r) == 0) + klogctl(8, 0, r); -+#endif +} ++#endif + void server_forward_console( Server *s, int priority, -@@ -64,6 +142,12 @@ void server_forward_console( +@@ -64,6 +140,10 @@ void server_forward_console( if (LOG_PRI(priority) > s->max_level_console) return; -+#ifdef HAVE_SYSV_COMPAT + /* Do not write security/authorization (private) messages to console */ + if ((priority & LOG_FACMASK) == LOG_AUTHPRIV) + return; -+#endif + /* First: timestamp */ if (prefix_timestamp()) { assert_se(clock_gettime(CLOCK_MONOTONIC, &ts) == 0); -@@ -100,7 +184,23 @@ void server_forward_console( +@@ -101,7 +181,23 @@ void server_forward_console( fd = open_terminal(tty, O_WRONLY|O_NOCTTY|O_CLOEXEC); if (fd < 0) { - log_debug_errno(errno, "Failed to open %s for logging: %m", tty); + log_debug("Failed to open %s for logging: %m", tty); +#ifdef HAVE_SYSV_COMPAT + if (fd != -ENOENT && fd != -ENODEV) + return; @@ -137,18 +135,23 @@ } if (writev(fd, iovec, n) < 0) ---- systemd-219.orig/src/journal/journald-console.h -+++ systemd-219/src/journal/journald-console.h -@@ -24,3 +24,6 @@ +Index: src/journal/journald-console.h +=================================================================== +--- src/journal/journald-console.h.orig ++++ src/journal/journald-console.h +@@ -24,3 +24,7 @@ #include "journald-server.h" - void server_forward_console(Server *s, int priority, const char *identifier, const char *message, const struct ucred *ucred); -+ + void server_forward_console(Server *s, int priority, const char *identifier, const char *message, struct ucred *ucred); ++#ifdef HAVE_SYSV_COMPAT +void klogconsole(Server *s); +void defaul_tty_path(Server *s); ---- systemd-219.orig/src/journal/journald-server.c -+++ systemd-219/src/journal/journald-server.c -@@ -1520,6 +1520,11 @@ int server_init(Server *s) { ++#endif +Index: src/journal/journald-server.c +=================================================================== +--- src/journal/journald-server.c.orig ++++ src/journal/journald-server.c +@@ -1509,6 +1509,11 @@ int server_init(Server *s) { server_parse_config_file(s); server_parse_proc_cmdline(s); @@ -158,5 +161,5 @@ + klogconsole(s); + if (!!s->rate_limit_interval ^ !!s->rate_limit_burst) { - log_debug("Setting both rate limit interval and burst from "USEC_FMT",%u to 0,0", - s->rate_limit_interval, s->rate_limit_burst); + log_debug("Setting both rate limit interval and burst from %llu,%u to 0,0", + (long long unsigned) s->rate_limit_interval, ++++++ shut-up-annoying-assertion-monotonic-clock-message.patch ++++++ Stop flooding the kernel's message ring buffer with useless messages on dual_timestamp_is_set is failed. This is a backport from upstream code. --- src/libsystemd/sd-event/sd-event.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- systemd-210/src/libsystemd/sd-event/sd-event.c +++ systemd-210/src/libsystemd/sd-event/sd-event.c 2014-05-02 10:01:23.366235185 +0000 @@ -2191,9 +2191,12 @@ _public_ int sd_event_exit(sd_event *e, _public_ int sd_event_get_now_realtime(sd_event *e, uint64_t *usec) { assert_return(e, -EINVAL); assert_return(usec, -EINVAL); - assert_return(dual_timestamp_is_set(&e->timestamp), -ENODATA); assert_return(!event_pid_changed(e), -ECHILD); + /* If we haven't run yet, just get the actual time */ + if (!dual_timestamp_is_set(&e->timestamp)) + return -ENODATA; + *usec = e->timestamp.realtime; return 0; } @@ -2201,9 +2204,12 @@ _public_ int sd_event_get_now_realtime(s _public_ int sd_event_get_now_monotonic(sd_event *e, uint64_t *usec) { assert_return(e, -EINVAL); assert_return(usec, -EINVAL); - assert_return(dual_timestamp_is_set(&e->timestamp), -ENODATA); assert_return(!event_pid_changed(e), -ECHILD); + /* If we haven't run yet, just get the actual time */ + if (!dual_timestamp_is_set(&e->timestamp)) + return -ENODATA; + *usec = e->timestamp.monotonic; return 0; } ++++++ shut-up-rpmlint-on-var-log-journal.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -1,12 +1,6 @@ ---- - Makefile.am | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -Index: systemd-218/Makefile.am -=================================================================== ---- systemd-218.orig/Makefile.am -+++ systemd-218/Makefile.am -@@ -4209,11 +4209,11 @@ noinst_LTLIBRARIES += \ +--- systemd-210/Makefile.am ++++ systemd-210/Makefile.am 2014-07-28 09:05:41.002735451 +0000 +@@ -3242,11 +3242,11 @@ noinst_LTLIBRARIES += \ libsystemd-journal-core.la journal-install-hook: @@ -22,4 +16,4 @@ + -@echo setfacl -nm g:wheel:rx,d:g:wheel:rx $(DESTDIR)/var/log/journal/ journal-uninstall-hook: - -rmdir $(DESTDIR)/var/log/journal/remote + -rmdir $(DESTDIR)/var/log/journal/ ++++++ sysctl-handle-boot-sysctl.conf-kernel_release.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -6,14 +6,14 @@ Add support for kernel release sysctl.conf files (for per-flavor configuration), needed by openSUSE (bnc#809420). --- - src/sysctl/sysctl.c | 8 ++++++++ - units/systemd-sysctl.service.in | 2 ++ - 2 files changed, 10 insertions(+) + src/sysctl/sysctl.c | 8 ++++++++ + units/systemd-sysctl.service.in | 1 + + 2 files changed, 9 insertions(+) -Index: systemd-218/src/sysctl/sysctl.c +Index: systemd-207/src/sysctl/sysctl.c =================================================================== ---- systemd-218.orig/src/sysctl/sysctl.c -+++ systemd-218/src/sysctl/sysctl.c +--- systemd-207.orig/src/sysctl/sysctl.c ++++ systemd-207/src/sysctl/sysctl.c @@ -26,6 +26,7 @@ #include <stdio.h> #include <limits.h> @@ -22,7 +22,7 @@ #include "log.h" #include "strv.h" -@@ -310,6 +311,13 @@ int main(int argc, char *argv[]) { +@@ -299,6 +300,13 @@ int main(int argc, char *argv[]) { } else { _cleanup_strv_free_ char **files = NULL; char **f; @@ -36,14 +36,14 @@ r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs); if (r < 0) { -Index: systemd-218/units/systemd-sysctl.service.in +Index: systemd-207/units/systemd-sysctl.service.in =================================================================== ---- systemd-218.orig/units/systemd-sysctl.service.in -+++ systemd-218/units/systemd-sysctl.service.in -@@ -13,6 +13,8 @@ Conflicts=shutdown.target - After=systemd-modules-load.service - Before=sysinit.target shutdown.target - ConditionPathIsReadWrite=/proc/sys/ +--- systemd-207.orig/units/systemd-sysctl.service.in ++++ systemd-207/units/systemd-sysctl.service.in +@@ -19,6 +19,8 @@ ConditionDirectoryNotEmpty=|/usr/lib/sys + ConditionDirectoryNotEmpty=|/usr/local/lib/sysctl.d + ConditionDirectoryNotEmpty=|/etc/sysctl.d + ConditionDirectoryNotEmpty=|/run/sysctl.d +ConditionPathExistsGlob=|/boot/sysctl.conf-%v +RequiresMountsFor=/boot ++++++ systemctl-set-default-target.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:05.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:05.000000000 +0100 @@ -3,14 +3,12 @@ This solves the bug bnc#868439 --- - man/systemctl.xml | 4 +++- + systemctl.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -Index: systemd/man/systemctl.xml -=================================================================== ---- systemd.orig/man/systemctl.xml -+++ systemd/man/systemctl.xml -@@ -445,7 +445,7 @@ along with systemd; If not, see <http:// +--- systemd-210/man/systemctl.xml ++++ systemd-210/man/systemctl.xml 2014-03-19 12:19:53.182235657 +0000 +@@ -371,7 +371,7 @@ along with systemd; If not, see <http:// <term><option>--force</option></term> <listitem> @@ -19,12 +17,12 @@ any existing conflicting symlinks.</para> <para>When used with <command>halt</command>, -@@ -1215,6 +1215,8 @@ kobject-uevent 1 systemd-udevd-kernel.so - <para>Return the default target to boot into. This returns - the target unit name <filename>default.target</filename> - is aliased (symlinked) to.</para> +@@ -1036,6 +1036,8 @@ kobject-uevent 1 systemd-udevd-kernel.so + <listitem> + <para>Set the default target to boot into. Command links + <filename>default.target</filename> to the given unit.</para> + <para>If combined with <option>--force</option>, override + an already existing symlink for the default target.</para> </listitem> </varlistentry> - + </variablelist> ++++++ systemd-219.tar.xz -> systemd-210.tar.xz ++++++ ++++ 588149 lines of diff (skipped) ++++++ systemd-add-user-keep.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:08.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:08.000000000 +0100 @@ -1,27 +1,25 @@ ---- - man/tmpfiles.d.xml | 3 +++ - src/tmpfiles/tmpfiles.c | 48 ++++++++++++++++++++++++++++++++++++++++-------- - 2 files changed, 43 insertions(+), 8 deletions(-) - -Index: systemd/man/tmpfiles.d.xml -=================================================================== ---- systemd.orig/man/tmpfiles.d.xml -+++ systemd/man/tmpfiles.d.xml -@@ -489,6 +489,9 @@ - <varname>f</varname>, <varname>F</varname>, and - <varname>w</varname> may be used to specify a short string that - is written to the file, suffixed by a newline. For -+ <varname>x</varname>, <varname>X</varname>, a comma separated list of -+ usernames. If given, only paths belonging to these users will be excluded -+ during directory cleanup. Ignored for all other lines. For - <varname>C</varname>, specifies the source file or - directory. For <varname>t</varname> determines extended - attributes to be set. For <varname>a</varname> determines -Index: systemd/src/tmpfiles/tmpfiles.c -=================================================================== ---- systemd.orig/src/tmpfiles/tmpfiles.c -+++ systemd/src/tmpfiles/tmpfiles.c -@@ -345,6 +345,7 @@ static int dir_cleanup( +diff -Naur systemd-210/man/tmpfiles.d.xml systemd-210.mod/man/tmpfiles.d.xml +--- systemd-210/man/tmpfiles.d.xml 2014-12-18 09:40:29.403629407 +0100 ++++ systemd-210.mod/man/tmpfiles.d.xml 2014-12-18 10:34:06.274130934 +0100 +@@ -435,8 +435,12 @@ + <varname>f</varname>, <varname>F</varname>, + and <varname>w</varname> may be used to + specify a short string that is written to the +- file, suffixed by a newline. Ignored for all +- other lines.</para> ++ file, suffixed by a newline. ++ For <varname>x</varname>, <varname>X</varname> ++ a comma separated list of usernames. If given, ++ only paths belonging to these users will be ++ excluded during directory cleanup. ++ Ignored for all other lines.</para> + </refsect2> + + </refsect1> +diff -Naur systemd-210/src/tmpfiles/tmpfiles.c systemd-210.mod/src/tmpfiles/tmpfiles.c +--- systemd-210/src/tmpfiles/tmpfiles.c 2014-12-18 09:40:29.342629177 +0100 ++++ systemd-210.mod/src/tmpfiles/tmpfiles.c 2014-12-18 11:58:16.686576974 +0100 +@@ -263,6 +263,7 @@ struct timespec times[2]; bool deleted = false; int r = 0; @@ -29,57 +27,52 @@ while ((dent = readdir(d))) { struct stat s; -@@ -395,14 +396,45 @@ static int dir_cleanup( +@@ -306,11 +307,43 @@ } /* Is there an item configured for this path? */ -- if (hashmap_get(items, sub_path)) { -- log_debug("Ignoring \"%s\": a separate entry exists.", sub_path); +- if (hashmap_get(items, sub_path)) - continue; -- } - -- if (find_glob(globs, sub_path)) { -- log_debug("Ignoring \"%s\": a separate glob exists.", sub_path); +- if (find_glob(globs, sub_path)) - continue; -+ bool found_glob = false; + found = hashmap_get(items, sub_path); -+ if (!found) { -+ found_glob = true; -+ found = find_glob(globs, sub_path); -+ } -+ if (found) { -+ struct passwd *pw; -+ char *userfound = NULL, *args; -+ bool match = false; -+ uid_t uid = -1; ++ ++ if (!found) ++ found = find_glob(globs, sub_path); + ++ if (found) { + /* evaluate username arguments in ignore statements */ -+ if ((found->type != IGNORE_PATH && found->type != IGNORE_DIRECTORY_PATH) || -+ !found->argument) { -+ if (found_glob) -+ log_debug("Ignoring \"%s\": a separate glob exists.", sub_path); -+ else -+ log_debug("Ignoring \"%s\": a separate entry exists.", sub_path); -+ continue; -+ } -+ args = strdup(found->argument); -+ assert_se(args != NULL); -+ while ((userfound = strsep(&args, ",")) != NULL) { -+ pw = getpwnam(userfound); -+ if (pw == NULL) { -+ log_error("Unknown user '%s' in ignore statement.", userfound); -+ continue; -+ } -+ uid = pw->pw_uid; -+ if (s.st_uid == uid) { -+ match = true; -+ break; ++ if (found->type == IGNORE_PATH || found->type == IGNORE_DIRECTORY_PATH) { ++ if (!found->argument) ++ continue; ++ else { ++ struct passwd *pw; ++ char *userfound = NULL, *args = strdup(found->argument); ++ bool match = false; ++ int uid = -1; ++ ++ while ((userfound = strsep(&args, ","))) { ++ pw = getpwnam(userfound); ++ ++ if (!pw) ++ log_error("Unknown user '%s' in ignore statement.", userfound); ++ else { ++ uid = pw->pw_uid; ++ if (s.st_uid == uid) { ++ match = true; ++ break; ++ } ++ } ++ } ++ if (match) { ++ found = NULL; ++ continue; ++ } + } -+ } -+ if (match) { -+ found = NULL; -+ continue; -+ } - } ++ } else ++ continue; ++ } if (S_ISDIR(s.st_mode)) { + ++++++ systemd-dbus-system-bus-address.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:08.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:08.000000000 +0100 @@ -1,14 +1,18 @@ ---- - src/libsystemd/sd-bus/sd-bus.c | 4 ++-- - src/shared/def.h | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -Index: systemd/src/libsystemd/sd-bus/sd-bus.c -=================================================================== ---- systemd.orig/src/libsystemd/sd-bus/sd-bus.c -+++ systemd/src/libsystemd/sd-bus/sd-bus.c -@@ -809,8 +809,8 @@ static int parse_container_unix_address( - b->nspid = 0; +--- systemd-210/src/shared/def.h ++++ systemd-210/src/shared/def.h 2014-03-12 13:11:06.502235254 +0000 +@@ -61,7 +61,7 @@ + "/usr/lib/kbd/keymaps/\0" + #endif + +-#define UNIX_SYSTEM_BUS_PATH "unix:path=/var/run/dbus/system_bus_socket" ++#define UNIX_SYSTEM_BUS_PATH "unix:path=/run/dbus/system_bus_socket" + #define KERNEL_SYSTEM_BUS_PATH "kernel:path=/dev/kdbus/0-system/bus" + + #ifdef ENABLE_KDBUS +--- systemd-210/src/libsystemd/sd-bus/sd-bus.c ++++ systemd-210/src/libsystemd/sd-bus/sd-bus.c 2014-03-12 14:31:09.966736492 +0000 +@@ -794,8 +794,8 @@ static int parse_container_unix_address( + machine = NULL; b->sockaddr.un.sun_family = AF_UNIX; - strncpy(b->sockaddr.un.sun_path, "/var/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path)); @@ -18,16 +22,3 @@ return 0; } -Index: systemd/src/shared/def.h -=================================================================== ---- systemd.orig/src/shared/def.h -+++ systemd/src/shared/def.h -@@ -61,7 +61,7 @@ - "/usr/lib/kbd/keymaps/\0" - #endif - --#define UNIX_SYSTEM_BUS_ADDRESS "unix:path=/var/run/dbus/system_bus_socket" -+#define UNIX_SYSTEM_BUS_ADDRESS "unix:path=/run/dbus/system_bus_socket" - #define KERNEL_SYSTEM_BUS_ADDRESS "kernel:path=/sys/fs/kdbus/0-system/bus" - - #ifdef ENABLE_KDBUS ++++++ systemd-journald.init ++++++ #! /bin/sh # # Copyright (c) 2001-2002 SuSE Linux AG, Nuernberg, Germany. # All rights reserved. # # /etc/init.d/systemd-journald # ### BEGIN INIT INFO # Provides: syslog # Required-Start: $null # Required-Stop: $null # Default-Start: 2 3 5 # Default-Stop: # Short-Description: compat wrapper for journald # Description: compat wrapper for journald ### END INIT INFO . /etc/rc.status rc_reset case "$1" in start|stop|restart) rc_failed 3 rc_status -v ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac rc_exit ++++++ systemd-mini-rpmlintrc ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:08.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:08.000000000 +0100 @@ -1,4 +1,3 @@ -addFilter("invalid-pkgconfig-file") addFilter(".*dangling-symlink /sbin/(halt|init|poweroff|telinit|shutdown|runlevel|reboot).*") addFilter(".*dangling-symlink .* /dev/null.*") addFilter(".*files-duplicate .*/reboot\.8.*") @@ -17,7 +16,6 @@ addFilter(".*suse-filelist-forbidden-systemd-userdirs.*") addFilter("libudev-mini.*shlib-policy-name-error.*") addFilter("nss-myhostname.*shlib-policy-name-error.*") -addFilter("nss-mymachines.*shlib-policy-name-error.*") addFilter("systemd-logger.*useless-provides sysvinit(syslog).*") addFilter("devel-file-in-non-devel-package.*/usr/share/pkgconfig/(udev|systemd)\.pc.*") addFilter(".*script-without-shebang.*/usr/lib/udev/rule_generator.functions.*") ++++++ systemd-pam_config.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:08.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:08.000000000 +0100 @@ -1,16 +1,14 @@ ---- - src/login/systemd-user | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -Index: systemd-218/src/login/systemd-user -=================================================================== ---- systemd-218.orig/src/login/systemd-user -+++ systemd-218/src/login/systemd-user -@@ -2,5 +2,5 @@ - # - # Used by systemd --user instances. +diff --git a/src/login/systemd-user b/src/login/systemd-user +index 7b57dbf..c0fc793 100644 +--- a/src/login/systemd-user ++++ b/src/login/systemd-user +@@ -2,7 +2,7 @@ --account include system-auth --session include system-auth -+account include common-account -+session include common-session + # Used by systemd when launching systemd user instances. + +-account include system-auth +-session include system-auth ++account include common-account ++session include common-session + auth required pam_deny.so + password required pam_deny.so ++++++ systemd-powerd-initctl-support.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:08.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:08.000000000 +0100 @@ -12,8 +12,10 @@ src/initctl/initctl.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) ---- systemd-219.orig/src/initctl/initctl.c -+++ systemd-219/src/initctl/initctl.c +diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c +index 468df35..d4794a6 100644 +--- a/src/initctl/initctl.c ++++ b/src/initctl/initctl.c @@ -32,8 +32,11 @@ #include <sys/un.h> #include <fcntl.h> @@ -34,12 +36,11 @@ #define SERVER_FD_MAX 16 #define TIMEOUT_MSEC ((int) (DEFAULT_EXIT_USEC/USEC_PER_MSEC)) -@@ -141,7 +145,54 @@ static void change_runlevel(Server *s, i +@@ -141,7 +145,53 @@ static void change_runlevel(Server *s, int runlevel) { } } +static int send_shutdownd(unsigned delay, char mode, const char *message) { -+#ifdef HAVE_SYSV_COMPAT + usec_t t = now(CLOCK_REALTIME) + delay * USEC_PER_MINUTE; + struct sd_shutdown_command c = { + .usec = t, @@ -80,7 +81,7 @@ + + if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) + return -errno; -+#endif ++ + return 0; +} + @@ -89,7 +90,7 @@ assert(s); assert(req); -@@ -184,9 +235,28 @@ static void request_process(Server *s, c +@@ -184,9 +234,28 @@ static void request_process(Server *s, const struct init_request *req) { return; case INIT_CMD_POWERFAIL: @@ -119,3 +120,6 @@ return; case INIT_CMD_CHANGECONS: +-- +1.8.1.4 + ++++++ systemd-rpmlintrc ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:08.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:08.000000000 +0100 @@ -1,4 +1,3 @@ -addFilter("invalid-pkgconfig-file") addFilter(".*dangling-symlink /sbin/(halt|init|poweroff|telinit|shutdown|runlevel|reboot).*") addFilter(".*dangling-symlink .* /dev/null.*") addFilter(".*files-duplicate .*/reboot\.8.*") @@ -17,7 +16,6 @@ addFilter(".*suse-filelist-forbidden-systemd-userdirs.*") addFilter("libudev-mini.*shlib-policy-name-error.*") addFilter("nss-myhostname.*shlib-policy-name-error.*") -addFilter("nss-mymachines.*shlib-policy-name-error.*") addFilter("systemd-logger.*useless-provides sysvinit(syslog).*") addFilter("devel-file-in-non-devel-package.*/usr/share/pkgconfig/(udev|systemd)\.pc.*") addFilter(".*script-without-shebang.*/usr/lib/udev/rule_generator.functions.*") ++++++ systemd-sleep-grub ++++++ #!/bin/bash # # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. set -x prepare-parameters() { eval `grep LOADER_TYPE= /etc/sysconfig/bootloader` if [ x"$LOADER_TYPE" = "xgrub2" -o x"$LOADER_TYPE" = "xgrub2-efi" ]; then GRUBONCE="/usr/sbin/grub2-once" GRUBDEFAULT="/boot/grub2/grubenv" GRUB2EDITENV="/usr/bin/grub2-editenv" GRUB2CONF="/boot/grub2/grub.cfg" BLKID="/usr/sbin/blkid" getkernels="getkernels-grub2" fi } ##################################################################### # gets a list of available kernels from /boot/grub2/grub.cfg # kernels are in the array $KERNELS, output to stdout to be eval-ed. getkernels-grub2() { local I DUMMY MNT ROOTDEV declare -i I=0 J=-1 # we need the root partition later to decide if this is the kernel to select while read ROOTDEV MNT DUMMY; do [ "$ROOTDEV" = "rootfs" ] && continue # not what we are searching for if [ "$MNT" = "/" ]; then break fi done < /proc/mounts while read LINE; do case $LINE in menuentry\ *) let J++ ;; set\ default*) local DEFAULT=${LINE#*default=} if echo $DEFAULT | grep -q saved_entry ; then local SAVED=`$GRUB2EDITENV $GRUBDEFAULT list | sed -n s/^saved_entry=//p` if [ -n "$SAVED" ]; then DEFAULT_BOOT=$($GRUBONCE --show-mapped "$SAVED") fi fi ;; linux*noresume*|module*xen*noresume*) echo " Skipping grub entry #${J}, because it has the noresume option" >&2 ;; linux*root=*|module*xen*root=*) local ROOT ROOT=${LINE#*root=} DUMMY=($ROOT) ROOT=${DUMMY[0]} if [ x"${ROOT:0:5}" = "xUUID=" ]; then UUID=${ROOT#UUID=} if [ -n "$UUID" ]; then ROOT=$($BLKID -U $UUID) fi fi if [ "$(stat -Lc '%t:%T' $ROOT)" != "$(stat -Lc '%t:%T' $ROOTDEV)" ]; then echo " Skipping grub entry #${J}, because its root= parameter ($ROOT)" >&2 echo " does not match the current root device ($ROOTDEV)." >&2 continue fi DUMMY=($LINE) # kernel (hd0,1)/boot/vmlinuz-ABC root=/dev/hda2 echo "KERNELS[$I]='${DUMMY[1]##*/}'" # vmlinuz-ABC echo "MENU_ENTRIES[$I]=$J" # DEBUG "Found kernel entry #${I}: '${DUMMY[1]##*/}'" INFO let I++ ;; linux*|module*xen*) # a kernel without "root="? We better skip that one... echo " Skipping grub entry #${J}, because it has no root= option" >&2 ;; *) ;; esac done < "$GRUB2CONF" } ############################################################# # runs grubonce from the grub package to select which kernel # to boot on next startup grub-once() { if [ -x "$GRUBONCE" ]; then echo " running '$GRUBONCE $1'" $GRUBONCE $1 else echo "WARNING: $GRUBONCE not found, not preparing bootloader" fi } ############################################################# # restore grub default after (eventually failed) resume grub-once-restore() { echo "INFO: running grub-once-restore" prepare-parameters $GRUB2EDITENV $GRUBDEFAULT unset next_entry } ############################################################################# # try to find a kernel image that matches the actually running kernel. # We need this, if more than one kernel is installed. This works reasonably # well with grub, if all kernels are named "vmlinuz-`uname -r`" and are # located in /boot. If they are not, good luck ;-) find-kernel-entry() { NEXT_BOOT=-1 ARCH=`uname -m` declare -i I=0 # DEBUG "running kernel: $RUNNING" DIAG while [ -n "${KERNELS[$I]}" ]; do BOOTING="${KERNELS[$I]}" if IMAGE=`readlink /boot/$BOOTING` && [ -e "/boot/${IMAGE##*/}" ]; then # DEBUG "Found kernel symlink $BOOTING => $IMAGE" INFO BOOTING=$IMAGE fi case $ARCH in ppc*) BOOTING="${BOOTING#*vmlinux-}" ;; *) BOOTING="${BOOTING#*vmlinuz-}" ;; esac if [ "$RUNNING" == "$BOOTING" ]; then NEXT_BOOT=${MENU_ENTRIES[$I]} echo " running kernel is grub menu entry $NEXT_BOOT (${KERNELS[$I]})" break fi let I++ done # if we have not found a kernel, issue a warning. # if we have found a kernel, we'll do "grub-once" later, after # prepare_suspend finished. if [ $NEXT_BOOT -eq -1 ]; then echo "WARNING: no kernelfile matching the running kernel found" fi } ############################################################################# # if we did not find a kernel (or BOOT_LOADER is not GRUB) check, # if the running kernel is still the one that will (probably) be booted for # resume (default entry in menu.lst or, if there is none, the kernel file # /boot/vmlinuz points to.) # This will only work, if you use "original" SUSE kernels. # you can always override with the config variable set to "yes" prepare-grub() { echo "INFO: running prepare-grub" prepare-parameters eval `$getkernels` RUNNING=`uname -r` find-kernel-entry RET=0 if [ $NEXT_BOOT -eq -1 ]; then # which kernel is booted with the default entry? BOOTING="${KERNELS[$DEFAULT_BOOT]}" # if there is no default entry (no menu.lst?) we fall back to # the default of /boot/vmlinuz. [ -z "$BOOTING" ] && BOOTING="vmlinuz" if IMAGE=`readlink /boot/$BOOTING` && [ -e "/boot/${IMAGE##*/}" ]; then BOOTING=$IMAGE fi BOOTING="${BOOTING#*vmlinuz-}" echo "running kernel: '$RUNNING', probably booting kernel: '$BOOTING'" if [ "$BOOTING" != "$RUNNING" ]; then echo "ERROR: kernel version mismatch, cannot suspend to disk" echo "running: $RUNNING booting: $BOOTING" >> $INHIBIT RET=1 fi else # set the bootloader to the running kernel echo " preparing boot-loader: selecting entry $NEXT_BOOT, kernel /boot/$BOOTING" T1=`date +"%s%N"` sync; sync; sync # this is needed to speed up grub-once on reiserfs T2=`date +"%s%N"` echo " grub-once: `grub-once $NEXT_BOOT`" T3=`date +"%s%N"` S=$(((T2-T1)/100000000)); S="$((S/10)).${S:0-1}" G=$(((T3-T2)/100000000)); G="$((G/10)).${G:0-1}" echo " time needed for sync: $S seconds, time needed for grub: $G seconds." fi return $RET } ###### main() if [ "$1" = pre ] ; then prepare-grub fi if [ "$1" = post ] ; then grub-once-restore fi ++++++ systemd-tmp-safe-defaults.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:08.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:08.000000000 +0100 @@ -5,22 +5,20 @@ Fix regression in the default for tmp auto-deletion (FATE#314974). SUSE policy is to not clean /tmp by default. --- - tmpfiles.d/tmp.conf | 5 +++-- + tmpfiles.d/tmp.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -Index: systemd/tmpfiles.d/tmp.conf -=================================================================== ---- systemd.orig/tmpfiles.d/tmp.conf -+++ systemd/tmpfiles.d/tmp.conf +--- systemd-206.orig/tmpfiles.d/tmp.conf ++++ systemd-206/tmpfiles.d/tmp.conf @@ -8,8 +8,9 @@ # See tmpfiles.d(5) for details # Clear tmp directories separately, to make them easier to override --v /tmp 1777 root root 10d --v /var/tmp 1777 root root 30d +-d /tmp 1777 root root 10d +-d /var/tmp 1777 root root 30d +# SUSE policy: we don't clean those directories -+v /tmp 1777 root root - -+v /var/tmp 1777 root root - ++d /tmp 1777 root root - ++d /var/tmp 1777 root root - # Exclude namespace mountpoints created with PrivateTmp=yes x /tmp/systemd-private-%b-* ++++++ timedate-add-support-for-openSUSE-version-of-etc-sysconfig.patch ++++++ From: Frederic Crozat <fcrozat@suse.com> Date: Tue, 14 Aug 2012 14:26:16 +0200 Subject: timedate: add support for openSUSE version of /etc/sysconfig/clock --- src/timedate/timedated.c | 7 +++++++ 1 file changed, 7 insertions(+) --- systemd-206_git201308300826.orig/src/timedate/timedated.c +++ systemd-206_git201308300826/src/timedate/timedated.c @@ -182,6 +182,13 @@ static int read_data(void) { goto have_timezone; } } +#ifdef HAVE_SYSV_COMPAT + r = parse_env_file("/etc/sysconfig/clock", NEWLINE, + "TIMEZONE", &c->zone, + NULL); + if (r < 0 && r != -ENOENT) + log_warning("Failed to read /etc/sysconfig/clock: %s", strerror(-r)); +#endif have_timezone: if (isempty(c->zone)) { ++++++ tmpfiles-do-not-clean-for-mandb-index-files.patch ++++++ There is no need to clean out all 30 days the index data base files nor the cachedir tags of mandb. Those files are used for whatis(1) as well as for apropos(1). --- systemd-210/tmpfiles.d/systemd.conf | 5 +++++ 1 file changed, 5 insertions(+) --- systemd-210/tmpfiles.d/systemd.conf +++ systemd-210/tmpfiles.d/systemd.conf 2014-06-11 13:47:59.470236564 +0000 @@ -14,6 +14,11 @@ f /var/log/wtmp 0664 root utmp - f /var/log/btmp 0600 root root - d /var/cache/man - - - 30d +# mandb uses data base file which should not be cleared +x /var/cache/man/index.* +x /var/cache/man/CACHEDIR.TAG +x /var/cache/man/*/index.* +x /var/cache/man/*/CACHEDIR.TAG d /run/systemd/ask-password 0755 root root - d /run/systemd/seats 0755 root root - ++++++ tty-ask-password-agent-on-console.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:08.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:08.000000000 +0100 @@ -1,99 +1,110 @@ --- - src/tty-ask-password-agent/tty-ask-password-agent.c | 171 +++++++++++++++++++- - 1 file changed, 166 insertions(+), 5 deletions(-) + src/tty-ask-password-agent/tty-ask-password-agent.c | 190 +++++++++++++++++++- + 1 file changed, 185 insertions(+), 5 deletions(-) -Index: systemd/src/tty-ask-password-agent/tty-ask-password-agent.c -=================================================================== ---- systemd.orig/src/tty-ask-password-agent/tty-ask-password-agent.c -+++ systemd/src/tty-ask-password-agent/tty-ask-password-agent.c -@@ -31,6 +31,10 @@ - #include <getopt.h> - #include <sys/signalfd.h> - #include <fcntl.h> +--- systemd-210/src/tty-ask-password-agent/tty-ask-password-agent.c ++++ systemd-210/src/tty-ask-password-agent/tty-ask-password-agent.c 2014-07-30 10:48:43.602052750 +0000 +@@ -28,8 +28,12 @@ + #include <sys/poll.h> + #include <sys/inotify.h> + #include <unistd.h> +#include <sys/prctl.h> + #include <getopt.h> +#include <signal.h> +#include <sys/wait.h> + #include <sys/signalfd.h> +#include <sys/mman.h> + #include <fcntl.h> #include "util.h" - #include "mkdir.h" -@@ -42,6 +46,9 @@ +@@ -41,6 +45,9 @@ + #include "ask-password-api.h" #include "strv.h" #include "build.h" - #include "def.h" +#include "fileio.h" +#include "macro.h" +#include "list.h" static enum { ACTION_LIST, -@@ -50,6 +57,22 @@ static enum { +@@ -49,6 +56,21 @@ static enum { ACTION_WALL } arg_action = ACTION_QUERY; +struct console { + LIST_FIELDS(struct console, handle); -+ const char *tty; ++ char *tty; + pid_t pid; + int id; -+ char dev[]; +}; + -+static volatile unsigned long *usemask; ++static volatile uint32_t *usemask; +static volatile sig_atomic_t sigchild; +static void chld_handler(int sig) +{ + (void)sig; -+ ++sigchild; ++ sigchild++; +} + static bool arg_plymouth = false; static bool arg_console = false; -@@ -208,6 +231,58 @@ static int ask_password_plymouth( - return 0; +@@ -246,12 +268,77 @@ finish: + return r; } +static const char *current_dev = "/dev/console"; +static LIST_HEAD(struct console, consoles); +static int collect_consoles(void) { + _cleanup_free_ char *active = NULL; -+ const char *word, *state; -+ struct console *con; -+ size_t len; -+ int ret, id = 0; -+ -+ ret = read_one_line_file("/sys/class/tty/console/active", &active); -+ if (ret < 0) -+ return ret; -+ FOREACH_WORD(word, len, active, state) { ++ char *w, *state; ++ struct console *c; ++ size_t l; ++ int id; ++ int r; ++ ++ r = read_one_line_file("/sys/class/tty/console/active", &active); ++ if (r < 0) ++ return r; ++ ++ id = 0; ++ FOREACH_WORD(w, l, active, state) { + _cleanup_free_ char *tty = NULL; + -+ if (strneq(word, "tty0", len) && -+ read_one_line_file("/sys/class/tty/tty0/active", &tty) >= 0) { -+ word = tty; -+ len = strlen(tty); ++ if (strneq(w, "tty0", l)) { ++ if (read_one_line_file("/sys/class/tty/tty0/active", &tty) >= 0) { ++ w = tty; ++ l = strlen(tty); ++ } + } -+ con = malloc0(sizeof(*con) + strlen("/dev/") + len + 1); -+ if (con == NULL) { ++ ++ c = malloc0(sizeof(struct console)+5+l+1); ++ if (!c) { + log_oom(); + continue; + } -+ sprintf(con->dev, "/dev/%.*s", (int)len, word); -+ con->tty = con->dev; -+ con->id = id++; -+ LIST_PREPEND(handle, consoles, con); ++ ++ c->tty = ((char*)c)+sizeof(struct console); ++ stpncpy(stpcpy(c->tty, "/dev/"),w,l); ++ c->id = id++; ++ ++ LIST_PREPEND(handle, consoles, c); + } -+ if (consoles == NULL) { -+ con = malloc0(sizeof(*con)); -+ if (con == NULL) { ++ ++ if (!consoles) { ++ ++ c = malloc0(sizeof(struct console)); ++ if (!c) { + log_oom(); + return -ENOMEM; + } -+ con->tty = current_dev; -+ con->id = id++; -+ LIST_PREPEND(handle, consoles, con); ++ ++ c->tty = (char *)current_dev; ++ c->id = id++; ++ ++ LIST_PREPEND(handle, consoles, c); + } ++ + return 0; +} + @@ -107,133 +118,168 @@ +} + static int parse_password(const char *filename, char **wall) { - _cleanup_free_ char *socket_name = NULL, *message = NULL, *packet = NULL; + char *socket_name = NULL, *message = NULL, *packet = NULL; uint64_t not_after = 0; -@@ -308,7 +383,7 @@ static int parse_password(const char *fi - _cleanup_free_ char *password = NULL; + unsigned pid = 0; + int socket_fd = -1; + bool accept_cached = false; ++ size_t packet_length = 0; + + const ConfigTableItem items[] = { + { "Ask", "Socket", config_parse_string, 0, &socket_name }, +@@ -323,7 +410,6 @@ static int parse_password(const char *fi + struct sockaddr sa; + struct sockaddr_un un; + } sa = {}; +- size_t packet_length = 0; + + assert(arg_action == ACTION_QUERY || + arg_action == ACTION_WATCH); +@@ -365,7 +451,7 @@ static int parse_password(const char *fi + char *password = NULL; - if (arg_console) { -- tty_fd = acquire_terminal("/dev/console", false, false, false, USEC_INFINITY); -+ tty_fd = acquire_terminal(current_dev, false, false, false, USEC_INFINITY); - if (tty_fd < 0) - return tty_fd; + if (arg_console) +- if ((tty_fd = acquire_terminal("/dev/console", false, false, false, (usec_t) -1)) < 0) { ++ if ((tty_fd = acquire_terminal(current_dev, false, false, true, (usec_t) -1)) < 0) { + r = tty_fd; + goto finish; + } +@@ -386,6 +472,7 @@ static int parse_password(const char *fi + strcpy(packet+1, password); + } + ++ memset(password, 0, strlen(password)); + free(password); } -@@ -612,9 +687,85 @@ static int parse_argv(int argc, char *ar - return 1; + } +@@ -423,6 +510,7 @@ finish: + if (socket_fd >= 0) + close_nointr_nofail(socket_fd); + ++ memset(packet, 0, packet_length); + free(packet); + free(socket_name); + free(message); +@@ -726,8 +814,10 @@ static int parse_argv(int argc, char *ar } -+static int zzz(void) -+{ -+ struct console *con; -+ struct sigaction sig = { -+ .sa_handler = chld_handler, -+ .sa_flags = SA_NOCLDSTOP | SA_RESTART, -+ }; -+ struct sigaction oldsig; -+ sigset_t set, oldset; -+ int status = 0, ret; -+ pid_t job; -+ -+ collect_consoles(); -+ if (!consoles->handle_next) { -+ consoles->pid = 0; -+ con = consoles; -+ goto nofork; -+ } -+ -+ assert_se(sigemptyset(&set) == 0); -+ assert_se(sigaddset(&set, SIGHUP) == 0); -+ assert_se(sigaddset(&set, SIGCHLD) == 0); -+ assert_se(sigemptyset(&sig.sa_mask) == 0); -+ assert_se(sigprocmask(SIG_UNBLOCK, &set, &oldset) == 0); -+ assert_se(sigaction(SIGCHLD, &sig, &oldsig) == 0); -+ sig.sa_handler = SIG_DFL; -+ assert_se(sigaction(SIGHUP, &sig, NULL) == 0); -+ -+ LIST_FOREACH(handle, con, consoles) { -+ switch ((con->pid = fork())) { -+ case 0: -+ if (prctl(PR_SET_PDEATHSIG, SIGHUP) < 0) -+ _exit(EXIT_FAILURE); -+ zero(sig); -+ assert_se(sigprocmask(SIG_UNBLOCK, &oldset, NULL) == 0); -+ assert_se(sigaction(SIGCHLD, &oldsig, NULL) == 0); -+ nofork: -+ setsid(); -+ release_terminal(); -+ *usemask |= 1 << con->id; -+ current_dev = con->tty; -+ return con->id; /* child */ -+ case -1: -+ log_error("Failed to query password: %s", strerror(errno)); -+ exit(EXIT_FAILURE); -+ default: -+ break; -+ } -+ } -+ -+ ret = 0; -+ while ((job = wait(&status)) != 0) { -+ if (job < 0) { -+ if (errno != EINTR) -+ break; -+ continue; -+ } -+ LIST_FOREACH(handle, con, consoles) { -+ if (con->pid == job || kill(con->pid, 0) < 0) { -+ *usemask &= ~(1 << con->id); -+ continue; -+ } -+ if (*usemask & (1 << con->id)) -+ continue; -+ kill(con->pid, SIGHUP); -+ usleep(50000); -+ kill(con->pid, SIGKILL); -+ } -+ if (WIFEXITED(status) && ret == 0) -+ ret = WEXITSTATUS(status); -+ } -+ free_consoles(); -+ exit(ret != 0 ? EXIT_FAILURE : EXIT_SUCCESS); /* parent */ -+} -+ int main(int argc, char *argv[]) { -- int r; -+ int r, id = 0; ++ int id = 0; + int r; + LIST_HEAD_INIT(consoles); log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); -@@ -625,11 +776,19 @@ int main(int argc, char *argv[]) { - if (r <= 0) +@@ -737,11 +827,99 @@ int main(int argc, char *argv[]) { + if ((r = parse_argv(argc, argv)) <= 0) goto finish; -+ usemask = mmap(NULL, sizeof(*usemask), PROT_READ | PROT_WRITE, -+ MAP_ANONYMOUS | MAP_SHARED, -1, 0); -+ assert_se(usemask != NULL); ++ usemask = (uint32_t*) mmap(NULL, sizeof(uint32_t), PROT_READ|PROT_WRITE, ++ MAP_ANONYMOUS|MAP_SHARED, -1, 0); + if (arg_console) { - setsid(); - release_terminal(); +- } + if (!arg_plymouth && arg_action != ACTION_WALL && + arg_action != ACTION_LIST) { -+ id = zzz(); ++ struct console *c; ++ struct sigaction sig = { ++ .sa_handler = chld_handler, ++ .sa_flags = SA_NOCLDSTOP|SA_RESTART, ++ }; ++ struct sigaction oldsig; ++ sigset_t set, oldset; ++ int status = 0; ++ pid_t job; ++ ++ collect_consoles(); ++ ++ if (!consoles->handle_next) { ++ consoles->pid = 0; ++ c = consoles; ++ goto nofork; ++ } + ++ assert_se(sigemptyset(&set) == 0); ++ assert_se(sigaddset(&set, SIGHUP) == 0); ++ assert_se(sigaddset(&set, SIGCHLD) == 0); ++ assert_se(sigemptyset(&sig.sa_mask) == 0); ++ ++ assert_se(sigprocmask(SIG_UNBLOCK, &set, &oldset) == 0); ++ assert_se(sigaction(SIGCHLD, &sig, &oldsig) == 0); ++ sig.sa_handler = SIG_DFL; ++ assert_se(sigaction(SIGHUP, &sig, NULL) == 0); ++ LIST_FOREACH(handle, c, consoles) { ++ ++ switch ((c->pid = fork())) { ++ case 0: ++ if (prctl(PR_SET_PDEATHSIG, SIGHUP) < 0) ++ _exit(EXIT_FAILURE); ++ zero(sig); ++ assert_se(sigprocmask(SIG_UNBLOCK, &oldset, NULL) == 0); ++ assert_se(sigaction(SIGCHLD, &oldsig, NULL) == 0); ++ /* fall through */ ++ nofork: ++ setsid(); ++ release_terminal(); ++ id = c->id; ++ *usemask |= (1<<id); ++ current_dev = c->tty; ++ goto forked; /* child */ ++ case -1: ++ log_error("Failed to query password: %s", strerror(errno)); ++ return EXIT_FAILURE; ++ default: ++ break; ++ } ++ } ++ ++ r = 0; ++ while ((job = wait(&status))) { ++ if (job < 0) { ++ if (errno != EINTR) ++ break; ++ continue; ++ } ++ LIST_FOREACH(handle, c, consoles) { ++ if (c->pid == job) { ++ *usemask &= ~(1<<c->id); ++ continue; ++ } ++ if (kill(c->pid, 0) < 0) { ++ *usemask &= ~(1<<c->id); ++ continue; ++ } ++ if (*usemask & (1<<c->id)) ++ continue; ++ kill(c->pid, SIGHUP); ++ usleep(50000); ++ kill(c->pid, SIGKILL); ++ } ++ ++ if (WIFEXITED(status) && !r) ++ r = WEXITSTATUS(status); ++ } ++ free_consoles(); ++ return r != 0 ? EXIT_FAILURE : EXIT_SUCCESS; /* parent */ ++ + } else { + setsid(); + release_terminal(); + } - } -- - if (IN_SET(arg_action, ACTION_WATCH, ACTION_WALL)) ++ } ++forked: + if (arg_action == ACTION_WATCH || + arg_action == ACTION_WALL) r = watch_passwords(); - else -@@ -638,6 +797,8 @@ int main(int argc, char *argv[]) { +@@ -751,6 +929,8 @@ int main(int argc, char *argv[]) { if (r < 0) - log_error_errno(r, "Error: %m"); + log_error("Error: %s", strerror(-r)); + free_consoles(); -+ *usemask &= ~(1 << id); ++ *usemask &= ~(1<<id); finish: return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; } ++++++ use-rndaddentropy-ioctl-to-load-random-seed.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:08.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:08.000000000 +0100 @@ -5,13 +5,11 @@ Related to bnc#892096 --- - src/random-seed/random-seed.c | 65 +++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 61 insertions(+), 4 deletions(-) + systemd-210/src/random-seed/random-seed.c | 66 +++++++++++++++++++++++++++--- + 1 file changed, 61 insertions(+), 5 deletions(-) -Index: systemd-218/src/random-seed/random-seed.c -=================================================================== ---- systemd-218.orig/src/random-seed/random-seed.c -+++ systemd-218/src/random-seed/random-seed.c +--- systemd-210/src/random-seed/random-seed.c ++++ systemd-210/src/random-seed/random-seed.c 2014-08-27 11:58:59.022526580 +0000 @@ -22,7 +22,9 @@ #include <unistd.h> #include <fcntl.h> @@ -39,7 +37,7 @@ + entropy_fd = open(RANDOM_SEED_DIR "entropy_count", O_RDONLY|O_CLOEXEC|O_NOCTTY, 0600); + if (entropy_fd < 0) { -+ entropy_count = 0; ++ entropy_count = 0; + if (errno != ENOENT) { + log_error("Failed to open " RANDOM_SEED "/entropy_count: %m"); + r = -errno; @@ -57,13 +55,13 @@ seed_fd = open(RANDOM_SEED, O_RDWR|O_CLOEXEC|O_NOCTTY|O_CREAT, 0600); if (seed_fd < 0) { seed_fd = open(RANDOM_SEED, O_RDONLY|O_CLOEXEC|O_NOCTTY); -@@ -113,12 +133,34 @@ int main(int argc, char *argv[]) { +@@ -113,16 +133,37 @@ int main(int argc, char *argv[]) { } else { lseek(seed_fd, 0, SEEK_SET); -- r = loop_write(random_fd, buf, (size_t) k, false); -- if (r < 0) -- log_error_errno(r, "Failed to write seed to /dev/urandom: %m"); +- k = loop_write(random_fd, buf, (size_t) k, false); +- if (k <= 0) { +- log_error("Failed to write seed to /dev/urandom: %s", r < 0 ? strerror(-r) : "short write"); + if (entropy_count && (size_t) k == buf_size) { + struct rand_pool_info entropy = { + .entropy_count = entropy_count, @@ -79,12 +77,15 @@ + k = loop_write(random_fd, buf, (size_t) k, false); + if (k <= 0) { + log_error("Failed to write seed to /dev/urandom: %s", r < 0 ? strerror(-r) : "short write"); + +- r = k == 0 ? -EIO : (int) k; + r = k == 0 ? -EIO : (int) k; + } -+ } + } } } else if (streq(argv[1], "save")) { + + /* Read available entropy count, if possible */ + f = fopen("/proc/sys/kernel/random/entropy_avail", "re"); + if (f) { @@ -92,10 +93,11 @@ + entropy_count = 0; + fclose(f); + } - ++ seed_fd = open(RANDOM_SEED, O_WRONLY|O_CLOEXEC|O_NOCTTY|O_CREAT, 0600); if (seed_fd < 0) { -@@ -134,6 +176,21 @@ int main(int argc, char *argv[]) { + log_error("Failed to open " RANDOM_SEED ": %m"); +@@ -137,6 +178,21 @@ int main(int argc, char *argv[]) { goto finish; } ++++++ use-usr-sbin-sulogin-for-emergency-service.patch ++++++ From: Andrey Borzenkov <arvidjaar@gmail.com> Subject: use /usr/sbin/sulogin in emergency service In current Factory sulogin is in /usr/sbin which makes it impossible to enter emergency service. Index: systemd-207/units/emergency.service.in =================================================================== --- systemd-207.orig/units/emergency.service.in +++ systemd-207/units/emergency.service.in @@ -17,7 +17,7 @@ Environment=HOME=/root WorkingDirectory=/root ExecStartPre=-/bin/plymouth quit ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" to try again\\nto boot into default mode.' -ExecStart=-/sbin/sulogin +ExecStart=-/usr/sbin/sulogin ExecStopPost=@SYSTEMCTL@ --fail --no-block default Type=idle StandardInput=tty-force Index: systemd-207/units/console-shell.service.m4.in =================================================================== --- systemd-207.orig/units/console-shell.service.m4.in +++ systemd-207/units/console-shell.service.m4.in @@ -17,7 +17,7 @@ Before=getty.target [Service] Environment=HOME=/root WorkingDirectory=/root -ExecStart=-/sbin/sulogin +ExecStart=-/usr/sbin/sulogin ExecStopPost=-@SYSTEMCTL@ poweroff Type=idle StandardInput=tty-force Index: systemd-207/units/rescue.service.m4.in =================================================================== --- systemd-207.orig/units/rescue.service.m4.in +++ systemd-207/units/rescue.service.m4.in @@ -18,7 +18,7 @@ Environment=HOME=/root WorkingDirectory=/root ExecStartPre=-/bin/plymouth quit ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.' -ExecStart=-/sbin/sulogin +ExecStart=-/usr/sbin/sulogin ExecStopPost=-@SYSTEMCTL@ --fail --no-block default Type=idle StandardInput=tty-force ++++++ vhangup-on-all-consoles.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:08.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:08.000000000 +0100 @@ -2,22 +2,12 @@ to explicit do a virtually hangup on the specified on the terminal line to give e.g. the bash a few seconds to e.g. safe its history. -[crrodriguez@opensuse.org: Feb 2015 -This a known kernel bug, no notification from the cgroup subsystem -arrives and the processes in the "scope" units have -to be SIGKILL'ed without delay in order not to hang shutdown -Status: fix not available as of Feb 16 2015 -track progress: https://bugzilla.redhat.com/show_bug.cgi?id=1141137 -] - --- units/getty@.service.m4 | 1 + units/serial-getty@.service.m4 | 1 + 2 files changed, 2 insertions(+) -Index: systemd-218/units/getty@.service.m4 -=================================================================== ---- systemd-218.orig/units/getty@.service.m4 -+++ systemd-218/units/getty@.service.m4 +--- units/getty@.service.m4 ++++ units/getty@.service.m4 2014-07-15 07:30:28.006235859 +0000 @@ -29,6 +29,7 @@ ConditionPathExists=/dev/tty0 [Service] # the VT is cleared by TTYVTDisallocate @@ -26,15 +16,13 @@ Type=idle Restart=always RestartSec=0 -Index: systemd-218/units/serial-getty@.service.m4 -=================================================================== ---- systemd-218.orig/units/serial-getty@.service.m4 -+++ systemd-218/units/serial-getty@.service.m4 +--- units/serial-getty@.service.m4 ++++ units/serial-getty@.service.m4 2014-07-15 07:30:01.366235017 +0000 @@ -24,6 +24,7 @@ IgnoreOnIsolate=yes [Service] - ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM + ExecStart=-/sbin/agetty --keep-baud %I 115200,38400,9600 $TERM +ExecStopPost=-/sbin/vhangup /dev/%I Type=idle Restart=always - UtmpIdentifier=%I + RestartSec=0 ++++++ watch_resolv.conf_for_become_changed.patch ++++++ --- /var/tmp/diff_new_pack.tGwpSJ/_old 2015-03-09 09:21:08.000000000 +0100 +++ /var/tmp/diff_new_pack.tGwpSJ/_new 2015-03-09 09:21:08.000000000 +0100 @@ -1,12 +1,10 @@ --- - src/core/manager.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/core/manager.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/core/manager.h | 5 ++ - 2 files changed, 98 insertions(+) + 2 files changed, 108 insertions(+) -Index: systemd-218/src/core/manager.c -=================================================================== ---- systemd-218.orig/src/core/manager.c -+++ systemd-218/src/core/manager.c +--- src/core/manager.c ++++ src/core/manager.c 2014-11-07 11:12:58.334193988 +0000 @@ -37,6 +37,7 @@ #include <sys/stat.h> #include <dirent.h> @@ -15,7 +13,7 @@ #ifdef HAVE_AUDIT #include <libaudit.h> -@@ -302,6 +303,91 @@ static int manager_check_ask_password(Ma +@@ -304,6 +305,101 @@ static int manager_check_ask_password(Ma return m->have_ask_password; } @@ -37,8 +35,13 @@ + flush_fd(fd); + + m->resolv_conf_event_source = sd_event_source_unref(m->resolv_conf_event_source); -+ m->resolv_conf_inotify_fd = safe_close(m->resolv_conf_inotify_fd); ++ ++ if (m->resolv_conf_inotify_fd >= 0) ++ close_nointr_nofail(m->resolv_conf_inotify_fd); ++ m->resolv_conf_inotify_fd = -1; ++ + manager_setup_resolv_conf_change(m); ++ + return m->resolv_conf_noent ? 0 : res_init(); +} + @@ -93,7 +96,10 @@ + + return 0; +fail: -+ m->resolv_conf_inotify_fd = safe_close(m->resolv_conf_inotify_fd); ++ if (m->resolv_conf_inotify_fd >= 0) ++ close_nointr_nofail(m->resolv_conf_inotify_fd); ++ m->resolv_conf_inotify_fd = -1; ++ + return 0; /* Ignore error here */ +} + @@ -101,21 +107,23 @@ + assert(m); + + m->resolv_conf_event_source = sd_event_source_unref(m->resolv_conf_event_source); -+ m->resolv_conf_inotify_fd = safe_close(m->resolv_conf_inotify_fd); ++ if (m->resolv_conf_inotify_fd >= 0) ++ close_nointr_nofail(m->resolv_conf_inotify_fd); ++ m->resolv_conf_inotify_fd = -1; +} + static int manager_watch_idle_pipe(Manager *m) { int r; -@@ -557,6 +643,7 @@ int manager_new(SystemdRunningAs running - m->pin_cgroupfs_fd = m->notify_fd = m->signal_fd = m->time_change_fd = m->dev_autofs_fd = m->private_listen_fd = m->kdbus_fd = m->utab_inotify_fd = -1; +@@ -562,6 +658,7 @@ int manager_new(SystemdRunningAs running + m->pin_cgroupfs_fd = m->notify_fd = m->signal_fd = m->time_change_fd = m->dev_autofs_fd = m->private_listen_fd = m->kdbus_fd = -1; m->current_job_id = 1; /* start as id #1, so that we can leave #0 around as "null-like" value */ + m->resolv_conf_inotify_fd = -1; m->ask_password_inotify_fd = -1; m->have_ask_password = -EINVAL; /* we don't know */ -@@ -618,6 +705,10 @@ int manager_new(SystemdRunningAs running +@@ -613,6 +710,10 @@ int manager_new(SystemdRunningAs running if (r < 0) goto fail; @@ -126,22 +134,20 @@ m->udev = udev_new(); if (!m->udev) { r = -ENOMEM; -@@ -896,6 +987,8 @@ Manager* manager_free(Manager *m) { - if (!m) - return NULL; +@@ -906,6 +1007,8 @@ void manager_free(Manager *m) { + + assert(m); + manager_shutdown_resolv_conf_change(m); + manager_clear_jobs_and_units(m); for (c = 0; c < _UNIT_TYPE_MAX; c++) -Index: systemd-218/src/core/manager.h -=================================================================== ---- systemd-218.orig/src/core/manager.h -+++ systemd-218/src/core/manager.h -@@ -185,6 +185,11 @@ struct Manager { - int utab_inotify_fd; - sd_event_source *mount_utab_event_source; +--- src/core/manager.h ++++ src/core/manager.h 2014-11-07 11:06:41.466019636 +0000 +@@ -157,6 +157,11 @@ struct Manager { + FILE *proc_self_mountinfo; + sd_event_source *mount_event_source; + /* Watch out any change of /etc/resolv.conf */ + int resolv_conf_inotify_fd; -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org