Menu

#185 Logging - Change CreateDirectory logging to show recursion

closed-accepted
NSIS (71)
5
2008-06-13
2008-06-12
Sheiker
No

Yet another LOGGING patch.

This patch changes how the logging is done when we Create Directories.

We currently output the line once, with the FULl directory path, without showing that we might have had to recurse a few times to build the full directory.

This makes things more difficult for Uninstallers that parse the install.log file to "reverse" the install process.

So this patch outputs a Create Directory line, per REAL directory creation that we actually do.
This will give us a log of each recursive Directory we had to build.

For example.
Instead of just getting this line, in which we have no idea how many, if any of the subdirectories we actually built:

CreateDirectory: "C:\cygwin420\lib\perl5\site_perl\5.8.2\cygwin-thread-multi-64int\auto\Archive\Tar" (0)

We now will get this instead, which I believe is much more helpful:

CreateDirectory: "C:\cygwin420\lib" (0)
CreateDirectory: "C:\cygwin420\lib\perl5" (0)
CreateDirectory: "C:\cygwin420\lib\perl5\site_perl" (0)
CreateDirectory: "C:\cygwin420\lib\perl5\site_perl\5.8.2" (0)
CreateDirectory: "C:\cygwin420\lib\perl5\site_perl\5.8.2\cygwin-thread-multi-64int" (0)
CreateDirectory: "C:\cygwin420\lib\perl5\site_perl\5.8.2\cygwin-thread-multi-64int\auto" (0)
CreateDirectory: "C:\cygwin420\lib\perl5\site_perl\5.8.2\cygwin-thread-multi-64int\auto\Archive" (0)
CreateDirectory: "C:\cygwin420\lib\perl5\site_perl\5.8.2\cygwin-thread-multi-64int\auto\Archive\Tar" (0)

The patch is very trivial:

cvs diff -u -- exec.c (in directory C:\NSISsrc\NSIS\Source\exehead\)
Index: exec.c
===================================================================
RCS file: /cvsroot/nsis/NSIS/Source/exehead/exec.c,v
retrieving revision 1.199
diff -u -r1.199 exec.c
--- exec.c 8 Sep 2007 17:20:10 -0000 1.199
+++ exec.c 12 Jun 2008 19:07:12 -0000
@@ -314,7 +335,6 @@
break;
case EW_CREATEDIR: {
char *buf1=GetStringFromParm(-0x10);
- log_printf3("CreateDirectory: \"%s\" (%d)",buf1,parm1);
{
char *p = skip_root(buf1);
char c = 'c';
@@ -338,6 +358,10 @@
exec_error++;
}
}
+ else
+ {
+ log_printf3("CreateDirectory: \"%s\" (%d)",buf1,parm1);
+ }
*p++ = c;
}
}

Discussion

  • Amir Szekely

    Amir Szekely - 2008-06-13

    Logged In: YES
    user_id=584402
    Originator: NO

    Applied, but for clarity of the log and for the uninstaller. You shouldn't use install.log for the uninstaller, it wasn't designed for that and its backward compatibility is not assured.

     
  • Amir Szekely

    Amir Szekely - 2008-06-13
    • status: open --> closed-accepted
     

Log in to post a comment.