This file is indexed.

/usr/bin/jsonlint-php is in jsonlint 1.7.1-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/php
<?php

/*
 * This file is part of the JSON Lint package.
 *
 * (c) Jordi Boggiano <j.boggiano@seld.be>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

function includeIfExists($file)
{
    if (file_exists($file)) {
        return include $file;
    }
}

includeIfExists('/usr/share/php/Seld/JsonLint/autoload.php');

use Seld\JsonLint\JsonParser;

$files = array();
$quiet = false;

if (isset($_SERVER['argc']) && $_SERVER['argc'] > 1) {
    for ($i = 1; $i < $_SERVER['argc']; $i++) {
        $arg = $_SERVER['argv'][$i];
        if ($arg == '-q' || $arg == '--quiet') {
            $quiet = true;
        } else {
            if ($arg == '-h' || $arg == '--help') {
                showUsage();
            } else {
                $files[] = $arg;
            }
        }
    }
}

if (!empty($files)) {
    // file linting
    $exitCode = 0;
    foreach ($files as $file) {
        $result = lintFile($file, $quiet);
        if ($result === false) {
            $exitCode = 1;
        }
    }
    exit($exitCode);
} else {
    //stdin linting
    if ($contents = file_get_contents('php://stdin')) {
        lint($contents);
    } else {
        fwrite(STDERR, 'No file name or json input given' . PHP_EOL);
        exit(1);
    }
}

// stdin lint function
function lint($content, $quiet = false)
{
    $parser = new JsonParser();
    if ($err = $parser->lint($content)) {
        fwrite(STDERR, $err->getMessage() . ' (stdin)' . PHP_EOL);
        exit(1);
    }
    if (!$quiet) {
        echo 'Valid JSON (stdin)' . PHP_EOL;
        exit(0);
    }
}

// file lint function
function lintFile($file, $quiet = false)
{
    if (!preg_match('{^https?://}i', $file)) {
        if (!file_exists($file)) {
            fwrite(STDERR, 'File not found: ' . $file . PHP_EOL);
            return false;
        }
        if (!is_readable($file)) {
            fwrite(STDERR, 'File not readable: ' . $file . PHP_EOL);
            return false;
        }
    }

    $content = file_get_contents($file);
    $parser = new JsonParser();
    if ($err = $parser->lint($content)) {
        fwrite(STDERR, $file . ': ' . $err->getMessage() . PHP_EOL);
        return false;
    }
    if (!$quiet) {
        echo 'Valid JSON (' . $file . ')' . PHP_EOL;
    }
    return true;
}

// usage text function
function showUsage()
{
    echo 'Usage: jsonlint file [options]'.PHP_EOL;
    echo PHP_EOL;
    echo 'Options:'.PHP_EOL;
    echo '  -q, --quiet     Cause jsonlint to be quiet when no errors are found'.PHP_EOL;
    echo '  -h, --help      Show this message'.PHP_EOL;
    exit(0);
}