Hello community, here is the log from the commit of package yast2-services-manager for openSUSE:Factory checked in at 2018-12-31 09:43:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-services-manager (Old) and /work/SRC/openSUSE:Factory/.yast2-services-manager.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-services-manager" Mon Dec 31 09:43:51 2018 rev:44 rq:657950 version:4.1.11 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-services-manager/yast2-services-manager.changes 2018-11-01 18:56:46.741975842 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-services-manager.new.28833/yast2-services-manager.changes 2018-12-31 09:43:52.870339857 +0100 @@ -1,0 +2,18 @@ +Wed Dec 12 15:55:24 UTC 2018 - sch...@suse.de + +- Fix: Do not crash in chroot environment (bsc#1113732) +- 4.1.11 + +------------------------------------------------------------------- +Wed Dec 12 15:46:31 UTC 2018 - Josef Reidinger <jreidin...@suse.com> + +- always use absolute path to binaries (bsc#1118291) +- 4.1.10 + +------------------------------------------------------------------- +Mon Nov 26 02:52:52 UTC 2018 - Noah Davis <noaha...@gmail.com> + +- Provide icon with module (boo#1109310) +- 4.1.9 + +------------------------------------------------------------------- Old: ---- yast2-services-manager-4.1.8.tar.bz2 New: ---- yast2-services-manager-4.1.11.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-services-manager.spec ++++++ --- /var/tmp/diff_new_pack.abKyHq/_old 2018-12-31 09:43:53.262339537 +0100 +++ /var/tmp/diff_new_pack.abKyHq/_new 2018-12-31 09:43:53.262339537 +0100 @@ -24,7 +24,7 @@ ###################################################################### Name: yast2-services-manager -Version: 4.1.8 +Version: 4.1.11 Release: 0 BuildArch: noarch @@ -79,6 +79,7 @@ %suse_update_desktop_file services-manager %define yast_dir %{_prefix}/share/YaST2 +%define yast_icondir %{_datadir}/icons %files %defattr(-,root,root) @@ -96,7 +97,7 @@ %dir %{yast_dir}/lib/services-manager/dialogs %{yast_dir}/lib/services-manager/dialogs/*.rb %{_prefix}/share/applications/YaST2/services-manager.desktop - +%{yast_icondir} %_docdir/%name/ %license COPYING ++++++ yast2-services-manager-4.1.8.tar.bz2 -> yast2-services-manager-4.1.11.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-4.1.8/package/yast2-services-manager.changes new/yast2-services-manager-4.1.11/package/yast2-services-manager.changes --- old/yast2-services-manager-4.1.8/package/yast2-services-manager.changes 2018-10-16 17:43:02.000000000 +0200 +++ new/yast2-services-manager-4.1.11/package/yast2-services-manager.changes 2018-12-13 11:58:38.000000000 +0100 @@ -1,4 +1,22 @@ ------------------------------------------------------------------- +Wed Dec 12 15:55:24 UTC 2018 - sch...@suse.de + +- Fix: Do not crash in chroot environment (bsc#1113732) +- 4.1.11 + +------------------------------------------------------------------- +Wed Dec 12 15:46:31 UTC 2018 - Josef Reidinger <jreidin...@suse.com> + +- always use absolute path to binaries (bsc#1118291) +- 4.1.10 + +------------------------------------------------------------------- +Mon Nov 26 02:52:52 UTC 2018 - Noah Davis <noaha...@gmail.com> + +- Provide icon with module (boo#1109310) +- 4.1.9 + +------------------------------------------------------------------- Tue Oct 16 15:28:34 CEST 2018 - sch...@suse.de - Added license file to spec. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-4.1.8/package/yast2-services-manager.spec new/yast2-services-manager-4.1.11/package/yast2-services-manager.spec --- old/yast2-services-manager-4.1.8/package/yast2-services-manager.spec 2018-10-16 17:43:02.000000000 +0200 +++ new/yast2-services-manager-4.1.11/package/yast2-services-manager.spec 2018-12-13 11:58:38.000000000 +0100 @@ -24,7 +24,7 @@ ###################################################################### Name: yast2-services-manager -Version: 4.1.8 +Version: 4.1.11 Release: 0 BuildArch: noarch @@ -79,6 +79,7 @@ %suse_update_desktop_file services-manager %define yast_dir %{_prefix}/share/YaST2 +%define yast_icondir %{_datadir}/icons %files %defattr(-,root,root) @@ -96,6 +97,6 @@ %dir %{yast_dir}/lib/services-manager/dialogs %{yast_dir}/lib/services-manager/dialogs/*.rb %{_prefix}/share/applications/YaST2/services-manager.desktop - +%{yast_icondir} %_docdir/%name/ %license COPYING diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-4.1.8/src/desktop/services-manager.desktop new/yast2-services-manager-4.1.11/src/desktop/services-manager.desktop --- old/yast2-services-manager-4.1.8/src/desktop/services-manager.desktop 2018-10-16 17:43:02.000000000 +0200 +++ new/yast2-services-manager-4.1.11/src/desktop/services-manager.desktop 2018-12-13 11:58:38.000000000 +0100 @@ -17,7 +17,7 @@ X-SuSE-YaST-AutoInstResourceAliases=runlevel X-SuSE-YaST-Keywords=systemd,system,background -Icon=yast-runlevel +Icon=yast-services-manager Exec=xdg-su -c "/sbin/yast2 services-manager" Name=Services Manager diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-4.1.8/src/icons/hicolor/scalable/apps/yast-services-manager.svg new/yast2-services-manager-4.1.11/src/icons/hicolor/scalable/apps/yast-services-manager.svg --- old/yast2-services-manager-4.1.8/src/icons/hicolor/scalable/apps/yast-services-manager.svg 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-services-manager-4.1.11/src/icons/hicolor/scalable/apps/yast-services-manager.svg 2018-12-13 11:58:38.000000000 +0100 @@ -0,0 +1 @@ +<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="36" x2="120" y1="92" y2="8"><stop offset="0" stop-color="#deddda"/><stop offset="1" stop-color="#f6f5f4"/></linearGradient><g stroke-width="4"><path d="M120 12s-48.932 6.888-72 24C34.288 46.172 16 76 16 76l40 40s27.884-17.068 40-32c18.096-22.304 24-72 24-72z" fill="#c0bfbc"/><path d="M120 8s-48.932 6.888-72 24C34.288 42.172 16 72 16 72l40 40s27.884-17.068 40-32c18.096-22.304 24-72 24-72z" fill="url(#a)"/><path d="M80 32a16 16 0 0 0-16 16 16 16 0 0 0 16 16 16 16 0 0 0 16-16 16 16 0 0 0-16-16z" fill="#9a9996"/><path d="M80 36a12 12 0 0 0-12 12 12 12 0 0 0 12 12 12 12 0 0 0 12-12 12 12 0 0 0-12-12z" fill="#241f31"/><path d="M40 44L8 92V68l32-28zM88 92v-4l-48 32v4h24zM24 92l36-24v4l-20 36-24 8v-4z" fill="#a51d2d"/><g fill="#e01b24"><path d="M40 40L8 88V64zM88 88l-48 32h24zM24 88l36-20-20 36-24 8zM120 8s-11.84 1.676-26.6 5.4l21.544 21.544A255.88 255.88 0 0 0 120 8z"/></g><path d="M80 36a12 12 0 0 0-12 12 12 12 0 0 0 10.44 11.88l6.796-22.668A12 12 0 0 0 80 36z" fill="#fff" opacity=".2"/></g></svg> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-4.1.8/src/lib/services-manager/clients/default_target_proposal.rb new/yast2-services-manager-4.1.11/src/lib/services-manager/clients/default_target_proposal.rb --- old/yast2-services-manager-4.1.8/src/lib/services-manager/clients/default_target_proposal.rb 2018-10-16 17:43:02.000000000 +0200 +++ new/yast2-services-manager-4.1.11/src/lib/services-manager/clients/default_target_proposal.rb 2018-12-13 11:58:38.000000000 +0100 @@ -114,7 +114,7 @@ def create_dialog caption = _("Set Default Systemd Target") Wizard.CreateDialog - Wizard.SetTitleIcon "yast-runlevel" + Wizard.SetDesktopIcon "services-manager" Wizard.SetContentsButtons( caption, generate_content, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-4.1.8/src/lib/services-manager/dialogs/services_manager.rb new/yast2-services-manager-4.1.11/src/lib/services-manager/dialogs/services_manager.rb --- old/yast2-services-manager-4.1.8/src/lib/services-manager/dialogs/services_manager.rb 2018-10-16 17:43:02.000000000 +0200 +++ new/yast2-services-manager-4.1.11/src/lib/services-manager/dialogs/services_manager.rb 2018-12-13 11:58:38.000000000 +0100 @@ -29,6 +29,7 @@ require "services-manager/widgets/show_details_button" require "services-manager/widgets/logs_button" require "services-manager/widgets/services_table" +require "services-manager/service_loader" Yast.import "ServicesManager" Yast.import "UI" @@ -586,6 +587,10 @@ # # @return [Array<String>] name of all services def read_services + if Y2ServicesManager::ServiceLoader.chroot_env? + Popup.Error(_("Cannot read services in chroot environment.")) + return [] + end Yast2::Feedback.show(_("Reading services status...")) do ServicesManagerService.reload ServicesManagerService.all.keys diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-4.1.8/src/lib/services-manager/service_loader.rb new/yast2-services-manager-4.1.11/src/lib/services-manager/service_loader.rb --- old/yast2-services-manager-4.1.8/src/lib/services-manager/service_loader.rb 2018-10-16 17:43:02.000000000 +0200 +++ new/yast2-services-manager-4.1.11/src/lib/services-manager/service_loader.rb 2018-12-13 11:58:38.000000000 +0100 @@ -42,9 +42,9 @@ class ServiceLoader include Yast::Logger - LIST_UNIT_FILES_COMMAND = 'systemctl list-unit-files --type service' - LIST_UNITS_COMMAND = 'systemctl list-units --all --type service' - STATUS_COMMAND = 'systemctl status' + LIST_UNIT_FILES_COMMAND = '/usr/bin/systemctl list-unit-files --type service' + LIST_UNITS_COMMAND = '/usr/bin/systemctl list-units --all --type service' + STATUS_COMMAND = '/usr/bin/systemctl status' # FIXME: duplicated in Yast::Systemctl COMMAND_OPTIONS = ' --no-legend --no-pager --no-ask-password ' TERM_OPTIONS = ' LANG=C TERM=dumb COLUMNS=1024 ' @@ -91,6 +91,8 @@ @unit_files = {} @units = {} + return {} if self.class.chroot_env? # systemd is not available + load_unit_files load_units @@ -106,6 +108,15 @@ services end + # Checking if the module is running in chroot environment + # + # @return [Boolean] if running in chroot environment + def self.chroot_env? + command = TERM_OPTIONS + STATUS_COMMAND + COMMAND_OPTIONS + ret = Yast::SCR.Execute(Yast::Path.new('.target.bash_output'), command)['stderr'] + ret.start_with?("Running in chroot") + end + private # FIXME: use Yast::Systemctl for this, remember to chomp SERVICE_SUFFIX @@ -171,13 +182,12 @@ extract_services_from_unit_files # Add old LSB services (Services which are loaded but not available as a unit file) extract_services_from_units - service_names = services.keys.sort ss = Yast2::SystemService.find_many(service_names) # Rest of settings services.clear ss.each do |s| - services[s.name] = s + services[s.name] = s if s.service # name is a def_delegator of SystemService.service.name end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-4.1.8/src/lib/services-manager/widgets/start_mode_button.rb new/yast2-services-manager-4.1.11/src/lib/services-manager/widgets/start_mode_button.rb --- old/yast2-services-manager-4.1.8/src/lib/services-manager/widgets/start_mode_button.rb 2018-10-16 17:43:02.000000000 +0200 +++ new/yast2-services-manager-4.1.11/src/lib/services-manager/widgets/start_mode_button.rb 2018-12-13 11:58:38.000000000 +0100 @@ -91,6 +91,7 @@ # @return [Array<Yast::Term>] def items start_modes = ServicesManagerService.start_modes(service_name) + return [] unless start_modes #start_modes can also return false due errors ServicesManagerService.all_start_modes.each_with_object([]) do |mode, all| next unless start_modes.include?(mode) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-4.1.8/test/service_loader_test.rb new/yast2-services-manager-4.1.11/test/service_loader_test.rb --- old/yast2-services-manager-4.1.8/test/service_loader_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-services-manager-4.1.11/test/service_loader_test.rb 2018-12-13 11:58:38.000000000 +0100 @@ -0,0 +1,109 @@ +#!/usr/bin/env rspec +# encoding: utf-8 + +# Copyright (c) [2018] SUSE LLC +# +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as published +# by the Free Software Foundation. +# +# 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. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, contact SUSE LLC. +# +# To contact SUSE LLC about this file by physical or electronic mail, you may +# find current contact information at www.suse.com. + +require_relative 'test_helper' + + +require "yast" +require "services-manager/service_loader" + +describe Y2ServicesManager::ServiceLoader do + + subject { described_class.new } + + let(:alsasound) do + instance_double( + Yast2::SystemService, name: "alsasound", description: "alsasound", start: true, stop: true, + state: "active", substate: "running", changed?: false, start_mode: :on_boot, + save: nil, refresh: nil, errors: {}, service: Yast2::SystemService.build("alsasound") + ) + end + + let(:apparmor) do + instance_double( + Yast2::SystemService, name: "apparmor", changed?: true, active?: true, + running?: false, refresh: nil, save: nil, errors: {}, service: Yast2::SystemService.build("apparmor") + ) + end + + let(:empty_SystemService) do + instance_double( + Yast2::SystemService, errors: {}, service: nil + ) + end + + let(:services) do + [alsasound, apparmor] + end + + describe "#read" do + before do + allow_any_instance_of(Y2ServicesManager::ServiceLoader) + .to receive(:list_unit_files). + and_return(["apparmor.service enabled\n", + "alsasound.service static\n"]) + allow_any_instance_of(Y2ServicesManager::ServiceLoader) + .to receive(:list_units). + and_return(["alsasound.service loaded inactive dead Sound Card\n", + "apparmor.service loaded active exited AppArmor profiles\n"]) + allow(Y2ServicesManager::ServiceLoader) + .to receive(:chroot_env?).and_return(false) + end + + context "when services can be evalutated by systemd/sockets" do + it "returns services with correct name" do + expect(Yast2::SystemService).to receive(:find_many). + with(services.map {|service| service.name}.sort). + and_return(services) + read_services = subject.read.map {|key, service| service.name} + expect(read_services).to eq( services.map {|service| service.name}) + end + end + + context "when services cannot be evalutated by systemd/sockets" do + it "returns none services" do + expect(Yast2::SystemService).to receive(:find_many). + with(services.map {|service| service.name}.sort). + and_return([empty_SystemService,empty_SystemService]) + expect(subject.read).to be_empty + end + end + end + + describe ".chroot_env?" do + context "when it has been started in chroot environment" do + it "returns true" do + expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), + /systemctl status/).and_return({"stderr" => "Running in chroot"}) + expect(Y2ServicesManager::ServiceLoader.chroot_env?).to be true + end + end + + context "when it has not been started in chroot environment" do + it "returns true" do + expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), + /systemctl status/).and_return({"stderr" => ""}) + expect(Y2ServicesManager::ServiceLoader.chroot_env?).to be false + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-4.1.8/test/support/services_manager_helpers.rb new/yast2-services-manager-4.1.11/test/support/services_manager_helpers.rb --- old/yast2-services-manager-4.1.8/test/support/services_manager_helpers.rb 2018-10-16 17:43:02.000000000 +0200 +++ new/yast2-services-manager-4.1.11/test/support/services_manager_helpers.rb 2018-12-13 11:58:38.000000000 +0100 @@ -84,9 +84,9 @@ end start_modes = service_specs[:start_modes] || [:on_boot, :manually] - + service_name = service_specs[:unit].split(".").first service = instance_double(Yast2::SystemService, - name: service_specs[:unit].split(".").first, + name: service_name, start_mode: start_mode, start_modes: start_modes, active?: service_specs[:active] == "active", @@ -96,7 +96,8 @@ keywords: service_specs[:keywords], changed?: service_specs[:changed] || false, found?: service_specs[:found] || true, - errors: service_specs[:errors] || [] + errors: service_specs[:errors] || [], + service: Yast2::SystemService.build(service_name) ) allow(service).to receive(:start_mode=)