From bc4da870a4f71a6f374adc8209773da78b8b835c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 19 Jul 2025 23:12:43 +0900 Subject: [PATCH 1/3] Sync tool/ln_sr.rb --- tool/ln_sr.rb | 69 +++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/tool/ln_sr.rb b/tool/ln_sr.rb index e1b5b6f76b4436..d4f5502aaaa9a6 100755 --- a/tool/ln_sr.rb +++ b/tool/ln_sr.rb @@ -31,64 +31,63 @@ include FileUtils unless respond_to?(:ln_sr) def ln_sr(src, dest, target_directory: true, force: nil, noop: nil, verbose: nil) - options = "#{force ? 'f' : ''}#{target_directory ? '' : 'T'}" - dest = File.path(dest) - srcs = Array(src) - link = proc do |s, target_dir_p = true| - s = File.path(s) - if target_dir_p - d = File.join(destdirs = dest, File.basename(s)) + cmd = "ln -s#{force ? 'f' : ''}#{target_directory ? '' : 'T'}" if verbose + fu_each_src_dest0(src, dest, target_directory) do |s,d| + if target_directory + parent = File.dirname(d) + destdirs = fu_split_path(parent) + real_ddirs = fu_split_path(File.realpath(parent)) else - destdirs = File.dirname(d = dest) + destdirs ||= fu_split_path(dest) + real_ddirs ||= fu_split_path(File.realdirpath(dest)) end - destdirs = fu_split_path(File.realpath(destdirs)) - if fu_starting_path?(s) - srcdirs = fu_split_path((File.realdirpath(s) rescue File.expand_path(s))) - base = fu_relative_components_from(srcdirs, destdirs) - s = File.join(*base) + srcdirs = fu_split_path(s) + i = fu_common_components(srcdirs, destdirs) + n = destdirs.size - i + n -= 1 unless target_directory + link1 = fu_clean_components(*Array.new([n, 0].max, '..'), *srcdirs[i..-1]) + begin + real_sdirs = fu_split_path(File.realdirpath(s)) rescue nil + rescue else - srcdirs = fu_clean_components(*fu_split_path(s)) - base = fu_relative_components_from(fu_split_path(Dir.pwd), destdirs) - while srcdirs.first&. == ".." and base.last&.!=("..") and !fu_starting_path?(base.last) - srcdirs.shift - base.pop - end - s = File.join(*base, *srcdirs) + i = fu_common_components(real_sdirs, real_ddirs) + n = real_ddirs.size - i + n -= 1 unless target_directory + link2 = fu_clean_components(*Array.new([n, 0].max, '..'), *real_sdirs[i..-1]) + link1 = link2 if link1.size > link2.size end - fu_output_message "ln -s#{options} #{s} #{d}" if verbose + s = File.join(link1) + fu_output_message [cmd, s, d].flatten.join(' ') if verbose next if noop remove_file d, true if force File.symlink s, d end - case srcs.size - when 0 - when 1 - link[srcs[0], target_directory && File.directory?(dest)] - else - srcs.each(&link) - end end - def fu_split_path(path) + def fu_split_path(path) #:nodoc: path = File.path(path) list = [] until (parent, base = File.split(path); parent == path or parent == ".") - list << base + if base != '..' and list.last == '..' and !(fu_have_symlink? && File.symlink?(path)) + list.pop + else + list << base + end path = parent end list << path list.reverse! end - def fu_relative_components_from(target, base) #:nodoc: + def fu_common_components(target, base) #:nodoc: i = 0 while target[i]&.== base[i] i += 1 end - Array.new(base.size-i, '..').concat(target[i..-1]) + i end - def fu_clean_components(*comp) + def fu_clean_components(*comp) #:nodoc: comp.shift while comp.first == "." return comp if comp.empty? clean = [comp.shift] @@ -106,11 +105,11 @@ def fu_clean_components(*comp) end if fu_windows? - def fu_starting_path?(path) + def fu_starting_path?(path) #:nodoc: path&.start_with?(%r(\w:|/)) end else - def fu_starting_path?(path) + def fu_starting_path?(path) #:nodoc: path&.start_with?("/") end end From c7bb38d94c71b5ce09fa5db13a29ced750d5a7b2 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 19 Jul 2025 23:13:41 +0900 Subject: [PATCH 2/3] `FileUtils#ln_sr` is private because it is a module function --- tool/ln_sr.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/ln_sr.rb b/tool/ln_sr.rb index d4f5502aaaa9a6..5bc4f48cdbbb5f 100755 --- a/tool/ln_sr.rb +++ b/tool/ln_sr.rb @@ -29,7 +29,7 @@ require 'fileutils' include FileUtils -unless respond_to?(:ln_sr) +unless respond_to?(:ln_sr, true) def ln_sr(src, dest, target_directory: true, force: nil, noop: nil, verbose: nil) cmd = "ln -s#{force ? 'f' : ''}#{target_directory ? '' : 'T'}" if verbose fu_each_src_dest0(src, dest, target_directory) do |s,d| From 000b4a7c9c6eca871718eac3075b2b8cd7067bff Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 20 Jul 2025 00:51:23 +0900 Subject: [PATCH 3/3] Use the fixed tests of RBS --- gems/bundled_gems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gems/bundled_gems b/gems/bundled_gems index a040f93a34db31..4f5544087b00ec 100644 --- a/gems/bundled_gems +++ b/gems/bundled_gems @@ -18,7 +18,7 @@ net-pop 0.1.2 https://github.com/ruby/net-pop net-smtp 0.5.1 https://github.com/ruby/net-smtp matrix 0.4.3 https://github.com/ruby/matrix prime 0.1.4 https://github.com/ruby/prime -rbs 3.9.4 https://github.com/ruby/rbs +rbs 3.9.4 https://github.com/ruby/rbs f06b6f8d705ffecbac9e0b57e655a72b1e7cd077 typeprof 0.30.1 https://github.com/ruby/typeprof debug 1.11.0 https://github.com/ruby/debug racc 1.8.1 https://github.com/ruby/racc pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy