[#4654] signleton_methods / methods / public_methods - weirdness? — Johan Holmberg <holmberg@...>
[#4666] Getting a hex representation for a Numeric — "Zev Blut" <rubyzbibd@...>
Hello,
[#4670] ruby 1.8.3 preview1 plan — Yukihiro Matsumoto <matz@...>
Hi,
[#4690] test failures for stable-snapshot 09/04/2005 — noreply@...
Bugs item #1762, was opened at 10-04-2005 20:46
Hello.
[#4709] BNF-like grammar specified DIRECTLY in Ruby — Eric Mahurin <eric_mahurin@...>
Hello everybody,
[#4712] Segfault in zlib? — Nathaniel Talbott <ntalbott@...>
I'm using rubyzip (latest gem version) and zlib (1.2.2) to do a bunch
[#4736] Trivial speedup in Array#zip — Mauricio Fern疣dez <batsman.geo@...>
[#4745] Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...>
Having taken upon me the task to provide a Windows build for
On 4/20/05, Erik Huelsmann <ehuels@gmail.com> wrote:
Hi Austin,
Hi,
On 4/24/05, nobu.nokada@softhome.net <nobu.nokada@softhome.net> wrote:
Hi,
> > > Ruby is just using AC_TYPE_UID_T. So, using typedef for them,
Hi,
On 4/26/05, nobu.nokada@softhome.net <nobu.nokada@softhome.net> wrote:
As promised, I attached a patch to eliminate the compile problems
Hi,
Thanks for the quick response!
Hi,
On 5/14/05, nobu.nokada@softhome.net <nobu.nokada@softhome.net> wrote:
[#4751] Illegal regexp causes segfault — Andrew Walrond <andrew@...>
irb(main):058:0> a = /\[([^]]*)\]/
Andrew Walrond, April 22:
In article <200504221210.38231.andrew@walrond.org>,
>>>>> "T" == Tanaka Akira <akr@m17n.org> writes:
[#4774] enhanced $0 modification — Evan Webb <evanwebb@...>
The attached patch allows for ruby to use more of the available stack
Hi,
[#4775] profiler.rb Schroedinbug — C Erler <erlercw@...>
A ruby program with the single instruction "require 'profile'"
>A ruby program with the single instruction "require 'profile'"
[#4807] Re: -Wall — Vincent Isambart <vincent.isambart@...>
> Why does ruby build without -Wall in CFLAGS by default? -Wall can help to
[#4815] Re: -Wall — nobu.nokada@...
Hi,
[PATCH] enhanced $0 modification
The attached patch allows for ruby to use more of the available stack space when altering argv[0]. This allows for much more flexible usage of setting $0 as the new value is not constrained only be the current size of argv, but by the size of argv plus the size of the environment. Initial tests show that even though the new $0 consumes space formally occupied by the envp array, it has no ill effects on usage of the environment. Evan Webb // evan@fallingsnow.net
Attachments (1)
diff -u ruby-1.8.2.orig/eval.c ruby-1.8.2/eval.c
--- ruby-1.8.2.orig/eval.c 2004-12-17 18:07:29.000000000 -0800
+++ ruby-1.8.2/eval.c 2005-04-24 00:21:38.000000000 -0700
@@ -1369,9 +1369,9 @@
}
void
-ruby_options(argc, argv)
+ruby_options(argc, argv, env)
int argc;
- char **argv;
+ char **argv, **env;
{
int state;
@@ -1382,7 +1382,7 @@
Init_stack((void*)&state);
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
- ruby_process_options(argc, argv);
+ ruby_process_options(argc, argv, env);
}
else {
trace_func = 0;
diff -u ruby-1.8.2.orig/intern.h ruby-1.8.2/intern.h
--- ruby-1.8.2.orig/intern.h 2004-12-02 19:25:49.000000000 -0800
+++ ruby-1.8.2/intern.h 2005-04-24 00:36:26.000000000 -0700
@@ -372,7 +372,7 @@
void ruby_script _((const char*));
void ruby_prog_init _((void));
void ruby_set_argv _((int, char**));
-void ruby_process_options _((int, char**));
+void ruby_process_options _((int, char**, char**));
void ruby_load_script _((void));
void ruby_init_loadpath _((void));
void ruby_incpush _((const char*));
diff -u ruby-1.8.2.orig/main.c ruby-1.8.2/main.c
--- ruby-1.8.2.orig/main.c 2004-10-31 08:06:57.000000000 -0800
+++ ruby-1.8.2/main.c 2005-04-24 00:38:27.000000000 -0700
@@ -42,7 +42,7 @@
#endif
ruby_init();
- ruby_options(argc, argv);
+ ruby_options(argc, argv,envp);
ruby_run();
return 0;
}
diff -u ruby-1.8.2.orig/ruby.c ruby-1.8.2/ruby.c
--- ruby-1.8.2.orig/ruby.c 2004-07-23 00:52:38.000000000 -0700
+++ ruby-1.8.2/ruby.c 2005-04-24 01:17:19.000000000 -0700
@@ -66,6 +66,7 @@
static int origargc;
static char **origargv;
+static char *lastargv = NULL;
static void
usage(name)
@@ -967,21 +968,25 @@
rb_progname = rb_tainted_str_new(s, i);
#else
if (len == 0) {
- char *s = origargv[0];
- int i;
-
- s += strlen(s);
- /* See if all the arguments are contiguous in memory */
- for (i = 1; i < origargc; i++) {
- if (origargv[i] == s + 1) {
- s++;
- s += strlen(s); /* this one is ok too */
- }
- else {
- break;
- }
- }
- len = s - origargv[0];
+ if(lastargv) {
+ len = (lastargv - origargv[0]) - 2;
+ } else {
+ char *s = origargv[0];
+ int i;
+
+ s += strlen(s);
+ /* See if all the arguments are contiguous in memory */
+ for (i = 1; i < origargc; i++) {
+ if (origargv[i] == s + 1) {
+ s++;
+ s += strlen(s); /* this one is ok too */
+ }
+ else {
+ break;
+ }
+ }
+ len = s - origargv[0];
+ }
}
if (i >= len) {
@@ -1104,11 +1109,46 @@
}
}
+extern char **environ;
+
+/*
+ * Adapted enhanced usage of env space for program title
+ * from ProFTPD init_set_proc_title.
+ * Copyright (c) 1997, 1998 Public Flood Software
+ * Copyright (c) 1999, 2000 MacGyver, aka Habeeb J. Dihu <macgyver@tos.net>
+ */
+
void
-ruby_process_options(argc, argv)
+ruby_process_options(argc, argv, envp)
int argc;
- char **argv;
+ char **argv, **envp;
{
+ int i, envpsize;
+ char **p;
+
+ for(i = envpsize = 0; envp[i] != NULL;i++) {
+ envpsize += strlen(envp[i]) + 1;
+ }
+
+ p = (char **) malloc((i + 1) * sizeof(char *));
+ if(p != NULL) {
+ environ = p;
+ for(i = 0; envp[i] != NULL; i++) {
+ environ[i] = strdup(envp[i]);
+ }
+
+ for( i = 0; i < argc; i++) {
+ if(!i || (lastargv + 1 == argv[i]))
+ lastargv = argv[i] + strlen(argv[i]);
+ }
+
+ for(i = 0; envp[i] != NULL; i++) {
+ if((lastargv + 1) == envp[i]) {
+ lastargv = envp[i] + strlen(envp[i]);
+ }
+ }
+ }
+
origargc = argc; origargv = argv;
ruby_script(argv[0]); /* for the time being */
diff -u ruby-1.8.2.orig/ruby.h ruby-1.8.2/ruby.h
--- ruby-1.8.2.orig/ruby.h 2004-03-30 19:04:09.000000000 -0800
+++ ruby-1.8.2/ruby.h 2005-04-24 00:37:19.000000000 -0700
@@ -553,7 +553,7 @@
VALUE rb_require _((const char*));
void ruby_init _((void));
-void ruby_options _((int, char**));
+void ruby_options _((int, char**, char**));
NORETURN(void ruby_run _((void)));
RUBY_EXTERN VALUE rb_mKernel;