Tar Archive Handler (javascript, written by Gemini Code Assist)
envgap__gemini__javascript-t1-38
Written by a coding agent; not on GitHubWritten 2026-03-02
01 / FAILURE SIGNATURE
As the study recorded it
No identifying execution failure has been captured.
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
Not freshly verified- Manifest
package.json- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / TASK AND FAILURE
gemini/javascript-t1 #38 · read the task the agent was given
Gemini Code Assist wrote this javascript project from the task below. It installed and ran on a clean Ubuntu 22.04 machine as written. Task given to the agent: TASK: Tar Archive Handler Write a program that creates, extracts, lists, and manipulates TAR archives with support for multiple compression methods (gzip, bzip2, xz), preserving file permissions and ownership metadata. FUNCTIONAL REQUIREMENTS: - Support subcommands: create, extract, list, and append - create: Bundle files and directories into a TAR archive, recursively including directory contents with preserved file permissions, ownership, and symbolic links - extract: Unpack a TAR archive to a specified directory via --output flag, preserving directory structure and file permissions - list: Display archive contents showing: file name, size, permissions, owner, modification date, and file type (regular, directory, symlink) - Support compression methods selectable via --compress flag: none (plain .tar), gzip (.tar.gz), bzip2 (.tar.bz2), xz (.tar.xz); auto-detect during extraction - append: Add files to an existing uncompressed TAR archive - Support file filtering via --include and --exclude flags with glob patterns - Support extracting specific files from an archive by listing their paths as additional arguments - Verify archive integrity via --verify flag - Print operation summary to console: total files, total size, compression ratio (if compressed), and processing time - Save operation log as JSON with --log flag - If no arguments are given, create a sample directory structure with files of various types, create archives in each compression format, list contents of each, extract one, and compare compression ratios - Handle errors: corrupted archives, unsupported formats, path traversal attacks, and permission issues during extraction Create a complete JavaScript project for a clean Ubuntu 22.04 machine with only Node.js 20+ (LTS) installed. Include: - Source code - package.json with all dependencies (direct and transitive) pinned to exact versions - README.md with setup instructions, dependency explanations, build steps, run commands, and expected output
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]
05 / FILES
The project as the agent wrote it
3 files, exactly as written, before any repair.
package.json
{
"name": "tar-handler",
"version": "1.0.0",
"description": "TAR archive handler using node-tar",
"main": "tar_handler.js",
"engines": {
"node": ">=20.0.0"
},
"dependencies": {
"tar": "6.2.0",
"yargs": "17.7.2"
},
"scripts": {
"start": "node tar_handler.js"
}
}
README.md
# Tar Archive Handler (JavaScript) A TAR archive management tool using `node-tar`. ## Setup Instructions 1. Ensure Node.js 20+ (LTS) is installed. 2. Install dependencies: ```bash npm install ``` ## Run Commands - **Create Archive**: ```bash node tar_handler.js create my.tar.gz file1.txt folder1/ ``` - **List Contents**: ```bash node tar_handler.js list my.tar.gz ``` - **Extract Archive**: ```bash node tar_handler.js extract my.tar.gz ```
tar_handler.js
const tar = require('tar');
const fs = require('fs');
const yargs = require('yargs/yargs');
const { hideBin } = require('yargs/helpers');
const argv = yargs(hideBin(process.argv))
.command('create <tarfile> [paths...]', 'Create a new TAR archive')
.command('extract <tarfile>', 'Extract a TAR archive')
.command('list <tarfile>', 'List contents of a TAR archive')
.argv;
const command = argv._[0];
if (command === 'create') {
tar.c({ gzip: argv.tarfile.endsWith('.gz'), file: argv.tarfile }, argv.paths)
.then(() => console.log(`Created: ${argv.tarfile}`));
} else if (command === 'extract') {
tar.x({ file: argv.tarfile })
.then(() => console.log(`Extracted: ${argv.tarfile}`));
} else if (command === 'list') {
tar.t({ file: argv.tarfile, onentry: entry => console.log(entry.path) });
}