This file is indexed.

/usr/lib/nodejs/carto/bin/carto is in node-carto 0.9.5-2.

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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/usr/bin/nodejs

var path = require('path'),
    fs = require('fs'),
    carto = require('../lib/carto'),
    url = require('url'),
    _ = require('underscore');

var existsSync = require('fs').existsSync || require('path').existsSync

var optimist = require('optimist')
            .usage("Usage: $0 <source MML file>")
            .options('h', {alias:'help', describe:'Display this help message'})
            .options('v', {alias:'version', boolean:true, describe:'Display version information'})
            .options('b', {alias:'benchmark', boolean:true, describe:'Outputs total compile time'})
            .options('l', {alias:'localize', boolean:true, default:false, describe:'Use millstone to localize resources when loading an MML'})
            .options('n', {alias:'nosymlink', boolean:true, describe:'Use absolute paths instead of symlinking files'})
            .options('ppi', {describe:'Pixels per inch used to convert m, mm, cm, in, pt, pc to pixels', default:90.714});

var options = optimist.argv;

if (options.help) {
    optimist.showHelp();
    process.exit(0);
}

if (options.version) {
    console.log("carto " + carto.version.join('.') + " (Carto map stylesheet compiler)");
    process.exit(0);
}

var input = options._[0];
if (input && input[0] != '/') {
    input = path.join(process.cwd(), input);
}

if (!input) {
    console.log("carto: no input files ('carto -h or --help' for help)");
    process.exit(1);
}

if (options.benchmark) {
    var start = +new Date;
}

var ext = path.extname(input);

if (!ext) {
    console.log("carto: please pass either a .mml file or .mss file");
    process.exit(1);
}

if (!existsSync(input)) {
    console.log("carto: file does not exist: '" + input + "'");
    process.exit(1);
}

function compileMML(err, data) {
    // force drain the millstone download pool now
    // to ensure we can exit without waiting
    if (options.localize && millstone.drainPool) {
        millstone.drainPool(function() {});
    }
    if (err) {
        console.error(err);
        process.exit(1);
    }
    try {
        var renderer = new carto.Renderer({
            filename: input,
            benchmark: options.benchmark,
            ppi: options.ppi
        });
        renderer.render(data, function(err, output) {
            if (err) {
                console.error(err);
                throw err;
                process.exit(1);
            } else {
                if (!options.benchmark) {
                    console.log(output);
                } else {
                    var duration = (+new Date) - start;
                    console.log('TOTAL: ' + (duration) + 'ms');
                }
            }
        });
    } catch (e) {
        if (e.stack) {
            console.error(e.stack);
        } else {
            console.error(e);
        }
        process.exit(1);
    }
};

function compileMSS(err, data) {
    if (err) {
        console.error(err);
        process.exit(1);
    }
    try {
        var renderer = new carto.Renderer({
            filename: path.basename(input),
            benchmark: options.benchmark,
            ppi: options.ppi
        });
        renderer.renderMSS(data, function(err, output) {
            if (err) {
                console.error(err);
                throw err;
                process.exit(1);
            } else {
                if (!options.benchmark) {
                    console.log(output);
                } else {
                    var duration = (+new Date) - start;
                    console.log('TOTAL: ' + (duration) + 'ms');
                }
            }
        });
    } catch (e) {
        if (e.stack) {
            console.error(e.stack);
        } else {
            console.error(e);
        }
        process.exit(1);
    }
};

try {
    var data = fs.readFileSync(input, 'utf-8');
} catch(err) {
    console.error("carto: " + err.message.replace(/^[A-Z]+, /, ''));
    process.exit(1);
}

if (ext == '.mml') {
    try {
        data = JSON.parse(data);
    } catch(err) {
        console.error("carto: " + err.message.replace(/^[A-Z]+, /, ''));
        process.exit(1);
    }

    if (options.localize) {
        var millstone = undefined;
        try {
            require.resolve('millstone');
            millstone = require('millstone');
        } catch (err) {
            console.error('carto: Millstone not found, required if localizing stylesheet resources. ' + err.message.replace(/^[A-Z]+, /, ''));
            process.exit(1);
        }
        millstone.resolve({
            mml: data,
            base: path.dirname(input),
            cache: path.join(path.dirname(input), 'cache'),
           nosymlink: options.nosymlink
        }, compileMML);
    } else {
        data.Stylesheet = data.Stylesheet.map(function(x) {
            if (typeof x !== 'string') {
                return { id: x, data: x.data }
            }
            return { id: x, data: fs.readFileSync(path.join(path.dirname(input), x), 'utf8') }
        });
        compileMML(null,data);
    }
} else if (ext == '.mss') {
    compileMSS(null,data);
} else {
    console.log("carto: please pass either a .mml file or .mss file");
}