{"record":{"id":"43b1f4dbc8d0510d","repo":"DrKLO/Telegram","slug":"s-only-one-input-file-n","errorCode":null,"errorMessage":"%s: only one input file\\n","messagePattern":"(.+?): only one input file\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/mozjpeg/djpeg.c","lineNumber":579,"sourceCode":"  /* Must have either -outfile switch or explicit output file name */\n  if (outfilename == NULL) {\n    if (file_index != argc - 2) {\n      fprintf(stderr, \"%s: must name one input and one output file\\n\",\n              progname);\n      usage();\n    }\n    outfilename = argv[file_index + 1];\n  } else {\n    if (file_index != argc - 1) {\n      fprintf(stderr, \"%s: must name one input and one output file\\n\",\n              progname);\n      usage();\n    }\n  }\n#else\n  /* Unix style: expect zero or one file name */\n  if (file_index < argc - 1) {\n    fprintf(stderr, \"%s: only one input file\\n\", progname);\n    usage();\n  }\n#endif /* TWO_FILE_COMMANDLINE */\n\n  /* Open the input file. */\n  if (file_index < argc) {\n    if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {\n      fprintf(stderr, \"%s: can't open %s\\n\", progname, argv[file_index]);\n      exit(EXIT_FAILURE);\n    }\n  } else {\n    /* default input file is stdin */\n    input_file = read_stdin();\n  }\n\n  /* Open the output file. */\n  if (outfilename != NULL) {\n    if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/djpeg.c#L561-L597","documentation":"When djpeg is built WITHOUT TWO_FILE_COMMANDLINE (Unix single-file style), it accepts at most one positional input (output goes to stdout). If file_index < argc-1 there is more than one positional file, this message prints, and usage() exits.","triggerScenarios":"Running a non-TWO_FILE_COMMANDLINE build of djpeg with two or more positional file arguments.","commonSituations":"Moving from a TWO_FILE_COMMANDLINE build to a Unix-style build while keeping the old two-positional invocation; shell glob producing multiple inputs; wrapper scripts that always append an output path.","solutions":["Pass at most one positional input and redirect stdout: djpeg in.jpg > out.ppm.","If two-positional semantics are required, rebuild with TWO_FILE_COMMANDLINE defined or use -outfile.","Collapse globs/loops to a single input per invocation."],"exampleFix":"# before: two positionals on a Unix-style build\ndjpeg in.jpg out.ppm\n# after\ndjpeg in.jpg > out.ppm","handlingStrategy":"validation","validationCode":"#!/bin/sh\npos=()\nfor a in \"$@\"; do case \"$a\" in -*) ;; *) pos+=(\"$a\");; esac; done\n[ \"${#pos[@]}\" -gt 1 ] && { echo 'this djpeg build accepts at most one input; redirect stdout for output' >&2; exit 1; }\ndjpeg \"$@\"","typeGuard":"// n/a: argv-count validation in the caller.","tryCatchPattern":"if ! djpeg \"$@\" 2>/tmp/e; then\n  grep -q 'only one input file' /tmp/e && { echo 'Unix-style build: use one input + stdout redirect'; exit 1; }\nfi","preventionTips":["Know and document your djpeg build's commandline style.","Prefer stdout redirection (djpeg in.jpg > out.ppm) for portability.","Loop over multiple inputs instead of passing several at once."],"tags":["mozjpeg","djpeg","cli-argument","commandline","too-many-inputs"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}