• Pascal with Mystic Logs

    From Black Panther@21:1/186 to All on Mon Jul 9 11:50:16 2018
    Hi All,

    I was just wondering something, as I've run into a slight bump-in-the-road in one of my programs.

    What I'm doing, is reading the Mystic log files to obtain information for various reports. On my Windows system, which is running fsxNet hub 4, I've noticed that I'm getting errors while trying to read the mis.log file. The program is unable to open the file based on permissions...

    snip<=-

    Project rcsnodepoll raised exception class 'RunError(5)'

    In file 'rcsnodepoll.pas' at line 174:
    reset(fmislog);

    snip<=-

    Then I'll get:

    snip<=-

    Project rcsnodepoll raised exception class 'EInOutError' with message:
    Access denied

    In file 'rcsnodepoll.pas' at line 174:
    reset(fmislog);

    snip<=-

    When run from a command line, I'm getting: 'File handling error occurred. Details: Access denied'.

    My question, does Windows handle file permissions differently than Linux? I
    can run this all day long on the Linux system with no problems. It just when
    I try on the Windows system that I start having issues.

    Here is also a snippet of the code that includes line 174:

    snip<=-

    If FileExists(MysticLogs+'mis.log) then
    Begin
    Try
    AssignFile(fmislog,MysticLogs+'mis.log');
    reset(fmislog); //This is line 174
    except
    On E: EInOutError do begin
    writeln('File handling error occurred. Details: ',E.Message);
    ProgramHalt;
    end;
    end;
    end
    else
    begin
    writeln('mis.log not found. Exiting...');
    ProgramHalt;
    end;

    snip<=-

    Any help would be greatly appreciated.


    ---

    Black Panther
    a.k.a. Dan Richter
    Sysop - Castle Rock BBS (RCS)
    telnet://bbs.castlerockbbs.com
    http://www.castlerockbbs.com
    The sparrows are flying again....

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From Avon@21:1/101 to Black Panther on Tue Jul 10 21:08:57 2018
    On 07/09/18, Black Panther pondered and said...

    My question, does Windows handle file permissions differently than
    Linux? I can run this all day long on the Linux system with no problems.

    I suspect yes as often I can see the file seems locked on my Windows system until I close MIS ... and at times when there has been a crash I note it can remain locked. Or at least that's the memory I have of this..

    --- Mystic BBS v1.12 A39 2018/04/21 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From Black Panther@21:1/186 to Avon on Tue Jul 10 16:33:55 2018
    On 07/10/18, Avon said the following...

    My question, does Windows handle file permissions differently than Linux? I can run this all day long on the Linux system with no proble

    I suspect yes as often I can see the file seems locked on my Windows system until I close MIS ... and at times when there has been a crash I note it can remain locked. Or at least that's the memory I have of this..

    That's what's giving me problems with my programs on Windows systems. I need
    to find a way to at least copy it, so that I can analyze the log files...
    I'll figure this out somehow... :)


    ---

    Black Panther
    a.k.a. Dan Richter
    Sysop - Castle Rock BBS (RCS)
    telnet://bbs.castlerockbbs.com
    http://www.castlerockbbs.com
    The sparrows are flying again....

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From Avon@21:1/101 to Black Panther on Wed Jul 11 11:18:28 2018
    On 07/10/18, Black Panther pondered and said...

    That's what's giving me problems with my programs on Windows systems. I need to find a way to at least copy it, so that I can analyze the log files... I'll figure this out somehow... :)

    I'll do some tests to see if I can suss anything on my windows box and keep
    you posted.

    --- Mystic BBS v1.12 A39 2018/04/21 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From xqtr@21:1/111 to Black Panther on Wed Jul 11 10:57:02 2018
    If you copy and edit the new file, you should'not have any problem.If you do, then the problem is somewhere else.

    Also try to use TFileStream and open the file with share no deny access. May
    be Reset needs exclusive rights to open the file... not sure for that.

    .----- --- -- -
    | Another Droid BBS
    : Telnet : andr01d.zapto.org:9999 [UTC 11:00 - 20:00]
    . Contact : xqtr@gmx.com

    --- Mystic BBS v1.12 A39 2018/04/21 (Raspberry Pi/32)
    * Origin: Another Droid BBS (21:1/111)
  • From Black Panther@21:1/186 to xqtr on Wed Jul 11 20:38:12 2018
    On 07/11/18, xqtr said the following...

    If you copy and edit the new file, you should'not have any problem.If
    you do, then the problem is somewhere else.

    It will work just fine with a copy of the file. I can even run 'copy mis.log mis.rcs' from a command line, with no problems.

    Also try to use TFileStream and open the file with share no deny access. May be Reset needs exclusive rights to open the file... not sure for
    that.

    I tried it with 'fmOpenDenyWrite' and also 'fmOpenRead', but neither of them worked on the Windows system. It copies it just fine under Linux...

    I'm wondering if I should try to run an external command, such as 'copy
    mis.log mis.rcs' if Windows is the OS...

    Time to run some more tests...


    ---

    Black Panther
    a.k.a. Dan Richter
    Sysop - Castle Rock BBS (RCS)
    telnet://bbs.castlerockbbs.com
    http://www.castlerockbbs.com
    The sparrows are flying again....

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From Vk3jed@21:1/109 to Avon on Thu Jul 12 18:18:00 2018
    On 07-10-18 21:08, Avon wrote to Black Panther <=-

    My question, does Windows handle file permissions differently than
    Linux? I can run this all day long on the Linux system with no problems.

    I suspect yes as often I can see the file seems locked on my Windows system until I close MIS ... and at times when there has been a crash I note it can remain locked. Or at least that's the memory I have of
    this..

    Don't get me started on the evils of Windows file locking. It really can be a pain. Linux is much more elegant and fine grained.


    ... Flashlight: A case for holding dead batteries.
    === MultiMail/Win v0.51
    --- SBBSecho 3.03-Linux
    * Origin: Freeway BBS Bendigo,Australia freeway.apana.org.au (21:1/109)
  • From xqtr@21:1/111 to Black Panther on Thu Jul 12 10:49:59 2018
    I tried it with 'fmOpenDenyWrite' and also 'fmOpenRead', but neither of them worked on the Windows system. It copies it just fine under Linux...

    In linux you can't "lock" a file. If you want someone not to have access to that file, you alter the permissions. So locking a file in linux is not like
    in Windows.

    In Windows, from what i remember from the XP era, you could lock a file and while it was open, no one else could read/write to it.

    Because you are tampering with a log file, which is always been updated by the server/mis, i think that coping the file and editing the new file, is the best solution.

    .----- --- -- -
    | Another Droid BBS
    : Telnet : andr01d.zapto.org:9999 [UTC 11:00 - 20:00]
    . Contact : xqtr@gmx.com

    --- Mystic BBS v1.12 A39 2018/04/21 (Raspberry Pi/32)
    * Origin: Another Droid BBS (21:1/111)
  • From Black Panther@21:1/186 to xqtr on Thu Jul 12 17:29:44 2018
    On 07/12/18, xqtr said the following...

    In linux you can't "lock" a file. If you want someone not to have access to that file, you alter the permissions. So locking a file in linux is
    not like in Windows.

    That's why I like Linux... :)

    Because you are tampering with a log file, which is always been updated
    by the server/mis, i think that coping the file and editing the new
    file, is the best solution.

    The problem was trying to get my program to make a copy of the file. I kept getting 'access denied' errors.

    What I ended up doing, is calling 'xcopy' in order to make a copy of it. It's not the best way, but it works... :)


    ---

    Black Panther
    a.k.a. Dan Richter
    Sysop - Castle Rock BBS (RCS)
    telnet://bbs.castlerockbbs.com
    http://www.castlerockbbs.com
    The sparrows are flying again....

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)