Recent

Author Topic: daemonapp.pp makes assumptions about location of temp directory  (Read 887 times)

dsiders

  • Hero Member
  • *****
  • Posts: 1080
daemonapp.pp makes assumptions about location of temp directory
« on: October 01, 2019, 07:37:56 pm »
I just noticed after an update on svn that fcl-extra/src/daemonapp uses hard-coded paths for the service debugging log file. For Windows, it assumes C: and writes to the root directory (which is a no-no in my book). For all others, it assumes '/tmp'.

Shouldn't StartLog use GetTempDir (SysUtils is already in the uses clause)?

Like...

Code: Pascal  [Select][+][-]
  1. Assign(FL, IncludeTrailingPathDelimiter(GetTempDir) + 'service.log');
  2.  

Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: daemonapp.pp makes assumptions about location of temp directory
« Reply #1 on: October 02, 2019, 12:12:25 am »
well if it is indeed doing hard coding directly to the root then why not report it?
The only true wisdom is knowing you know nothing

PascalDragon

  • Hero Member
  • *****
  • Posts: 5481
  • Compiler Developer
Re: daemonapp.pp makes assumptions about location of temp directory
« Reply #2 on: October 02, 2019, 09:21:07 am »
I just noticed after an update on svn that fcl-extra/src/daemonapp uses hard-coded paths for the service debugging log file. For Windows, it assumes C: and writes to the root directory (which is a no-no in my book). For all others, it assumes '/tmp'.

Shouldn't StartLog use GetTempDir (SysUtils is already in the uses clause)?

Like...

Code: Pascal  [Select][+][-]
  1. Assign(FL, IncludeTrailingPathDelimiter(GetTempDir) + 'service.log');
  2.  

This log is part of the functionality to debug the daemonapp unit itself. As you can see the functionality is only enabled if svcdebug is defined which is not the case by default. Thus the functionality should only be used when working on daemonapp itself and thus on a development machine anyway.

 

TinyPortal © 2005-2018