Possible bug with `fileinfo` command in SBC mode
-
I'm working on a git-like interface to pull/push/sync files between Duet and a local folder - everything worked well on DWC 3.1 but I'm running into a weird issue on 3.2 and 3.3 when trying to query the file info for non-gcode files.
For example:
http://<printer_ip>/machine/fileinfo/sys/heightmap.csv
Results in:
CodeParserException in GetFileInfo: Failed to parse major M-code number (ap) in line 1
Now, I realize that heightmap.csv was moved in later RRF and this file isn't used anymore but I see no reason why it should give a gcode parse error when trying to query the file info.
This also happens with filaments.csv and I tested with files with other names - it seems something specific to the content of filaments/heightmap.csv as it only seemed to fail if I copied those contents into the test files... such as:
RepRapFirmware height map file v2 generated at 2021-07-13 16:12 xmin,xmax,ymin,ymax,radius,xspacing,yspacing,xnum,ynum 30.00,280.00,66.00,300.00,-1.00,125.00,117.00,3,3 -0.005, 0.099, -0.035 -0.051, 0.061, -0.029 -0.057, 0.046, -0.030
But still - see no reason why it would care what the file contents is. I assume it's trying to parse the layer information (since that shows up in the normal output) but could it not ignore this if the file isn't a .g/.gcode file at least?
I can work around it for now by just deleting those files as they aren't needed anymore - but that's a weird thing to tell users of the tool I'm writing and I'll probably also have to code around it.
-
I’ll need to double check but what I remember offhand is the fileinfo call is designed to parse the gcode contents to get info such as size, layer height, etc. you’re making a call that is trying to fetch gcode metadata essentially so the error makes sense.
-
@adammhaile I edited the title of your post to make is clear that this only affects SBC mode. I will alert @chrishamm.
-
@adammhaile Not really helping you current issue but have you considered other ways to do this rather than going through http? I'm basically backup all my printers "sd card" files with a simple rsync script. Since the SBC is gateway to a UNIX file-system why not use it?
I set up the ssh key from my fileserver to the printers and run a job through cron. My stuff all dumps onto a ZFS volume on my fileserver so I even get version control since snapshots are turned on for that filesystem.
I'm sure there are a ton of utilities you could use to do the same thing with Windows (powershell could do 90% of it alone I think). And MacOS is of course just wrapped up pretty UNIX tools... so no issues there.
-
@adammhaile fileinfo calls are not meant to be used for non-Gcode files. To get the size, change date etc. it's better to use directory queries.
I'll check again what RRF does when non-Gcode files are queried and adjust the DSF response if necessary.
-
I can confirm RRF only parses filenames ending with
.gcode
,.g
,.gco
, and.gc
. I'll change DSF to do the same. -
@chrishamm we should probably include .nc files too.
-
@dc42 Yes, good idea.