ruby-changes:60167
From: Nobuyoshi <ko1@a...>
Date: Sun, 23 Feb 2020 13:37:38 +0900 (JST)
Subject: [ruby-changes:60167] 0ed3384fd4 (master): Revert "Prefer `exe/ruby` to execute from it"
https://git.ruby-lang.org/ruby.git/commit/?id=0ed3384fd4 From 0ed3384fd463ff80f5e55f7d4c62338fb15337d5 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 23 Feb 2020 13:31:56 +0900 Subject: Revert "Prefer `exe/ruby` to execute from it" This reverts commit c7b71af9e21b3f0b8fe413a3c20cf4bd633c40d0, as an example in bundler expects untouch PATH. diff --git a/common.mk b/common.mk index 200bf71..5680573 100644 --- a/common.mk +++ b/common.mk @@ -878,7 +878,7 @@ $(PLATFORM_D): https://github.com/ruby/ruby/blob/trunk/common.mk#L878 @$(NULLCMD) > $@ exe/$(PROGRAM): ruby-runner.c ruby-runner.h exe/.time miniruby$(EXEEXT) {$(VPATH)}config.h - $(Q) $(CC) $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) -DRUBY_RUNNER_PATH=$(@D) -DRUBY_INSTALL_NAME=$(@F) $(COUTFLAG)ruby-runner.$(OBJEXT) -c $(CSRCFLAG)$(srcdir)/ruby-runner.c + $(Q) $(CC) $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) -DRUBY_INSTALL_NAME=$(@F) $(COUTFLAG)ruby-runner.$(OBJEXT) -c $(CSRCFLAG)$(srcdir)/ruby-runner.c $(Q) $(PURIFY) $(CC) $(CFLAGS) $(LDFLAGS) $(OUTFLAG)$@ ruby-runner.$(OBJEXT) $(LIBS) $(Q) $(POSTLINK) $(Q) ./miniruby$(EXEEXT) \ diff --git a/ruby-runner.c b/ruby-runner.c index 7e0ed6e..d41ba27 100644 --- a/ruby-runner.c +++ b/ruby-runner.c @@ -17,7 +17,7 @@ const char MJIT_HEADER[] = BUILDDIR "/" MJIT_MIN_HEADER; https://github.com/ruby/ruby/blob/trunk/ruby-runner.c#L17 #define STRINGIZE0(expr) #expr static void -insert_env_path(const char *envname, const char *paths, size_t size, int prepend, int add) +insert_env_path(const char *envname, const char *paths, size_t size, int prepend) { const char *env = getenv(envname); char c = 0; @@ -28,9 +28,6 @@ insert_env_path(const char *envname, const char *paths, size_t size, int prepend https://github.com/ruby/ruby/blob/trunk/ruby-runner.c#L28 n = strlen(env); while (n > 0 && env[n-1] == PATH_SEP) --n; } - else if (!add) { - return; - } if (c) { char *e = malloc(size+n+1); size_t pos = 0; @@ -59,7 +56,6 @@ int https://github.com/ruby/ruby/blob/trunk/ruby-runner.c#L56 main(int argc, char **argv) { static const char builddir[] = BUILDDIR; - static const char exedir[] = BUILDDIR"/"STRINGIZE(RUBY_RUNNER_PATH); static const char rubypath[] = BUILDDIR"/"STRINGIZE(RUBY_INSTALL_NAME); static const char rubylib[] = ABS_SRCDIR"/lib" @@ -77,12 +73,11 @@ main(int argc, char **argv) https://github.com/ruby/ruby/blob/trunk/ruby-runner.c#L73 const char *rubyname = rubypath + dirsize; char *arg0 = argv[0], *p; - insert_env_path(LIBPATHENV, builddir, dirsize, 1, 1); - insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0, 1); - insert_env_path("PATH", exedir, sizeof(exedir), 1, 0); + insert_env_path(LIBPATHENV, builddir, dirsize, 1); + insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0); #ifndef LOAD_RELATIVE if (PRELOADENV[0] && stat(mjit_build_dir, &stbuf) == 0) { - insert_env_path(PRELOADENV, mjit_build_dir, sizeof(mjit_build_dir), 1, 1); + insert_env_path(PRELOADENV, mjit_build_dir, sizeof(mjit_build_dir), 1); setenv("MJIT_SEARCH_BUILD_DIR", "true", 0); } #endif -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/