nasa / FM

The Core Flight System (cFS) File Manager (FM) application.
Apache License 2.0
42 stars 24 forks source link

Dirlist Malformed with Symbols #116

Closed PlanetB-rgb closed 5 months ago

PlanetB-rgb commented 6 months ago

Checklist (Please check before submitting)

Describe the bug There are symbols being inserted into the a dirlist resultant file. I found this issue https://github.com/nasa/FM/issues/14 however, looks like the problem still persists. Wondering if I am doing something wrong with the command.

To Reproduce Steps to reproduce the behavior:

  1. build native make SIMULATION=native prep; make; make install; cd build/exe/cpu1/
  2. Run ./core-cpu1
  3. send dirlist command ./cmdUtil --pktid=0x188c --cmdcode=14 --endian=LE --string=64:/cf --string=64:/cf/dirlist.txt --uint8=0 --uint8=0 --uint8=0 --uint8=0
  4. See image

Expected behavior I have results for this in two ways: cat and gedit:

  1. Linux cat command you can see there is no spacing (making it unreadable, and possibly unparsable) and symbols in front:

    cat dirlist.txt 
    cFE109@B
    to_lab.sodirlist.txtcfe_es_startup.scrci_lab.soto_lab_sub.tblsample_lib.sosch_lab_table.tblsample_app.sofm_monitor.tblsample_app_tbl.tblcfe_assert.sosch_lab.sofm.so
  2. gedit image

Code snips If applicable, add references to the software.

System observed on:

Additional context Add any other context about the problem here.

Reporter Info Charles A. Taylor NASA JSC ER6

PlanetB-rgb commented 5 months ago

These files are written in binary need to be parsed. As per user guide FMs "CFS File Manager Operations" which reads:

_The directory listing file is written as a binary file and contains a cFE file header at the top of the file contiguously followed by a directory listing status data structure containing an echo of the command specified directory name (OSMAX - PATH_LEN), directory size in bytes (uint32), total number of file contained in the directory (uint32), and the number of file names written in the directory listing file (uint32). The directory listing is then written contiguously one entry at a time. Each entry in the directory listing includes for each file in the directory, the name of the file(OS_MAX_PATH_LEN), file size in bytes (uint32), and last modification time of the file (uint32). File systems use specific time epochs for their time tagging of files. Since spacecraft systems rarely use an epoch that matches a particular file system, a function is used to convert the file system time (in seconds) to spacecraft time (in seconds). The conversion is controlled by a cFE configuration parameter which is set equal to the number of seconds between the spacecraft's epoch and the file system's epoch. See CFE_FS_Header_t for the cFE file header format. See /FM_DirListFileStat_t for the format of the directory listing status structure. See /FM_DirListFileDatat for the format of a directory listing entry.