Add symlinked home detection to brew doctor on Linux
Co-authored-by: MikeMcQuaid <125011+MikeMcQuaid@users.noreply.github.com>
This commit is contained in:
parent
b8c82b44b8
commit
d785e2024b
@ -10,6 +10,7 @@ require "os/linux/kernel"
|
|||||||
module OS
|
module OS
|
||||||
module Linux
|
module Linux
|
||||||
module Diagnostic
|
module Diagnostic
|
||||||
|
# Linux-specific diagnostic checks for Homebrew.
|
||||||
module Checks
|
module Checks
|
||||||
extend T::Helpers
|
extend T::Helpers
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ module OS
|
|||||||
check_glibc_minimum_version
|
check_glibc_minimum_version
|
||||||
check_kernel_minimum_version
|
check_kernel_minimum_version
|
||||||
check_supported_architecture
|
check_supported_architecture
|
||||||
|
check_for_symlinked_home
|
||||||
].freeze
|
].freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -154,6 +156,27 @@ module OS
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_for_symlinked_home
|
||||||
|
return unless File.symlink?("/home")
|
||||||
|
|
||||||
|
<<~EOS
|
||||||
|
Your /home directory is a symlink.
|
||||||
|
This is known to cause issues with formula linking, particularly when installing
|
||||||
|
multiple formulae that create symlinks in shared directories.
|
||||||
|
|
||||||
|
While this may be a standard directory structure in some distributions
|
||||||
|
(e.g. Fedora Silverblue) there are known issues as-is.
|
||||||
|
|
||||||
|
If you encounter linking issues, you may need to manually create conflicting
|
||||||
|
directories or use `brew link --overwrite` as a workaround.
|
||||||
|
|
||||||
|
We'd welcome a PR to fix this functionality.
|
||||||
|
See https://github.com/Homebrew/brew/issues/18036 for more context.
|
||||||
|
|
||||||
|
#{support_tier_message(tier: 2)}
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
def check_gcc_dependent_linkage
|
def check_gcc_dependent_linkage
|
||||||
gcc_dependents = ::Formula.installed.select do |formula|
|
gcc_dependents = ::Formula.installed.select do |formula|
|
||||||
next false unless formula.tap&.core_tap?
|
next false unless formula.tap&.core_tap?
|
||||||
|
@ -25,4 +25,11 @@ RSpec.describe Homebrew::Diagnostic::Checks do
|
|||||||
expect(checks.check_kernel_minimum_version)
|
expect(checks.check_kernel_minimum_version)
|
||||||
.to match(/Your Linux kernel .+ is too old/)
|
.to match(/Your Linux kernel .+ is too old/)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
specify "#check_for_symlinked_home" do
|
||||||
|
allow(File).to receive(:symlink?).with("/home").and_return(true)
|
||||||
|
|
||||||
|
expect(checks.check_for_symlinked_home)
|
||||||
|
.to match(%r{Your /home directory is a symlink})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user