Skip to content

The latest pathname gem release is emitting warnings when used on ruby-master #66

@eregon

Description

@eregon
$ ruby -v
ruby 3.5.0dev (2025-10-09T08:06:20Z master a29c90c3b0) +PRISM [x86_64-linux]

$ gem install pathname
Building native extensions. This could take a while...
Successfully installed pathname-0.4.0
1 gem installed

$ ruby -e 'gem "pathname"; require "pathname"'                           
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:17: warning: already initialized constant Pathname::VERSION
<internal:pathname_builtin>:194: warning: previous definition of VERSION was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:22: warning: already initialized constant Pathname::TO_PATH
<internal:pathname_builtin>:199: warning: previous definition of TO_PATH was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:24: warning: already initialized constant Pathname::SAME_PATHS
<internal:pathname_builtin>:201: warning: previous definition of SAME_PATHS was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:36: warning: already initialized constant Pathname::SEPARATOR_LIST
<internal:pathname_builtin>:319: warning: previous definition of SEPARATOR_LIST was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:37: warning: already initialized constant Pathname::SEPARATOR_PAT
<internal:pathname_builtin>:320: warning: previous definition of SEPARATOR_PAT was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:43: warning: already initialized constant Pathname::ABSOLUTE_PATH
<internal:pathname_builtin>:327: warning: previous definition of ABSOLUTE_PATH was here

$ ruby -we 'gem "pathname"; require "pathname"' 
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:17: warning: already initialized constant Pathname::VERSION
<internal:pathname_builtin>:194: warning: previous definition of VERSION was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:22: warning: already initialized constant Pathname::TO_PATH
<internal:pathname_builtin>:199: warning: previous definition of TO_PATH was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:24: warning: already initialized constant Pathname::SAME_PATHS
<internal:pathname_builtin>:201: warning: previous definition of SAME_PATHS was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:36: warning: already initialized constant Pathname::SEPARATOR_LIST
<internal:pathname_builtin>:319: warning: previous definition of SEPARATOR_LIST was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:37: warning: already initialized constant Pathname::SEPARATOR_PAT
<internal:pathname_builtin>:320: warning: previous definition of SEPARATOR_PAT was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:43: warning: already initialized constant Pathname::ABSOLUTE_PATH
<internal:pathname_builtin>:327: warning: previous definition of ABSOLUTE_PATH was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:50: warning: method redefined; discarding old chop_basename
<internal:pathname_builtin>:362: warning: previous definition of chop_basename was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:61: warning: method redefined; discarding old split_names
<internal:pathname_builtin>:373: warning: previous definition of split_names was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:71: warning: method redefined; discarding old prepend_prefix
<internal:pathname_builtin>:383: warning: previous definition of prepend_prefix was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:94: warning: method redefined; discarding old cleanpath
<internal:pathname_builtin>:406: warning: previous definition of cleanpath was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:106: warning: method redefined; discarding old cleanpath_aggressive
<internal:pathname_builtin>:418: warning: previous definition of cleanpath_aggressive was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:133: warning: method redefined; discarding old has_trailing_separator?
<internal:pathname_builtin>:445: warning: previous definition of has_trailing_separator? was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:144: warning: method redefined; discarding old add_trailing_separator
<internal:pathname_builtin>:456: warning: previous definition of add_trailing_separator was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:153: warning: method redefined; discarding old del_trailing_separator
<internal:pathname_builtin>:465: warning: previous definition of del_trailing_separator was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:165: warning: method redefined; discarding old cleanpath_conservative
<internal:pathname_builtin>:477: warning: previous definition of cleanpath_conservative was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:196: warning: method redefined; discarding old parent
<internal:pathname_builtin>:508: warning: previous definition of parent was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:201: warning: method redefined; discarding old mountpoint?
<internal:pathname_builtin>:513: warning: previous definition of mountpoint? was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:218: warning: method redefined; discarding old root?
<internal:pathname_builtin>:530: warning: previous definition of root? was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:233: warning: method redefined; discarding old absolute?
<internal:pathname_builtin>:545: warning: previous definition of absolute? was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:248: warning: method redefined; discarding old relative?
<internal:pathname_builtin>:560: warning: previous definition of relative? was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:265: warning: method redefined; discarding old each_filename
<internal:pathname_builtin>:577: warning: previous definition of each_filename was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:297: warning: method redefined; discarding old descend
<internal:pathname_builtin>:609: warning: previous definition of descend was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:330: warning: method redefined; discarding old ascend
<internal:pathname_builtin>:642: warning: previous definition of ascend was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:362: warning: method redefined; discarding old plus
<internal:pathname_builtin>:674: warning: previous definition of plus was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:416: warning: method redefined; discarding old join
<internal:pathname_builtin>:728: warning: previous definition of join was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:449: warning: method redefined; discarding old children
<internal:pathname_builtin>:761: warning: previous definition of children was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:499: warning: method redefined; discarding old each_child
<internal:pathname_builtin>:811: warning: previous definition of each_child was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:517: warning: method redefined; discarding old relative_path_from
<internal:pathname_builtin>:829: warning: previous definition of relative_path_from was here
/home/eregon/prefix/ruby-master/lib/ruby/gems/3.5.0+4/gems/pathname-0.4.0/lib/pathname.rb:588: warning: method redefined; discarding old mkpath
<internal:pathname_builtin>:337: warning: previous definition of mkpath was here

I think this is already solved in

pathname/lib/pathname.rb

Lines 13 to 29 in 4689b0b

if defined?(::Pathname) # Clear builtin Pathname
# :stopdoc:
class ::Object
remove_const :Pathname
end
# Remove module_function Pathname
class << ::Kernel
undef Pathname
end
module ::Kernel
undef Pathname
end
$".delete('pathname.so')
# :startdoc:
end
so I think just making a release from master should be enough to address this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions