Ruby 2.2 will define Pathname#/ as a simple alias of Pathname#+.
In practice, this means that it will raise a TypeError unless the
argument responds to to_path or to_str.
Currently we blindly convert the argument to a string using to_s, so
deprecate this in the interest of matching the upstream behavior. In the
future we can replace this with
alias_method :/, :+ unless method_defined?(:/)
ClosesHomebrew/homebrew#30079.
Pathname#inspect on Ruby 2.0 throws away the encoding of the object's
underlying string and returns a string tagged as ASCII-8BIT.
If you simply write
puts Pathname.new("some string with non-ascii bytes").inspect
no error will be raised, because the implementation of Pathname#inspect
does not call into Object#inspect.
However, if you wrap that pathname object in an array first, then
puts [Pathname.new("some string with non-ascii bytes")].inspect
will raise Encoding::CompatibilityError: "inspected result must be ASCII
only or use the same encoding with default external".
Raising an error in this codepath is new in Ruby 2.0, and this specific
bug is fixed in Ruby 2.1. I've opened a bug upstream:
https://bugs.ruby-lang.org/issues/9915FixesHomebrew/homebrew#29947.
This method is for internal use only. It is unsuitable for use in
formulae, which should use install_symlink to create relative symlinks.
Thus callers are required to pass a Pathname, not a string, and we can
remove this conditional.
Further, if src is not absolute, then src.relative_path_from(dirname)
will fail. All callers currently pass absolute pathnames. Therefore we
don't need to call expand_path when printing it.
If an etc file exists on installation instead of overwriting it (or
requiring all the manual checks in formula) simply copy it with the
extension `.default` appended.
After a formula is built, scan all mach-o files for dynamic links
to see if any of them point to a C++ stdlib (libc++ or libstdc++).
If one of them is linked, record that information in the formula's tab.
This replaces the old behaviour where all files were assumed to be C++
code, and stdlibs were always tracked regardless of whether they were
actually linked against.
This also modifies the way that tabs are written - now tabs are written
with the stdlib field null, and values are only written if an stdlib
is detected.