spkenv/spk

JSON Render Stats Causing Shell Errors in TCSH

Closed this issue · 2 comments

In short, we have a process that dumps environment data and then evaluates it, the following line ends up generated in the script:

setenv SPFS_METRICS_RENDER_REPORT '{"already_existed_count":0,"copy_count":0,"copy_link_limit_count":0,"copy_wrong_mode_count":0,"copy_wrong_owner_count":0,"entry_count":0,"link_count":0,"symlink_count":0,"total_bytes_already_existed":0,"total_bytes_copied":0,"total_bytes_copied_link_limit":0,"total_bytes_copied_wrong_mode":0,"total_bytes_copied_wrong_owner":0,"total_bytes_linked":0,"total_bytes_rendered":0}';

When this is outputted by a command and passed to eval, you see:

"copy_count":0: Command not found.
"copy_link_limit_count":0: Command not found.
"copy_wrong_mode_count":0: Command not found.
"copy_wrong_owner_count":0: Command not found.
"entry_count":0: Command not found.
"link_count":0: Command not found.
"symlink_count":0: Command not found.
"total_bytes_already_existed":0: Command not found.
"total_bytes_copied":0: Command not found.
"total_bytes_copied_link_limit":0: Command not found.
"total_bytes_copied_wrong_mode":0: Command not found.
"total_bytes_copied_wrong_owner":0: Command not found.
"total_bytes_linked":0: Command not found.
"total_bytes_rendered":0: Command not found.

It might be worth re-considering our use of json in the environment (@dcookspi). This case is a little bit convoluted, but I suspect many studios could have equally convoluted environment scripts...

jrray commented

I'm sympathetic but having separate vars for all these is gross. What if we encode the value so it becomes a harmless string?

From the meeting today:

  • possibly a base64 encoding, just something more shell friendly
  • might not be required anymore? since it gets sent with sentry