Recent

Author Topic: reading ini files  (Read 6012 times)

JohnvdWaeter

  • Full Member
  • ***
  • Posts: 185
    • http://www.jvdw.nl
reading ini files
« on: May 22, 2011, 05:02:25 pm »
Hi All,
I have this console-program that reads some settings at startup.

Everything works flawlessly on a debian 32 system.

On a debian 64 system, however, sometimes I get this error "unable to open file" when trying to read the settings-file. It is read as an ini-file (TInifile.Create(filename).

In the finalization section of the program the ini-file is written back, preserving current settings. Again all ok on debian 32, and sometimes (not always) "unable to open file" on debian 64.

Al paths are the same, all privileges are the same.

Anyone any ideas?

John


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12025
  • FPC developer.
Re: reading ini files
« Reply #1 on: May 22, 2011, 06:36:48 pm »
Easiest is to use strace to see what actually goes wrong.

And don't assume it is an 32/64-bit issue till you actually know that it is that.

Two different installations of Debian can differe in more ways than just architecture

JohnvdWaeter

  • Full Member
  • ***
  • Posts: 185
    • http://www.jvdw.nl
Re: reading ini files
« Reply #2 on: May 22, 2011, 07:33:10 pm »
Hi Marco,

Hmm, started via strace, it works flawlessly... strated direct from commandline (as root), it gives the error... repeated this several times. I guess I have to dig a little deeper...

John

JohnvdWaeter

  • Full Member
  • ***
  • Posts: 185
    • http://www.jvdw.nl
Re: reading ini files
« Reply #3 on: May 22, 2011, 10:03:33 pm »
When using strace, everything worked fine. I guess the only difference is that through strace, the program is just a bit slower.

So I tried to slow down the program by putting a sleep(1000) just before the TInifile.create() and now everything works just fine!  I guess something that is needed in the chain of the TInifile  just didn't have time enough to initialize.

 

TinyPortal © 2005-2018