Author Topic: "Recursion too deep" in fileman.ex  (Read 2696 times)

nelsonhf

  • Community Member
  • Posts: 47
  • Hero Points: 2
"Recursion too deep" in fileman.ex
« on: October 17, 2012, 04:55:25 pm »
Recently, I have been receiving the following stack trace:
====
 Slick-C STACK TRACE ******************************
 Created on 10/17/2012 at 11:33:43 (344 ms)
 SlickEdit Version 17.0.2.0 Copyright 1988-2012 SlickEdit Inc.
 Edit module and type "st -f <offset>" to get the
 run-time error position

 error code=-3010
 Recursion too deep

stdprocs.ex 3162 _Substr(C:\temp\%SLICKEDITCONFIG%,2,1)   p_window_id: 5   p_object: OI_FORM   p_name:
stdprocs.ex 3162 _Substr(C:\temp\%SLICKEDITCONFIG%,2,1)   p_window_id: 5   p_object: OI_FORM   p_name:
stdprocs.ex 2481 isdrive(C:\temp\%SLICKEDITCONFIG%)   p_window_id: 5   p_object: OI_FORM   p_name:
stdprocs.ex 1945 isdirectory(C:\temp\%SLICKEDITCONFIG%,)   p_window_id: 5   p_object: OI_FORM   p_name:
fileman.ex 1555 make_path(%SLICKEDITCONFIG%,1)   p_window_id: 5   p_object: OI_FORM   p_name:
fileman.ex 1567 make_path(%SLICKEDITCONFIG%,1)   p_window_id: 5   p_object: OI_FORM   p_name:
[691 repetitions of the line above]
fileman.ex 1567 make_path(%SLICKEDITCONFIG%\autosave,0)   p_window_id: 5   p_object: OI_FORM   p_name:
autosave.ex 1689 autosave:aswrite_file()   p_window_id: 5   p_object: OI_FORM   p_name:
autosave.ex 1005 _as_callback()   p_window_id: 5   p_object: OI_FORM   p_name:
 Slick-C STACK TRACE ******************************
 Created on 10/17/2012 at 11:33:43 (254 ms)
 SlickEdit Version 17.0.2.0 Copyright 1988-2012 SlickEdit Inc.
 Edit module and type "st -f <offset>" to get the
 run-time error position

 error code=-3010
 Recursion too deep
====
Relevant (?) environment variables are:
SLICKEDITCONFIG=C:\Users\nelson.ferrari\Documents\My SlickEdit Config\
SLICKEDITCONFIGVERSION=C:\Users\nelson.ferrari\Documents\My SlickEdit Config\17.0.2\
====
After that, if SlickEdit window has the focus, ALT-TAB will not work.

Any suggestion on how to fix it?

Thanks
« Last Edit: October 17, 2012, 09:20:15 pm by nelsonhf »

Graeme

  • Senior Community Member
  • Posts: 2379
  • Hero Points: 314
Re: "Recursion too deep" in fileman.ex
« Reply #1 on: October 18, 2012, 11:00:18 am »
Can you suggest how to reproduce the problem and how often it happens?

You could try this
  • Close slickedit and backup your entire configuration folder.
  • Delete vslick.sta from your configuration folder.
  • Run slickedit and see if the problem is gone.

nelsonhf

  • Community Member
  • Posts: 47
  • Hero Points: 2
Re: "Recursion too deep" in fileman.ex
« Reply #2 on: October 18, 2012, 08:05:21 pm »
I really don't know how often it happens or how to trigger (reproduce) it.

I thought it had something to do with auto-save (maybe) or auto-backup (don't think so anymore), but I cannot be sure. It seems to only happens if one of the buffer is modified but it doesn't show up immediately after the file is manually saved or saved because the editor lost focus (I have this setting on).

Let me try your suggestion and see if the error shows up again. I'll post an update immediately after it happens or early next week, if it doesn't (give it a couple of days).

Thanks for the help.

nelsonhf

  • Community Member
  • Posts: 47
  • Hero Points: 2
Re: "Recursion too deep" in fileman.ex
« Reply #3 on: April 11, 2013, 08:53:35 pm »
I think I found what the problem is: autosave tries to save to "_ConfigPath()":+'autosave'+FILESEP, which expands to %SLICKEDITCONFIG%\autosave (as you can see in the last line with fileman.ex, in the log).

%SLICKEDITCONFIG% should be further expanded to something like c:\slickedit\config, but it is not. Because create_path() can neither create a directory with this name nor simplify it further, it is stuck in an infinite recursive loop and crashes.

Can someone tell me how to expand an environment variable or fix one of _ConfigPath(), _as_directory(), or make_path()?

Thanks

nelsonhf

  • Community Member
  • Posts: 47
  • Hero Points: 2
Re: "Recursion too deep" in fileman.ex
« Reply #4 on: April 18, 2013, 12:11:00 am »
 ;D
I solved the problem. Somehow, my variable def_as_directory got corrupted and was set to %SLICKEDITCONFIG%/autosave. SlickEdit was trying to create this directory under Program Files and, of course, failing!

I recommend the following change to autosave.e:
===
static _str _as_directory()
{
   if (def_as_directory=='') {
/* Following line is the change */
      def_as_directory = _ConfigPath():+'autosave':+FILESEP;
   }
   return(def_as_directory);
}
===
This will set def_as_directory to the correct value, if not set yet (may have been done elsewhere, I don't know...)

And adding the following block to fileman.e:

===
int make_path(_str path, typeless doShellMessages='')
{
   //Second argument is not documented and is intended for fileman mode.
   boolean shell_messages= doShellMessages!='';
   if ( last_char(path)==FILESEP ) {
      /* Remove ending FILESEP */
      path=substr(path,1,length(path)-1);
   }
   typeless status=0;
   _str prevpath=substr(path,1,pathlen(path)-1);
/* Change starts */
   if(prevpath==path) {
      _message_box(nls("Infinite recursion detected making path '%s'", path));
      return ERROR_CREATING_DIRECTORY_RC;
   }
/* Change ends */
   if ( length(prevpath)>2 ) {
     /* if previous directory doesn't exist make it first */
     /* else return */
     if ( ! isdirectory(prevpath) ) {
       status= make_path(prevpath,shell_messages);
       if ( status ) { return(status); }
     }
   }
   /* make this directory */
   if ( shell_messages ) {
      if ( _iswindow_valid(_shell_wid)) {
         _shell_wid.list1.insert_line('mkdir 'path);
         _shell_wid.list1.refresh();
      }
   }
   status=mkdir(path);
   return(status);
}
===

If something goes horribly wrong (like it did for me...) and SlickEdit gets stuck, it will kinda gracefully recover.

Hope this is completely useless to everyone, because if it is useful to you, you are probably extremely annoyed! :-)