uklans / cache-domains

Domain Names required for LAN Content Cache DNS spoofing
MIT License
566 stars 526 forks source link

Parse error: invalid numeric literal at line 4, column 0 #218

Closed liquidfrollo closed 1 year ago

liquidfrollo commented 1 year ago

Describe the issue you are having

I'm attempting to run this via a truecharts container (Linux pihole-5777485665-zhjcq 5.15.79+truenas #1 SMP Tue Dec 13 12:40:04 UTC 2022 x86_64 GNU/Linux), from Madcow's script (https://github.com/Maddcow/Lancache-Pihole) which calls this one. When the script executes it cannot move the output files because they are never generated via the script.

when i cd into the temp folder created where the script is executing from and run it manually (with all required files present in the expected folder structure) i receive the error "Parse error: invalid numeric literal at line 4, column 0" x4. All files are pulled via git so the cache_domains.json is from this site and file -i returns us-ascii as a format, however it appears to be a jq error not liking something about the file (jq version 1.6). I can "cat cache_domains.json | jq '."cache_domains"'" and get valid output without issue however the script will not run and generate the necessary files.

Thinking it may have something to do with the basedir=". ." i modified the script to basedir="$(dirname $PWD)" however that doesn't make a difference and results in the same issue. It seems as if no matter what it either can't find the file or doesn't like something in it.

If i turn on set -x here is where the errors get generated..

`root@pihole-5777485665-zhjcq:/tmp/tmp.NscmmrsVgm/scripts# ./create-dnsmasq.sh /tmp/tmp.NscmmrsVgm

export 'IFS= ' IFS=' ' ++ which jq test=/usr/bin/jq out=0 '[' 0 -gt 0 ']' cachenamedefault=disabled ++ jq -r '.ips | to_entries[] | .key' config.json parse error: Invalid numeric literal at line 4, column 0 read -r line ++ jq '.ips[""]' config.json parse error: Invalid numeric literal at line 4, column 0 ip= declare cacheip= read -r line ++ jq -r '.cache_domains | to_entries[] | .key' config.json parse error: Invalid numeric literal at line 4, column 0 read -r line ++ jq -r '.cache_domains[""]' config.json parse error: Invalid numeric literal at line 4, column 0 name= declare cachename= read -r line rm -rf output/dnsmasq mkdir -p output/dnsmasq`

Describe your setup?

Running truenas scale, with lancache monolithic and pihole

Are you running sniproxy

No

DNS Configuration

can't get script to run

Sniproxy output

not running docker

NA
liquidfrollo commented 1 year ago

I resolved my issue. The issue was that when attempting to set the IP it was not getting enclosed in quotes properly. This wouldn't cascade down the line in a way the script liked. adding the ip manually such as '"172.2.3.135"' in single and then double worked.