зеркало из https://github.com/github/ruby.git
Import patches for old macOS from MacPorts
This commit is contained in:
Родитель
80e483afac
Коммит
8350b48cfa
5
.gdbinit
5
.gdbinit
|
@ -1,5 +1,3 @@
|
|||
set startup-with-shell off
|
||||
|
||||
define hook-run
|
||||
set $color_type = 0
|
||||
set $color_highlite = 0
|
||||
|
@ -1345,3 +1343,6 @@ define print_flags
|
|||
end
|
||||
|
||||
source -s misc/gdb.py
|
||||
|
||||
# Moved from beginning, since it fails on older gdbs
|
||||
set startup-with-shell off
|
||||
|
|
14
file.c
14
file.c
|
@ -4533,6 +4533,11 @@ rb_check_realpath_emulate_rescue(VALUE arg, VALUE exc)
|
|||
{
|
||||
return Qnil;
|
||||
}
|
||||
#elif !defined(NEEDS_REALPATH_BUFFER) && defined(__APPLE__) && \
|
||||
(!defined(MAC_OS_X_VERSION_10_6) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6))
|
||||
/* realpath() on OSX < 10.6 doesn't implement automatic allocation */
|
||||
# include <sys/syslimits.h>
|
||||
# define NEEDS_REALPATH_BUFFER 1
|
||||
#endif /* HAVE_REALPATH */
|
||||
|
||||
static VALUE
|
||||
|
@ -4542,6 +4547,11 @@ rb_check_realpath_internal(VALUE basedir, VALUE path, rb_encoding *origenc, enum
|
|||
VALUE unresolved_path;
|
||||
char *resolved_ptr = NULL;
|
||||
VALUE resolved;
|
||||
# if defined(NEEDS_REALPATH_BUFFER) && NEEDS_REALPATH_BUFFER
|
||||
char resolved_buffer[PATH_MAX];
|
||||
# else
|
||||
char *const resolved_buffer = NULL;
|
||||
# endif
|
||||
|
||||
if (mode == RB_REALPATH_DIR) {
|
||||
return rb_check_realpath_emulate(basedir, path, origenc, mode);
|
||||
|
@ -4553,7 +4563,7 @@ rb_check_realpath_internal(VALUE basedir, VALUE path, rb_encoding *origenc, enum
|
|||
}
|
||||
if (origenc) unresolved_path = TO_OSPATH(unresolved_path);
|
||||
|
||||
if ((resolved_ptr = realpath(RSTRING_PTR(unresolved_path), NULL)) == NULL) {
|
||||
if ((resolved_ptr = realpath(RSTRING_PTR(unresolved_path), resolved_buffer)) == NULL) {
|
||||
/* glibc realpath(3) does not allow /path/to/file.rb/../other_file.rb,
|
||||
returning ENOTDIR in that case.
|
||||
glibc realpath(3) can also return ENOENT for paths that exist,
|
||||
|
@ -4570,7 +4580,9 @@ rb_check_realpath_internal(VALUE basedir, VALUE path, rb_encoding *origenc, enum
|
|||
rb_sys_fail_path(unresolved_path);
|
||||
}
|
||||
resolved = ospath_new(resolved_ptr, strlen(resolved_ptr), rb_filesystem_encoding());
|
||||
# if defined(NEEDS_REALPATH_BUFFER) && NEEDS_REALPATH_BUFFER
|
||||
free(resolved_ptr);
|
||||
# endif
|
||||
|
||||
# if !defined(__LINUX__) && !defined(__APPLE__)
|
||||
/* As `resolved` is a String in the filesystem encoding, no
|
||||
|
|
10
io.c
10
io.c
|
@ -104,6 +104,16 @@
|
|||
|
||||
#ifdef HAVE_COPYFILE_H
|
||||
# include <copyfile.h>
|
||||
|
||||
# ifndef COPYFILE_STATE_COPIED
|
||||
/*
|
||||
* Some OSes (e.g., OSX < 10.6) implement fcopyfile() but not
|
||||
* COPYFILE_STATE_COPIED. Since the only use of the former here
|
||||
* requires the latter, we disable the former when the latter is undefined.
|
||||
*/
|
||||
# undef HAVE_FCOPYFILE
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#include "ruby/internal/stdbool.h"
|
||||
|
|
3
signal.c
3
signal.c
|
@ -803,7 +803,8 @@ check_stack_overflow(int sig, const uintptr_t addr, const ucontext_t *ctx)
|
|||
const greg_t bp = mctx->gregs[REG_EBP];
|
||||
# endif
|
||||
# elif defined __APPLE__
|
||||
# if __DARWIN_UNIX03
|
||||
# include <AvailabilityMacros.h>
|
||||
# if defined(MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
# define MCTX_SS_REG(reg) __ss.__##reg
|
||||
# else
|
||||
# define MCTX_SS_REG(reg) ss.reg
|
||||
|
|
|
@ -490,7 +490,8 @@ rb_vmdebug_thread_dump_state(FILE *errout, VALUE self)
|
|||
}
|
||||
|
||||
#if defined __APPLE__
|
||||
# if __DARWIN_UNIX03
|
||||
# include <AvailabilityMacros.h>
|
||||
# if defined(MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
# define MCTX_SS_REG(reg) __ss.__##reg
|
||||
# else
|
||||
# define MCTX_SS_REG(reg) ss.reg
|
||||
|
@ -502,7 +503,8 @@ rb_vmdebug_thread_dump_state(FILE *errout, VALUE self)
|
|||
# ifdef HAVE_LIBUNWIND
|
||||
# undef backtrace
|
||||
# define backtrace unw_backtrace
|
||||
# elif defined(__APPLE__) && defined(HAVE_LIBUNWIND_H)
|
||||
# elif defined(__APPLE__) && defined(HAVE_LIBUNWIND_H) \
|
||||
&& defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
# define UNW_LOCAL_ONLY
|
||||
# include <libunwind.h>
|
||||
# include <sys/mman.h>
|
||||
|
|
Загрузка…
Ссылка в новой задаче