TickTick icon indicating copy to clipboard operation
TickTick copied to clipboard

Parsing an external json file not working

Open OlinaRuan opened this issue 10 years ago • 6 comments

When I try to parse an json file, it always complains: "ticktick.sh: line 392: TICKTICK: command not found"

OlinaRuan avatar Oct 26 '14 02:10 OlinaRuan

can you please tell me a bit more about this?

kristopolous avatar Jun 27 '16 21:06 kristopolous

JSON:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": ["/usr/include"],
            "browse" : {
                "limitSymbolsToIncludedHeaders" : true,
                "databaseFilename" : ""
            }
        }
    ]
}

build.sh:

#!/usr/bin/env bash
. ticktick.sh
data=`cat ./.vscode/c_cpp_properties.json`
tickParse $data

Returns ticktick.sh: line 424: TICKTICK: command not found

Callstack: 1 - loading ticktick.sh 2 - _tick_fun_tokenize("/home/[...]/build.sh") 3 - Crash on bash -c "$code" -- $ARGV

Variables: $ARGV='' $hasError='declare -- hasError="0"' $code=<contains build.sh>

TheAifam5 avatar Dec 09 '16 18:12 TheAifam5

ok I'll try it out

kristopolous avatar Dec 09 '16 21:12 kristopolous

@kristopolous I've now run into this same thing.

Script:

sh #!/bin/bash . ticktick.sh tickParse `cat /tmp/test.json` tickVars

Input file:

JSON {"string": "stringy!", "int": 7, "array": [ "first", "second" ]}

Output:

`` ticktick.sh: line 424: TICKTICK: command not found @ Line 6: string=

``

Thoughts:

Obviously this is a quote containment issue relating to line 18: echo "TICKTICK PARSING ERROR "$1. I suspect that output is getting picked up in an eval somewhere.

Two errors:

  1. The quoting is not capturing the whole phrase once it gets to that level (maybe echo "\"...$1\""); and
  2. The eval shouldn't be trying to run something that might be error text. Maybe the grep on line 353 is supposed to be preventing this, but because of the quoting it can't?
  3. Third of two: I'm not sure why $1 in the echo is outside the quotes. That seems dangerous.

XLTechie avatar May 22 '20 16:05 XLTechie

Okay, so the things I said above are true--that or those error(s) should be fixed, probably before this one since this one shows it/them. However, the underlying problem here is that for some reason I haven't figured out, tickParse and the function chain it calls, can't handle spaces in the JSON. If you take the JSON above and remove all spaces, it does not emit the error, or attempt to eval the error message which causes the error.

Maybe there is a problem with one of the regular expressions that __tick_json_tokenize uses? I haven't fully comprehended how that thing is working yet.

This is a very serious bug; I'm creating an issue dedicated to it.

XLTechie avatar May 22 '20 17:05 XLTechie

Related: #50

XLTechie avatar May 22 '20 17:05 XLTechie