moode-player / moode

moOde sources and configs
GNU General Public License v3.0
997 stars 166 forks source link

NUL characters in text files #61

Closed TheOldPresbyope closed 4 years ago

TheOldPresbyope commented 4 years ago

I was surprised when I tried to view build_recipe_v2.15.txt using xed and got gibberish. Turns out it's considered a data file because the file contains a NUL character:

kreed@T520 ~/repos/moode/other/build $ file build_recipe_v2.15.txt build_recipe_v2.15.txt: data

Running the following script prints the offending line and reveals its non-printing characters (NUL='^@' and LF='$'):

kreed@T520 ~/repos/moode/other/build $ grep -Pan '\x00' build_recipe_v2.15.txt|cat -vET
229:sudo apt-get -y install udevil^@$

I can't claim I've checked the entire repo, but I did look through ./www and its first-level subdirectories and found that www/players.php also contains a NUL character:

kreed@T520 ~/repos/moode/www $ grep -Pan '\x00' players.php|cat -vET
28:$result = shell_exec("avahi-browse -a -t -r -p | awk -F '[;.]' '/IPv4/ && /moOde/ && /audio/ && /player/ && /=/ {print $7\",\"$9\".\"$10\".\"$11\".\"$12}' | sort^@");$

I don't believe these NULs have done any harm in context but I believe they should be removed as a matter of good housekeeping.

moodeaudio commented 4 years ago

Ok thanks. I don't know how those sneak in but I'll get rid of them in those two files.

moodeaudio commented 4 years ago

Fixed