jed-users mailing list

[2006 Date Index] [2006 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

RE: Problems with evalfile (wjed)


> -----Original Message-----
> From: owner-jed-users-l@xxxxxxxxxxxxxxxx
> [mailto:owner-jed-users-l@xxxxxxxxxxxxxxxx]On Behalf Of Marko Mahnic
> Sent: venerdì 24 marzo 2006 16.37
> To: jed-users@xxxxxxxxxxx
> Subject: Re: Problems with evalfile (wjed)
> 
> 
> SANGOI DINO LEONARDO wrote:
> > 
> > Oops, sorry. I have seen this bug... but after fixing it, I 
> thought it was a
> > subversion mismerge: I have a branch for new John releases, 
> and I merge it
> > to my working branch everytime John releases a new version.
> > 
> > This is the patch you are looking for.
> > 
> 
> Thank you, but it didn't help. I still get
>    
> S:\localcvs\jedgui\jed-B0.99-17.200\lib\site.sl:3269:<top-leve
> l>:Open failed
> 
> Anyway, the patch does not change anything - the braces are 
> redundant the way
> they are placed. You probably changed something else, too.

Uhmmm... I don't know how the patch could came wrong... however, the problem
is missing braces for if (_stat() < 0). The problem is that if _stat()
returns an error, but the path does not start with two slashes, instead of
returning 0 (meaning 'file not found'), it continues execution and returns
1. So Jed thinks the file 'defaults.sl' exists, and tries to open it,
failing...
So the 'return 0', now inside 'if (ourname[0] == SLASH_CHAR && ourname[1] ==
SLASH_CHAR)' should be outside it, but inside 'if (_stat(...) < 0)'.

The code that now says:

--------
   if (
#ifdef _MSC_VER
       _stat(ourname, &buf) < 0
#else
       stat(ourname, &buf) < 0
#endif
       )

     if (ourname[0] == SLASH_CHAR && ourname[1] == SLASH_CHAR)
       {
	  int at = GetFileAttributes(ourname);

	  if (at >= 0)
	    {
	       if (at & FILE_ATTRIBUTE_DIRECTORY)
		 return 2;
	       else
		 return 1;
	    }
	  return 0;
       }
   *mode = buf.st_mode & 0777;
--------

should read as:

--------
   if (
#ifdef _MSC_VER
       _stat(ourname, &buf) < 0
#else
       stat(ourname, &buf) < 0
#endif
       )
   {

     if (ourname[0] == SLASH_CHAR && ourname[1] == SLASH_CHAR)
       {
	  int at = GetFileAttributes(ourname);

	  if (at >= 0)
	    {
	       if (at & FILE_ATTRIBUTE_DIRECTORY)
		 return 2;
	       else
		 return 1;
	    }
       }
      return 0;
   }
   *mode = buf.st_mode & 0777;
--------

This is (again) the patch, taken comparing my working version with
jed-snapshot-200.

--------
diff -ru --exclude .svn jed/src/win32.c ../../build/jed/src/win32.c
--- jed/src/win32.c	2006-02-13 17:51:58.000000000 +0100
+++ ../../build/jed/src/win32.c	2006-03-21 15:27:09.000000000 +0100
@@ -269,6 +269,7 @@
        stat(ourname, &buf) < 0
 #endif
        )
+   {
 
      if (ourname[0] == SLASH_CHAR && ourname[1] == SLASH_CHAR)
        {
@@ -281,9 +282,9 @@
 	       else
 		 return 1;
 	    }
-	  return 0;
        }
-
+      return 0;
+   }
    *mode = buf.st_mode & 0777;
 
    if (buf.st_mode & S_IFDIR) return (2);
--------

(I have also tried it: I patched a fresh snapshot with this patch and tried
to run wjed, it works).

Can you please try it and tell us if it works? so we can ask John to add
this one.

Hope we have a better luck this time!

thanks,
						Dino


--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2006 date index] [2006 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]