Error reading files after runtime update from 4.0.0.0 to 4.8.0.0

2023-05-10
2024-05-07
  • hence.persson - 2023-05-10

    Working code: ~~~
    OpenFile := SysFileOpen(szFile:=BMS_GVLconstants.SystemFilePath, am:=.Sysfile.AM_READ, pResult:=ADR(udiOpenError));
    ~~~
    Doesnt work anymore the OpenFile has the value 16#FFFFFFFF and pResult = 39

    In desperation I also tried the CAA_FILE lib to read the file and that returns the error FILE_OPERATION_DENIED.

    As everything worked before, the files are present and the permissions are the same I blame codesys..
    I even tried to change the file permissions to 777 and change the user and group to no avail.
    Hopefully someone can point me in the correct direction.

    Earlier I used Codesys 3.5.16.30 for enginnering and 4.0.0.0 as runtime
    Now I use Codesys 3.5.19.0 for engineering and 4.8.0.0 as runtime and all devices and librarys updated to latest versions.

     
  • hence.persson - 2023-05-10

    Checked the log and nothing there regarding reading my file but the following messages were availible.. Something about sysfile... Maybe helps...?

     
  • hence.persson - 2023-05-11

    After much digging I found the following (Attachement)
    So can i change it in the user.cfg file ? And what should the section in that case in the cfg file be named?

     
  • ajadhav

    ajadhav - 2023-05-15

    I also had noticed the same problem.Infact the file access with SysFileOpen was working till CODESYS Control for Raspberry Pi MC SL V 4.6.0.0

    Manual editing of user.cfg file wouldnt be a desirable method especially for Codesys IO libary packages which need some specific file access in some working directory in linux.

     
  • leandroct - 2024-05-07

    Since version 19 they changed how file access is handle.
    There are two solutions:
    1. You change where the file is stored (need to go to: /PlcLogic/)
    2. You can, if you don´t want to store at PlcLogic, add the following line in the CODESYSControl.cfg under [SysFile]: ForceIecFilePath=0
    The CodesysControl.cfg is at C:\ProgramData\CODESYS\CODESYSControlWinV3x64\xxPROJECT_NUMBERxx\

    Here the email they sent me:

    "with the 3.5.19 Version we changed how files are handled.
    See following issue: CDS-81506 - CODESYS Control SysFile system file access vulnerability.
    There are two solutions:
    1. You change where the file is stored (need to go to: /PlcLogic/)
    2. You can, if you don´t want to store at PlcLogic, add the following line in the CODESYSControl.cfg under [SysFile]: ForceIecFilePath=0
    Here is the official release-note:
    [[COMPATIBILITY_INFORMATION]]
    With the activation of ForceIecFilePath the file access from IEC is now restricted to the configured paths only (file sandbox)!
    [SysFile]
    ForceIecFilePath=1 (new default)
    The standard path is the current directory, the PlcLogic subfolder or a configured path. Every file access outside of this path is configured via PlaceholderFilePath, for example access to temporary files or removable media:
    [SysFile]
    PlaceholderFilePath.1=/tmp, $TMP$
    PlaceholderFilePath.2=/media/usb, $USB$
    PlaceholderFilePath.2.Volatile=1
    For more information see our tutorial FilePath & Placeholders.
    To restore the old behavior ForceIecFilePath may be configured as follows:
    [SysFile]
    ForceIecFilePath=0
    BUT WE HIGHLY RECOMMEND TO LEAVE THIS SETTING AT ITS NEW DEFAULT VALUE!
    "

     

    Last edit: leandroct 2024-05-07

Log in to post a comment.