NO

Author Topic: poinst fails on large number of files  (Read 3504 times)

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
poinst fails on large number of files
« on: July 22, 2018, 03:21:38 PM »
Hello Pelle,
Poinst fails with all commands involving multiple files as 'Files' or 'Delete'.
When the files bundle is greater that 478 units Poinst blows-up.  :o
Took me a while to understand where the problem is, but at the end I got it.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: poinst fails on large number of files
« Reply #1 on: July 23, 2018, 06:15:37 PM »
Sorry, but I really don't understand. Can you give me more info?
/Pelle

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: poinst fails on large number of files
« Reply #2 on: July 24, 2018, 12:01:14 PM »
Hi Pelle,
in a statement like:
Code: [Select]
File *.*

; or

Delete *.*
when the number of files is more than 478 the poinst crashes.

Some more details. Consider the snippet to clean include directory after installing fSDK:
Code: [Select]
Section Uninstall
    ...
    ; removefiles
Delete "$INSTDIR\fSDK.txt"
MessageBox MB_YESNO|MB_ICONQUESTION "Remove all headers ?" IDNO dontdeleteheaders
;Delete "$INSTDIR\Include\Win\*.*"
!Include "DeleteHeaders.pis"
dontdeleteheaders:
     ...
The file DeleteHeaders.pis, attached, contains the list of more than 1300 files from fSDK. Commenting out the Delete statement from 478th file on make poinst work. Uncomment even one more file and it crashes.
« Last Edit: July 24, 2018, 12:19:36 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: poinst fails on large number of files
« Reply #3 on: July 24, 2018, 04:11:37 PM »
Code: [Select]
File *.*
This will collect files into the setup. The biggest test I can find right now is 556 files, which works fine here.

Code: [Select]
Delete *.*
This will just remember the search pattern in the setup, the files are removed during runtime (by Windows API).

Two completely different operations stuck on 478? There must be more to this story than this...

Shot in the dark, but have you checked your disk for faults? Memory?
/Pelle

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: poinst fails on large number of files
« Reply #4 on: July 24, 2018, 06:51:38 PM »
A small test:
Code: [Select]
Name "Example3"
OutFile "test1.exe"
InstallDir Test1\Include
DirText "This will install Test1 on your computer. Choose a folder:"
Section "InstallDirTest1"
    SetOutPath $INSTDIR
    File "Include\*.*"
SectionEnd
UninstallText "Uninstall"
UninstallExeName "test1_uninst.exe"
Section Uninstall
!Include "Delete1.pis"
SectionEnd
To generate test files:
Code: [Select]
#include <stdio.h>
#include <direct.h>
int __cdecl main(void)
{
FILE *f1, *f2;
char name[50];
_mkdir("Include");
f1 = fopen("Delete1.pis", "w");
for (int i=0; i<1000; i++) {
sprintf(name, "Include/file%d.h", i);
f2 = fopen(name, "w");
if (f2) fclose(f2);
int len = sprintf(name, "Delete Include\\file%d.h\n", i);
fwrite(name, len, 1, f1);
}
if (f1) fclose(f1);
return 0;
}
poinst.exe crash with value over 915.
May the source be with you

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: poinst fails on large number of files
« Reply #5 on: July 25, 2018, 11:45:21 AM »
Pelle my disk is OK, but anyway the old V8.00 poinst works well with same installer script.
Seems a typical memory corruption problem. If the number of files before crash is not constant maybe the problem is in dynamic memory allocation of files array?
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide