View Issue Details

IDProjectCategoryView StatusLast Update
0036737FPCTextmode IDEpublic2021-04-11 19:07
ReporterEvgeniy Shtrenyov Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version3.0.4 
Target Version3.2.2Fixed in Version3.2.2 
Summary0036737: fp.ini line length limit
DescriptionLooks like that FPC 3.0.4 text IDE cannot save/use INI file with line length more or equal than 256 bytes. It makes problem with adding help files using FPC IDE menu: Help -> Files -> New. I'm using official documentation from ftp://ftp.freepascal.org/fpc/dist/3.0.4/docs/doc-chm.zip After adding files and exiting IDE it does save only first 256 bytes of result "Files" string in "Help" section. If total length of help file paths exceeds 256 bytes, it saves configuration incorrectly. Looks like that it use classical 255-bytes strings for INI lines in fpini.pas and wini.pas.

I've tested it on LFS (Linux From Scratch) with self-builded FPC. May be it's bug of my building.
Steps To ReproduceOpen FPC IDE, press "Help" -> "Files", add some help-files with total sum of file lengths >= 0000293:0000256 characters. Close FPC IDE and check fp.ini [Help] section, Files value. Open again FPC IDE, check "Help" -> "Files".
Additional InformationI wrote small "dirty" patch to use separate INI values for help file paths. It does not really solve problem, but it can help if file path length fits in single INI line.
TagsNo tags attached.
Fixed in Revision44248 merged 45690
FPCOldBugId
FPCTarget3.2.2
Attached Files

Activities

Evgeniy Shtrenyov

2020-02-27 09:18

reporter  

fpini.diff (2,055 bytes)   
--- ./fpcbuild-3.0.4/fpcsrc/ide/fpini.pas.orig	2020-02-27 08:56:00.655667262 +0300
+++ ./fpcbuild-3.0.4/fpcsrc/ide/fpini.pas	2020-02-27 10:42:20.929355388 +0300
@@ -117,7 +117,7 @@
   iePrimaryFile      = 'PrimaryFile';
   ieCompileMode      = 'CompileMode';
   iePalette          = 'Palette';
-  ieHelpFiles        = 'Files';
+  ieHelpFile        = 'File';
   ieDefaultTabSize   = 'DefaultTabSize';
   ieDefaultIndentSize = 'DefaultIndentSize';
   ieDefaultEditorFlags='DefaultFlags';
@@ -454,12 +454,11 @@
         SwitchesMode:=ts;
     end;
   { Help }
-  S:=INIFile^.GetEntry(secHelp,ieHelpFiles,'');
+    I:=1;
   repeat
-    P:=Pos(';',S); if P=0 then P:=length(S)+1;
-    PS:=copy(S,1,P-1);
-    if PS<>'' then HelpFiles^.Insert(NewStr(PS));
-    Delete(S,1,P);
+    S:=INIFile^.GetEntry(secHelp,ieHelpFile + IntToStr(I),'');
+    inc(I);
+    if S<>'' then HelpFiles^.Insert(NewStr(S));
   until S='';
   { Editor }
   DefaultTabSize:=INIFile^.GetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
@@ -581,15 +580,9 @@
     S: string;
     S1,S2,S3: string;
     W: word;
-    BreakPointCount,WatchesCount:longint;
+    HelpFileCount, BreakPointCount,WatchesCount:longint;
     I(*,OpenFileCount*): integer;
     OK: boolean;
-
-procedure ConcatName(P: PString);
-begin
-  if (S<>'') then S:=S+';';
-  S:=S+P^;
-end;
 begin
 {$ifdef Unix}
   if not FromSaveAs and (DirOf(IniFileName)=DirOf(SystemIDEDir)) then
@@ -676,9 +669,12 @@
   INIFile^.SetEntry(secCompile,iePrimaryFile,PrimaryFile);
   INIFile^.SetEntry(secCompile,ieCompileMode,SwitchesModeStr[SwitchesMode]);
   { Help }
-  S:='';
-  HelpFiles^.ForEach(@ConcatName);
-  INIFile^.SetEntry(secHelp,ieHelpFiles,EscapeIniText(S));
+  HelpFileCount:=HelpFiles^.Count;
+  for I := 1 to HelpFileCount do
+    begin
+      S:=HelpFiles^.At(I-1)^;
+      INIFile^.SetEntry(secHelp, ieHelpFile + IntToStr(I), EscapeIniText(S));
+    end;
   { Editor }
   INIFile^.SetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   INIFile^.SetIntEntry(secEditor,ieDefaultIndentSize,DefaultIndentSize);
fpini.diff (2,055 bytes)   

Florian

2020-02-27 21:49

administrator   ~0121247

Thanks, I applied it. I think this is the best we can do as the text mode IDE most likely will stay with shortstrings forever.

Evgeniy Shtrenyov

2020-02-28 19:59

reporter   ~0121261

Last edited: 2020-02-28 20:00

View 2 revisions

Because FPC test mode IDE will use shortstrings forever and new "dirty" method for saving help file paths is not compatible with previous, may be it's better to make some compatibility: "patched" version should load help-file names from "FILES" string and should save help-file paths in new format with multiple "FILE" strings. It will solve problem with "loosing" help files while updating FPC text IDE versions, but it will not be downgradable...

Evgeniy Shtrenyov

2020-02-28 20:00

reporter   ~0121262

This is a "dirty" patch with loading help-file names from "FILES"
fpini_compat.diff (2,408 bytes)   
--- fpcbuild-3.0.4/fpcsrc/ide/fpini.pas.orig	2020-02-28 21:27:33.322469552 +0300
+++ fpcbuild-3.0.4/fpcsrc/ide/fpini.pas	2020-02-28 21:38:00.128126601 +0300
@@ -118,6 +118,7 @@
   ieCompileMode      = 'CompileMode';
   iePalette          = 'Palette';
   ieHelpFiles        = 'Files';
+  ieHelpFile        = 'File';
   ieDefaultTabSize   = 'DefaultTabSize';
   ieDefaultIndentSize = 'DefaultIndentSize';
   ieDefaultEditorFlags='DefaultFlags';
@@ -454,6 +455,7 @@
         SwitchesMode:=ts;
     end;
   { Help }
+  { Reading single string with help-file names }
   S:=INIFile^.GetEntry(secHelp,ieHelpFiles,'');
   repeat
     P:=Pos(';',S); if P=0 then P:=length(S)+1;
@@ -461,6 +463,13 @@
     if PS<>'' then HelpFiles^.Insert(NewStr(PS));
     Delete(S,1,P);
   until S='';
+  { Reading separate strings with help-file names }
+  I:=1;
+  repeat
+    S:=INIFile^.GetEntry(secHelp,ieHelpFile + IntToStr(I),'');
+    inc(I);
+    if S<>'' then HelpFiles^.Insert(NewStr(S));
+  until S='';
   { Editor }
   DefaultTabSize:=INIFile^.GetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   DefaultIndentSize:=INIFile^.GetIntEntry(secEditor,ieDefaultIndentSize,DefaultIndentSize);
@@ -581,15 +590,9 @@
     S: string;
     S1,S2,S3: string;
     W: word;
-    BreakPointCount,WatchesCount:longint;
+    HelpFileCount, BreakPointCount,WatchesCount:longint;
     I(*,OpenFileCount*): integer;
     OK: boolean;
-
-procedure ConcatName(P: PString);
-begin
-  if (S<>'') then S:=S+';';
-  S:=S+P^;
-end;
 begin
 {$ifdef Unix}
   if not FromSaveAs and (DirOf(IniFileName)=DirOf(SystemIDEDir)) then
@@ -676,9 +679,16 @@
   INIFile^.SetEntry(secCompile,iePrimaryFile,PrimaryFile);
   INIFile^.SetEntry(secCompile,ieCompileMode,SwitchesModeStr[SwitchesMode]);
   { Help }
-  S:='';
-  HelpFiles^.ForEach(@ConcatName);
-  INIFile^.SetEntry(secHelp,ieHelpFiles,EscapeIniText(S));
+  { Deleting single string with help-files list }
+  INIFile^.DeleteEntry(secHelp, ieHelpFiles);
+  { Saving help-files as separate strings }
+  { Will it produce compatibility problems? }
+  HelpFileCount:=HelpFiles^.Count;
+  for I := 1 to HelpFileCount do
+  begin
+    S:=HelpFiles^.At(I-1)^;
+    INIFile^.SetEntry(secHelp, ieHelpFile + IntToStr(I), EscapeIniText(S));
+  end;
   { Editor }
   INIFile^.SetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   INIFile^.SetIntEntry(secEditor,ieDefaultIndentSize,DefaultIndentSize);
fpini_compat.diff (2,408 bytes)   

Florian

2020-03-02 22:07

administrator   ~0121322

I have applied the second patch, thanks.

Issue History

Date Modified Username Field Change
2020-02-27 09:18 Evgeniy Shtrenyov New Issue
2020-02-27 09:18 Evgeniy Shtrenyov File Added: fpini.diff
2020-02-27 21:49 Florian Assigned To => Florian
2020-02-27 21:49 Florian Status new => resolved
2020-02-27 21:49 Florian Resolution open => fixed
2020-02-27 21:49 Florian Fixed in Revision => 44248
2020-02-27 21:49 Florian FPCTarget => -
2020-02-27 21:49 Florian Note Added: 0121247
2020-02-28 19:59 Evgeniy Shtrenyov Status resolved => feedback
2020-02-28 19:59 Evgeniy Shtrenyov Resolution fixed => reopened
2020-02-28 19:59 Evgeniy Shtrenyov Note Added: 0121261
2020-02-28 20:00 Evgeniy Shtrenyov Note Edited: 0121261 View Revisions
2020-02-28 20:00 Evgeniy Shtrenyov File Added: fpini_compat.diff
2020-02-28 20:00 Evgeniy Shtrenyov Note Added: 0121262
2020-02-28 20:00 Evgeniy Shtrenyov Status feedback => assigned
2020-03-02 22:07 Florian Status assigned => resolved
2020-03-02 22:07 Florian Resolution reopened => fixed
2020-03-02 22:07 Florian Note Added: 0121322
2021-04-11 18:26 Marco van de Voort Fixed in Version => 3.2.2
2021-04-11 18:26 Marco van de Voort Target Version => 3.2.2
2021-04-11 18:26 Marco van de Voort FPCTarget - => 3.2.2
2021-04-11 19:07 Marco van de Voort Fixed in Revision 44248 => 44248 merged 45690