Hello community, here is the log from the commit of package systemd for openSUSE:Factory checked in at 2014-09-03 18:21:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2014-08-29 17:43:05.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.systemd.new/systemd-mini.changes 2014-09-03 21:12:19.000000000 +0200 @@ -1,0 +2,29 @@ +Tue Sep 2 12:56:47 UTC 2014 - rmila...@suse.com + +- udev: add option to generate old 'buggy' serials (bnc#886852) + Add 1066-udev-add-compatibility-links-for-truncated-by-id-links.patch + +------------------------------------------------------------------- +Tue Sep 2 09:14:03 UTC 2014 - wer...@suse.de + +- Add upstream patch + 0001-login-simplify-controller-handling.patch + +------------------------------------------------------------------- +Mon Sep 1 13:00:29 UTC 2014 - wer...@suse.de + +- Add upstream patches + 0001-completion-filter-templates-from-restartable-units.patch + 0002-systemd-fix-error-message.patch + 0003-Quote-unit-names-in-suggested-systemctl-commandlines.patch + 0004-config-parser-fix-mem-leak.patch + 0005-login-fix-mem-leak.patch + 1065-udev-bump-event-timeout-to-60-seconds.patch + +------------------------------------------------------------------- +Fri Aug 29 14:14:06 UTC 2014 - wer...@suse.de + +- Add upstream patch 0001-nspawn-fix-network-interface.patch to + make option network-interface of systemd-nspawn work + +------------------------------------------------------------------- systemd.changes: same change New: ---- 0001-completion-filter-templates-from-restartable-units.patch 0001-login-simplify-controller-handling.patch 0001-nspawn-fix-network-interface.patch 0002-systemd-fix-error-message.patch 0003-Quote-unit-names-in-suggested-systemctl-commandlines.patch 0004-config-parser-fix-mem-leak.patch 0005-login-fix-mem-leak.patch 1065-udev-bump-event-timeout-to-60-seconds.patch 1066-udev-add-compatibility-links-for-truncated-by-id-links.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ systemd-mini.spec ++++++ --- /var/tmp/diff_new_pack.ndIGBV/_old 2014-09-03 21:12:23.000000000 +0200 +++ /var/tmp/diff_new_pack.ndIGBV/_new 2014-09-03 21:12:23.000000000 +0200 @@ -814,6 +814,20 @@ Patch392: 0003-sd-journal-properly-convert-object-size-on-big-endia.patch # PATCH-FIX-UPSTREAM added at 2014/08/28 Patch393: 0004-sd-journal-verify-that-object-start-with-the-field-n.patch +# PATCH-FIX-UPSTREAM added at 2014/08/29 +Patch394: 0001-nspawn-fix-network-interface.patch +# PATCH-FIX-UPSTREAM added at 2014/09/01 +Patch395: 0001-completion-filter-templates-from-restartable-units.patch +# PATCH-FIX-UPSTREAM added at 2014/09/01 +Patch396: 0002-systemd-fix-error-message.patch +# PATCH-FIX-UPSTREAM added at 2014/09/01 +Patch397: 0003-Quote-unit-names-in-suggested-systemctl-commandlines.patch +# PATCH-FIX-UPSTREAM added at 2014/09/01 +Patch398: 0004-config-parser-fix-mem-leak.patch +# PATCH-FIX-UPSTREAM added at 2014/09/01 +Patch399: 0005-login-fix-mem-leak.patch +# PATCH-FIX-UPSTREAM added at 2014/09/02 +Patch400: 0001-login-simplify-controller-handling.patch # UDEV PATCHES # ============ @@ -949,6 +963,10 @@ Patch1063: 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch # PATCH-FIX-UPSTREAM 1064-udev-hwdb-do-not-look-at-usb_device-parents.patch Patch1064: 1064-udev-hwdb-do-not-look-at-usb_device-parents.patch +# PATCH-FIX-UPSTREAM 1065-udev-bump-event-timeout-to-60-seconds.patch +Patch1065: 1065-udev-bump-event-timeout-to-60-seconds.patch +# PATCH-FIX-SUSE 1066-udev-add-compatibility-links-for-truncated-by-id-links.patch (bnc#886852) +Patch1066: 1066-udev-add-compatibility-links-for-truncated-by-id-links.patch %description Systemd is a system and service manager, compatible with SysV and LSB @@ -1501,6 +1519,13 @@ %patch391 -p0 %patch392 -p0 %patch393 -p0 +%patch394 -p0 +%patch395 -p0 +%patch396 -p0 +%patch397 -p0 +%patch398 -p0 +%patch399 -p0 +%patch400 -p0 # udev patches %patch1001 -p1 @@ -1588,6 +1613,8 @@ %patch1062 -p1 %patch1063 -p0 %patch1064 -p0 +%patch1065 -p0 +%patch1066 -p1 # remove patch backups find -name '*.orig' -exec rm -f '{}' \+ ++++++ systemd.spec ++++++ --- /var/tmp/diff_new_pack.ndIGBV/_old 2014-09-03 21:12:23.000000000 +0200 +++ /var/tmp/diff_new_pack.ndIGBV/_new 2014-09-03 21:12:23.000000000 +0200 @@ -809,6 +809,20 @@ Patch392: 0003-sd-journal-properly-convert-object-size-on-big-endia.patch # PATCH-FIX-UPSTREAM added at 2014/08/28 Patch393: 0004-sd-journal-verify-that-object-start-with-the-field-n.patch +# PATCH-FIX-UPSTREAM added at 2014/08/29 +Patch394: 0001-nspawn-fix-network-interface.patch +# PATCH-FIX-UPSTREAM added at 2014/09/01 +Patch395: 0001-completion-filter-templates-from-restartable-units.patch +# PATCH-FIX-UPSTREAM added at 2014/09/01 +Patch396: 0002-systemd-fix-error-message.patch +# PATCH-FIX-UPSTREAM added at 2014/09/01 +Patch397: 0003-Quote-unit-names-in-suggested-systemctl-commandlines.patch +# PATCH-FIX-UPSTREAM added at 2014/09/01 +Patch398: 0004-config-parser-fix-mem-leak.patch +# PATCH-FIX-UPSTREAM added at 2014/09/01 +Patch399: 0005-login-fix-mem-leak.patch +# PATCH-FIX-UPSTREAM added at 2014/09/02 +Patch400: 0001-login-simplify-controller-handling.patch # UDEV PATCHES # ============ @@ -944,6 +958,10 @@ Patch1063: 1063-udev-path_id-suppress-ID_PATH-for-devices-with-an-un.patch # PATCH-FIX-UPSTREAM 1064-udev-hwdb-do-not-look-at-usb_device-parents.patch Patch1064: 1064-udev-hwdb-do-not-look-at-usb_device-parents.patch +# PATCH-FIX-UPSTREAM 1065-udev-bump-event-timeout-to-60-seconds.patch +Patch1065: 1065-udev-bump-event-timeout-to-60-seconds.patch +# PATCH-FIX-SUSE 1066-udev-add-compatibility-links-for-truncated-by-id-links.patch (bnc#886852) +Patch1066: 1066-udev-add-compatibility-links-for-truncated-by-id-links.patch %description Systemd is a system and service manager, compatible with SysV and LSB @@ -1496,6 +1514,13 @@ %patch391 -p0 %patch392 -p0 %patch393 -p0 +%patch394 -p0 +%patch395 -p0 +%patch396 -p0 +%patch397 -p0 +%patch398 -p0 +%patch399 -p0 +%patch400 -p0 # udev patches %patch1001 -p1 @@ -1583,6 +1608,8 @@ %patch1062 -p1 %patch1063 -p0 %patch1064 -p0 +%patch1065 -p0 +%patch1066 -p1 # remove patch backups find -name '*.orig' -exec rm -f '{}' \+ ++++++ 0001-completion-filter-templates-from-restartable-units.patch ++++++ Based on ec15977a3cd82eff6c94bb13db72195f7cd512e8 Mon Sep 17 00:00:00 2001 From: Dave Reisner <dreis...@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-login-simplify-controller-handling.patch ++++++ Based on b12e56156e5f363ebb8dc4ea5c10f5fd0665dc9d Mon Sep 17 00:00:00 2001 From: David Herrmann <dh.herrm...@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-nspawn-fix-network-interface.patch ++++++ Based on 3125b3ef5db70d45882c7d6f617705802c5f939e Mon Sep 17 00:00:00 2001 From: Tom Gundersen <t...@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; ++++++ 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?= <zbys...@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; ++++++ 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?= <zbys...@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 ++++++ 0004-config-parser-fix-mem-leak.patch ++++++ >From 9e60277835e61597011358afcdbfb3dd712ce128 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <pho...@gmail.com> Date: Sun, 31 Aug 2014 23:13:12 +0200 Subject: [PATCH] config-parser: fix mem leak --- 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 ++++++ 0005-login-fix-mem-leak.patch ++++++ Based on 13f493dc9ace9861c1f27c4d37e8cd6d52fe6a32 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen <pho...@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); ++++++ 1065-udev-bump-event-timeout-to-60-seconds.patch ++++++ >From 2e92633dbae52f5ac9b7b2e068935990d475d2cd Mon Sep 17 00:00:00 2001 From: Kay Sievers <k...@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 ++++++ From: Jeff Mahoney <je...@suse.com> Subject: udev: add option to generate old 'buggy' serials References: bnc#886852 Prior to udev 184, scsi_id would truncate the last character of the model string when generating the ID_SERIAL value. If a system was installed prior to that fix being available in udev, there may be configuration information that refers to the truncated link. This patch adds a --truncated-serial option and a udev rule will created the old truncated links. Signed-off-by: Jeff Mahoney <je...@suse.com> --- rules/60-persistent-storage.rules | 4 ++++ src/udev/scsi_id/scsi_id.c | 15 ++++++++++++++- src/udev/scsi_id/scsi_id.h | 1 + src/udev/scsi_id/scsi_serial.c | 19 +++++++++++++------ 4 files changed, 32 insertions(+), 7 deletions(-) --- 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" +# scsi compat links for ATA devices (for compatibility with udev < 184) +KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --truncated-serial --whitelisted --replace-whitespace -p0x80 -d$tempnode", RESULT=="?*", ENV{ID_SCSI_COMPAT_TRUNCATED}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT_TRUNCATED}" +KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT_TRUNCATED}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT_TRUNCATED}-part%n" + # 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" --- 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' }, + { "truncated-serial", no_argument, NULL, '9' }, { "version", no_argument, NULL, 'V' }, /* don't advertise -V */ { "export", no_argument, NULL, 'x' }, { "help", no_argument, NULL, 'h' }, @@ -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]; @@ -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" " --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': + compat_truncated = true; + break; + case 'V': printf("%s\n", VERSION); exit(0); @@ -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); + util_replace_whitespace(dev_scsi.serial_compat, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); + printf("ID_SERIAL_COMPAT=%s\n", serial_str); 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); @@ -565,7 +575,10 @@ static int scsi_id(struct udev *udev, ch if (reformat_serial) { char serial_str[MAX_SERIAL_LEN]; - util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + if (compat_truncated) + util_replace_whitespace(dev_scsi.serial_compat, serial_str, sizeof(serial_str)); + else + util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); util_replace_chars(serial_str, NULL); printf("%s\n", serial_str); goto out; --- 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]; char serial_short[MAX_SERIAL_LEN]; + char serial_compat[MAX_SERIAL_LEN]; int use_sg; /* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */ --- 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, - char *serial, char *serial_short, int max_len); + char *serial, char *serial_short, + char *serial_compat, int max_len); static int sg_err_category_new(struct udev *udev, int scsi_status, int msg_status, int @@ -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 */ - do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, MAX_SERIAL_LEN); + do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, NULL, MAX_SERIAL_LEN); memzero(page_83, SCSI_INQ_BUFF_LEN); retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, @@ -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, - char *serial, char *serial_short, int max_len) + char *serial, char *serial_short, + char *serial_compat, int max_len) { int retval; int ser_ind; @@ -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; + if (serial_compat) + strcpy(serial_compat, serial); ser_ind++; /* for the leading 'S' */ - for (i = 4; i < len + 4; i++, ser_ind++) + for (i = 4; i < len + 4; i++, ser_ind++) { serial[ser_ind] = buf[i]; + if (serial_compat) + serial_compat[ser_ind - 1] = buf[i]; + } } if (serial_short != NULL) { memcpy(serial_short, &buf[4], len); @@ -877,7 +884,7 @@ int scsi_get_serial(struct udev *udev, return 1; if (page_code == PAGE_80) { - if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { + if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, dev_scsi->serial_compat, len)) { retval = 1; goto completed; } else { @@ -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, - dev_scsi->serial, dev_scsi->serial_short, len)) { + dev_scsi->serial, dev_scsi->serial_short, dev_scsi->serial_compat, len)) { /* * Success */ -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org