fpdoc does not exit correctly after an error
Original Reporter info from Mantis: mazen
-
Reporter name: Abou Al Montacir
Original Reporter info from Mantis: mazen
- Reporter name: Abou Al Montacir
Description:
The issue was identified when trying to debug Debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=939414.
The reason of that bug is that fpdoc fails silently and does not return a non zero exit code.
Steps to reproduce:
enter fpcdocs repository after building fpdoc with DEBUG=1 and run the following command (note the use of gdb):
gdb --args ../fpcsrc/utils/fpdoc/bin/x86_64-linux/fpdoc --macro=FPCDIR=../fpcsrc --macro=FPCDIR=../fpcsrc --package=fcl-res --warn-no-node --content=fclres.xct --import=fcl.xct --import=rtl.xct,../rtl/ --input=../fpcsrc/packages/fcl-res/src/resource.pp --descr=../fpcsrc/packages/fcl-res/xml/resource.xml --input=../fpcsrc/packages/fcl-res/src/resourcetree.pp --descr=../fpcsrc/packages/fcl-res/xml/resourcetree.xml --input=../fpcsrc/packages/fcl-res/src/resdatastream.pp --descr=../fpcsrc/packages/fcl-res/xml/resdatastream.xml --input=../fpcsrc/packages/fcl-res/src/resfactory.pp --descr=../fpcsrc/packages/fcl-res/xml/resfactory.xml --input=../fpcsrc/packages/fcl-res/src/resreader.pp --descr=../fpcsrc/packages/fcl-res/xml/resreader.xml --input=../fpcsrc/packages/fcl-res/src/reswriter.pp --descr=../fpcsrc/packages/fcl-res/xml/reswriter.xml --input=../fpcsrc/packages/fcl-res/src/bitmapresource.pp --descr=../fpcsrc/packages/fcl-res/xml/bitmapresource.xml --input=../fpcsrc/packages/fcl-res/src/acceleratorsresource.pp --descr=../fpcsrc/packages/fcl-res/xml/acceleratorsresource.xml --input=../fpcsrc/packages/fcl-res/src/groupresource.pp --descr=../fpcsrc/packages/fcl-res/xml/groupresource.xml --input=../fpcsrc/packages/fcl-res/src/groupiconresource.pp --descr=../fpcsrc/packages/fcl-res/xml/groupiconresource.xml --input=../fpcsrc/packages/fcl-res/src/groupcursorresource.pp --descr=../fpcsrc/packages/fcl-res/xml/groupcursorresource.xml --input=../fpcsrc/packages/fcl-res/src/stringtableresource.pp --descr=../fpcsrc/packages/fcl-res/xml/stringtableresource.xml --input=../fpcsrc/packages/fcl-res/src/versionconsts.pp --descr=../fpcsrc/packages/fcl-res/xml/versionconsts.xml --input=../fpcsrc/packages/fcl-res/src/versiontypes.pp --descr=../fpcsrc/packages/fcl-res/xml/versiontypes.xml --input=../fpcsrc/packages/fcl-res/src/versionresource.pp --descr=../fpcsrc/packages/fcl-res/xml/versionresource.xml --input=../fpcsrc/packages/fcl-res/src/cofftypes.pp --descr=../fpcsrc/packages/fcl-res/xml/cofftypes.xml --input=../fpcsrc/packages/fcl-res/src/coffreader.pp --descr=../fpcsrc/packages/fcl-res/xml/coffreader.xml --input=../fpcsrc/packages/fcl-res/src/coffwriter.pp --descr=../fpcsrc/packages/fcl-res/xml/coffwriter.xml --input=../fpcsrc/packages/fcl-res/src/winpeimagereader.pp --descr=../fpcsrc/packages/fcl-res/xml/winpeimagereader.xml --input=../fpcsrc/packages/fcl-res/src/elfconsts.pp --descr=../fpcsrc/packages/fcl-res/xml/elfconsts.xml --input=../fpcsrc/packages/fcl-res/src/elfreader.pp --descr=../fpcsrc/packages/fcl-res/xml/elfreader.xml --input=../fpcsrc/packages/fcl-res/src/elfwriter.pp --descr=../fpcsrc/packages/fcl-res/xml/elfwriter.xml --input=../fpcsrc/packages/fcl-res/src/machotypes.pp --descr=../fpcsrc/packages/fcl-res/xml/machotypes.xml --input=../fpcsrc/packages/fcl-res/src/machoreader.pp --descr=../fpcsrc/packages/fcl-res/xml/machoreader.xml --input=../fpcsrc/packages/fcl-res/src/machowriter.pp --descr=../fpcsrc/packages/fcl-res/xml/machowriter.xml --input=../fpcsrc/packages/fcl-res/src/externaltypes.pp --descr=../fpcsrc/packages/fcl-res/xml/externaltypes.xml --input=../fpcsrc/packages/fcl-res/src/externalreader.pp --descr=../fpcsrc/packages/fcl-res/xml/externalreader.xml --input=../fpcsrc/packages/fcl-res/src/externalwriter.pp --descr=../fpcsrc/packages/fcl-res/xml/externalwriter.xml --input=../fpcsrc/packages/fcl-res/src/dfmreader.pp --descr=../fpcsrc/packages/fcl-res/xml/dfmreader.xml --format=html --output=fclres
(gdb) r
(gdb) b fcl-base/src/custapp.pp:345
(gdb) n # run this multiuple times until it exists
Additional information:
There seem wrong exit code handling in doRun method. indeed we can see at fpdoc.pp:413 the following code:
Procedure TFPDocApplication.DoRun;
begin
try
...
except
ExitCode:=1;
Raise;
end;
end;
However inside the Run method there is also a catch of the exception without reraising it (fcl-base/src/custapp.pp:345):
procedure TCustomApplication.Run;
begin
Repeat
Try
DoRun;
except
HandleException(Self);
end;
Until FTerminated;
end;
So we never go in the line 413 of fpdoc.pp
Mantis conversion info:
- Mantis ID: 36347
- OS: Debian GNU/Linux
- OS Build: Stretch
- Build: 3.0.4+dfsg-22
- Platform: x86_64
- Version: 3.0.4
- Fixed in version: 3.3.1
- Fixed in revision: 43563 (#77103fe7)
- Monitored by: » mazen (Abou Al Montacir)
- Target version: 3.2.0