From de69cb58ec706893dc14b2c61f4255a6943a0cf9 Mon Sep 17 00:00:00 2001 From: Jeff Kowalczyk Date: Fri, 24 Jul 2020 01:22:12 -0700 Subject: [PATCH 1/2] Update is_wsl to match osrelease spellings under both WSL1 and WSL2. Microsoft kernels are named "4.0-19041-Microsoft" on WSL1 and "4.19.104-microsoft-standard" on WSL2. Match on lowercase "-microsoft". (boo#1174183) --- library/general/src/modules/Arch.rb | 6 +++++- library/general/test/arch_test.rb | 12 ++++++++++-- package/yast2.changes | 6 ++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/library/general/src/modules/Arch.rb b/library/general/src/modules/Arch.rb index 7ff875f6e..d07cd2a71 100644 --- a/library/general/src/modules/Arch.rb +++ b/library/general/src/modules/Arch.rb @@ -498,7 +498,11 @@ def x11_setup_needed # # @return [Boolean] true if runs on WSL; false otherwise def is_wsl - SCR.Read(path(".target.string"), "/proc/sys/kernel/osrelease").to_s.include?("-Microsoft") + # As of 2020-07-24 /proc/sys/kernel/osrelease contains + # "4.4.0-19041-Microsoft" on wsl1 and + # "4.19.104-microsoft-standard" on wsl2. + # Match on lowercase "-microsoft" + SCR.Read(path(".target.string"), "/proc/sys/kernel/osrelease").to_s.downcase.include?("-microsoft") end publish function: :architecture, type: "string ()" diff --git a/library/general/test/arch_test.rb b/library/general/test/arch_test.rb index bd208c68a..18688a516 100755 --- a/library/general/test/arch_test.rb +++ b/library/general/test/arch_test.rb @@ -52,8 +52,16 @@ .and_return(osrelease) end - context "when it runs on a Microsoft kernel" do - let(:osrelease) { "5.3.11-Microsoft" } + context "when it runs on a Microsoft kernel under WSL1" do + let(:osrelease) { "4.4.0-19041-Microsoft" } + + it "returns true" do + expect(Yast::Arch.is_wsl).to eq(true) + end + end + + context "when it runs on a Microsoft kernel under WSL2" do + let(:osrelease) { "4.19.104-microsoft-standard" } it "returns true" do expect(Yast::Arch.is_wsl).to eq(true) diff --git a/package/yast2.changes b/package/yast2.changes index dd0cc8278..cef398962 100644 --- a/package/yast2.changes +++ b/package/yast2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jul 24 08:06:27 UTC 2020 - Jeff Kowalczyk + +- update is_wsl function to match wsl1 and wsl2 osrelease spellings + (boo#1174183) + ------------------------------------------------------------------- Tue Jul 7 09:48:04 CEST 2020 - schubi@suse.de From 79341e130f26c394ad8d4d90532c6a78a75ab1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Alejandro=20Anderssen=20Gonz=C3=A1lez?= Date: Mon, 27 Jul 2020 10:41:39 +0100 Subject: [PATCH 2/2] Bump version --- package/yast2.changes | 1 + package/yast2.spec | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package/yast2.changes b/package/yast2.changes index cef398962..a1ee8e956 100644 --- a/package/yast2.changes +++ b/package/yast2.changes @@ -3,6 +3,7 @@ Fri Jul 24 08:06:27 UTC 2020 - Jeff Kowalczyk - update is_wsl function to match wsl1 and wsl2 osrelease spellings (boo#1174183) +- 4.2.87 ------------------------------------------------------------------- Tue Jul 7 09:48:04 CEST 2020 - schubi@suse.de diff --git a/package/yast2.spec b/package/yast2.spec index c99a1170a..b91f45f10 100644 --- a/package/yast2.spec +++ b/package/yast2.spec @@ -17,7 +17,7 @@ Name: yast2 -Version: 4.2.86 +Version: 4.2.87 Release: 0 Summary: YaST2 Main Package License: GPL-2.0-only