Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
55e0f40d
Commit
55e0f40d
authored
10 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
Handle broken symlinks in resolve_any_conflicts
Fixes Homebrew/homebrew#33328.
parent
05ba3f0e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Library/Homebrew/keg.rb
+11
-2
11 additions, 2 deletions
Library/Homebrew/keg.rb
Library/Homebrew/test/test_keg.rb
+16
-0
16 additions, 0 deletions
Library/Homebrew/test/test_keg.rb
with
27 additions
and
2 deletions
Library/Homebrew/keg.rb
+
11
−
2
View file @
55e0f40d
...
...
@@ -328,11 +328,20 @@ class Keg
return
unless
dst
.
symlink?
src
=
dst
.
resolved_path
# src itself may be a symlink, so check lstat to ensure we are dealing with
# a directory, and not a symlink pointing at a directory (which needs to be
# treated as a file). In other words, we only want to resolve one symlink.
# If it isn't a directory, make_relative_symlink will raise an exception.
if
src
.
lstat
.
directory?
begin
stat
=
src
.
lstat
rescue
Errno
::
ENOENT
# dst is a broken symlink, so remove it.
dst
.
unlink
unless
mode
.
dry_run
return
end
if
stat
.
directory?
keg
=
Keg
.
for
(
src
)
dst
.
unlink
unless
mode
.
dry_run
keg
.
link_dir
(
src
,
mode
)
{
:mkpath
}
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/test/test_keg.rb
+
16
−
0
View file @
55e0f40d
...
...
@@ -239,4 +239,20 @@ class LinkTests < Homebrew::TestCase
a
.
uninstall
b
.
uninstall
end
def
test_removes_broken_symlinks_that_conflict_with_directories
a
=
HOMEBREW_CELLAR
.
join
(
"a"
,
"1.0"
)
a
.
join
(
"lib"
,
"foo"
).
mkpath
keg
=
Keg
.
new
(
a
)
link
=
HOMEBREW_PREFIX
.
join
(
"lib"
,
"foo"
)
link
.
parent
.
mkpath
link
.
make_symlink
(
@nonexistent
)
keg
.
link
ensure
keg
.
unlink
keg
.
uninstall
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment