From f714448be7613017779d196daa72238b0efffaba Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 21 Aug 2023 17:29:44 +0900 Subject: [PATCH] Honor the same option given later --- ruby.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ruby.c b/ruby.c index 125bfb9453..0276fbcde9 100644 --- a/ruby.c +++ b/ruby.c @@ -899,6 +899,7 @@ moreswitches(const char *s, ruby_cmdline_options_t *opt, int envopt) ruby_features_t feat = opt->features; ruby_features_t warn = opt->warn; long backtrace_length_limit = opt->backtrace_length_limit; + const char *bugreport_path = opt->bugreport_path; while (ISSPACE(*s)) s++; if (!*s) return; @@ -953,6 +954,9 @@ moreswitches(const char *s, ruby_cmdline_options_t *opt, int envopt) if (BACKTRACE_LENGTH_LIMIT_VALID_P(backtrace_length_limit)) { opt->backtrace_length_limit = backtrace_length_limit; } + if (bugreport_path) { + opt->bugreport_path = bugreport_path; + } ruby_xfree(ptr); /* get rid of GC */ @@ -1464,9 +1468,7 @@ proc_long_options(ruby_cmdline_options_t *opt, const char *s, long argc, char ** } } else if (is_option_with_arg("bugreport-path", true, true)) { - if (!opt->bugreport_path) { - opt->bugreport_path = s; - } + opt->bugreport_path = s; } else { rb_raise(rb_eRuntimeError,