Hello community, here is the log from the commit of package yast2-update for openSUSE:Factory checked in at 2018-11-10 16:49:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-update (Old) and /work/SRC/openSUSE:Factory/.yast2-update.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-update" Sat Nov 10 16:49:48 2018 rev:125 rq:647113 version:4.1.5 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-update/yast2-update.changes 2018-11-01 18:59:02.485988731 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-update.new/yast2-update.changes 2018-11-10 16:49:52.996454763 +0100 @@ -1,0 +2,10 @@ +Mon Nov 5 17:10:54 UTC 2018 - jlopez@suse.com + +- Avoid to crash when crypttab contains entries where the LUKS is + given by UUID= format. +- Avoid to crash when an encryption device is not probed with the + name indicated in a fstab entry. +- Related to bsc#1094963. +- 4.1.5 + +------------------------------------------------------------------- Old: ---- yast2-update-4.1.4.tar.bz2 New: ---- yast2-update-4.1.5.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-update.spec ++++++ --- /var/tmp/diff_new_pack.coaHBC/_old 2018-11-10 16:49:53.460454176 +0100 +++ /var/tmp/diff_new_pack.coaHBC/_new 2018-11-10 16:49:53.464454171 +0100 @@ -17,7 +17,7 @@ Name: yast2-update -Version: 4.1.4 +Version: 4.1.5 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -39,10 +39,10 @@ # Needed for tests BuildRequires: rubygem(rspec) -# Encryption.use_crypttab_names -BuildRequires: yast2-storage-ng >= 4.0.186 -# Encryption.use_crypttab_names -Requires: yast2-storage-ng >= 4.0.186 +# Encryption.save_crypttab_names +BuildRequires: yast2-storage-ng >= 4.1.31 +# Encryption.save_crypttab_names +Requires: yast2-storage-ng >= 4.1.31 # FSSnapshotStore Requires: yast2 >= 3.1.126 Requires: yast2-installation ++++++ yast2-update-4.1.4.tar.bz2 -> yast2-update-4.1.5.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-4.1.4/package/yast2-update.changes new/yast2-update-4.1.5/package/yast2-update.changes --- old/yast2-update-4.1.4/package/yast2-update.changes 2018-10-16 17:43:56.000000000 +0200 +++ new/yast2-update-4.1.5/package/yast2-update.changes 2018-11-07 15:21:01.000000000 +0100 @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Mon Nov 5 17:10:54 UTC 2018 - jlopez@suse.com + +- Avoid to crash when crypttab contains entries where the LUKS is + given by UUID= format. +- Avoid to crash when an encryption device is not probed with the + name indicated in a fstab entry. +- Related to bsc#1094963. +- 4.1.5 + +------------------------------------------------------------------- Tue Oct 16 16:37:07 CEST 2018 - schubi@suse.de - Added license file to spec. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-4.1.4/package/yast2-update.spec new/yast2-update-4.1.5/package/yast2-update.spec --- old/yast2-update-4.1.4/package/yast2-update.spec 2018-10-16 17:43:56.000000000 +0200 +++ new/yast2-update-4.1.5/package/yast2-update.spec 2018-11-07 15:21:01.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-update -Version: 4.1.4 +Version: 4.1.5 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -41,10 +41,10 @@ # Needed for tests BuildRequires: rubygem(rspec) -# Encryption.use_crypttab_names -BuildRequires: yast2-storage-ng >= 4.0.186 -# Encryption.use_crypttab_names -Requires: yast2-storage-ng >= 4.0.186 +# Encryption.save_crypttab_names +BuildRequires: yast2-storage-ng >= 4.1.31 +# Encryption.save_crypttab_names +Requires: yast2-storage-ng >= 4.1.31 # FSSnapshotStore Requires: yast2 >= 3.1.126 Requires: yast2-installation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-4.1.4/src/modules/RootPart.rb new/yast2-update-4.1.5/src/modules/RootPart.rb --- old/yast2-update-4.1.4/src/modules/RootPart.rb 2018-10-16 17:43:56.000000000 +0200 +++ new/yast2-update-4.1.5/src/modules/RootPart.rb 2018-11-07 15:21:01.000000000 +0100 @@ -1121,7 +1121,18 @@ mount_err = "" while mount_err != nil - mount_err = FsckAndMount(fspath, spec, mount_type, mntops) + # An encryption device might be probed with a name that does not match with the name + # indicated in the fstab file. For example, when the fstab entry is: + # + # /dev/mapper/cr_home /home ext4 defaults 0 0 + # + # and that encryption device was probed as /dev/mapper/cr-auto-1. + # + # In that case, to mount /dev/mapper/cr_home would fail because there is not a device + # in the inst-sys with such name. To avoid possible failures when mounting the fstab + # device, the safest device name is used instead, that is, UUID= format or its uuid + # udev name, see {#safest_device_name}. + mount_err = FsckAndMount(fspath, safest_device_name(spec), mount_type, mntops) if mount_err != nil Builtins.y2error( "mounting %1 (type %2) on %3 failed", @@ -1531,9 +1542,23 @@ fstab = fstab_ref.value crtab = crtab_ref.value - # Update encryption devices with the names indicated in the crypttab file (bsc#1094963) + # Encryption names indicated in the crypttab file are stored in its correspondig encryption + # device to make possible to find a device by using the name specified in a fstab file, + # (bsc#1094963). + # + # For example, when fstab has: + # + # /dev/disk/by-id/dm-name-cr_home / auto 0 0 + # + # and the fstab device is searched by that name: + # + # devicegraph.find_by_any_name("/dev/disk/by-id/dm-name-cr_home") + # + # The proper encryption device could be found if there is a encrypttion device where + # + # encryption.crypttab_name #=> "cr_home" crypttab_path = File.join(Installation.destdir, "/etc/crypttab") - Y2Storage::Encryption.use_crypttab_names(probed, crypttab_path) + Y2Storage::Encryption.save_crypttab_names(probed, crypttab_path) Update.GetProductName @@ -2246,6 +2271,39 @@ dev.filesystem end + # Safest device name to perform the mount action + # + # It will be the udev uuid name (e.g., /dev/disk/by-uuid/111-222-333) when the device + # spec has not UUID= format. + # + # @see udev_uuid + # + # @example + # + # safest_device_name("UUID=111-222-333") #=> "UUID=111-222-333" + # safest_device_name("/dev/mapper/cr_home") #=> "/dev/disk/by-uuid/111-222-333" + # + # @param device_spec [String] e.g., "UUID=111-222-333", "/dev/sda2", "/dev/mapper/cr_home" + # @return [String] safest device name, e.g., "/dev/disk/by-uuid/111-222-333" + def safest_device_name(device_spec) + return device_spec if device_spec.start_with?("UUID=") + + udev_uuid(device_spec) || device_spec + end + + # Finds a device and returns its udev uuid name + # + # @param device_spec [String] e.g., "UUID=111-222-333", "/dev/sda2", "/dev/mapper/cr_home" + # @return [String, nil] uuid name (e.g., "/dev/disk/by-uuid/111-222-333") or nil if the + # device is not found. + def udev_uuid(device_spec) + filesystem = fs_by_devicename(probed, device_spec) + return nil if filesystem.nil? + + device = filesystem.blk_devices.first + device.udev_full_uuid + end + # Whether the given fstab spec corresponds to a device mounted by its kernel # device name. # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-4.1.4/test/root_part_test.rb new/yast2-update-4.1.5/test/root_part_test.rb --- old/yast2-update-4.1.4/test/root_part_test.rb 2018-10-16 17:43:56.000000000 +0200 +++ new/yast2-update-4.1.5/test/root_part_test.rb 2018-11-07 15:21:01.000000000 +0100 @@ -236,6 +236,25 @@ end describe "#MountFSTab" do + before do + stub_storage(scenario) + # Mock the system lookup executed as last resort when the devicegraph + # doesn't contain the searched information + allow(Y2Storage::BlkDevice).to receive(:find_by_any_name) + end + + let(:scenario) { "two-disks-two-btrfs.xml" } + + let(:fstab) do + [ + { + "file"=>"/home", "mntops"=>"defaults", "vfstype"=>"ext4", "spec"=> device_spec + } + ] + end + + let(:device_spec) { nil } + it "mounts /dev, /proc and /sys" do allow(subject).to receive(:AddMountedPartition) @@ -247,6 +266,41 @@ fstab = [] subject.MountFSTab(fstab, "") end + + context "when the device spec has UUID= format" do + let(:device_spec) { "UUID=111-222-333" } + + it "tries to mount by using UUID= spec" do + expect(subject).to receive(:FsckAndMount) + .with("/home", "UUID=111-222-333", anything, anything) + + subject.MountFSTab(fstab, "") + end + end + + context "when the device spec does not have UUID= format" do + context "and a device with such spec is not found" do + let(:device_spec) { "/dev/sdc1" } + + it "tries to mount by using the given device spec" do + expect(subject).to receive(:FsckAndMount) + .with("/home", "/dev/sdc1", anything, anything) + + subject.MountFSTab(fstab, "") + end + end + + context "and a device with such spec is found" do + let(:device_spec) { "/dev/sda2" } + + it "tries to mount by using its udev uuid name" do + expect(subject).to receive(:FsckAndMount) + .with("/home", "/dev/disk/by-uuid/d6e5c710-3067-48de-8363-433e54a9d0b5", anything, anything) + + subject.MountFSTab(fstab, "") + end + end + end end describe "#inject_intsys_files" do