Bugs item #2669, was opened at 2005-10-18 18:41
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2669&group_id=426

Category: Core
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Lloyd Zusman (hippoman)
Assigned to: Nobody (None)
Summary: Segfault in 1.8.3, rb_file_join, file.c

Initial Comment:
On my RH9 box, I sometimes get segfaults during File.join when running 1.8.3.  This occurs with the stable release as well as with all of the stable nightlies that I have tried.

I was able to block this from occurring with the following patch.  However, I don't know if this really fixes anything, or if it's actually just masking another more fundamental problem.

I'm sure that some of you developers will be able to know.

% uname -prs
Linux 2.4.20-021stab028.17.777-enterprise i686

% diff -u file.c.orig file.c
--- file.c.orig	2005-10-18 18:19:29.000000000 -0400
+++ file.c	2005-10-18 18:39:45.000000000 -0400
@@ -2785,7 +2785,7 @@
 	name = StringValueCStr(result);
 	if (i > 0 && !NIL_P(sep)) {
 	    tail = chompdirsep(name);
-	    if (isdirsep(RSTRING(tmp)->ptr[0])) {
+	    if (RSTRING(tmp)->ptr && isdirsep(RSTRING(tmp)->ptr[0])) {
 		RSTRING(result)->len = tail - name;
 	    }
 	    else if (!*tail) {

In other words, RSTRING(tmp)->ptr sometimes ends up being NULL here.


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2669&group_id=426