{"record":{"id":"7f566d69fa032346","repo":"can1357/oh-my-pi","slug":"invalid-old-gnu-name-record","errorCode":null,"errorMessage":"Invalid old-GNU name record","messagePattern":"Invalid old-GNU name record","errorType":"exception","errorClass":"ArchiveError","httpStatus":null,"severity":"error","filePath":"packages/utils/src/ar/tar.ts","lineNumber":308,"sourceCode":"}\n\nfunction applyOldGnuNameRecords(\n\tdata: Uint8Array,\n\tentries: Map<string, ArchiveIndexEntry>,\n\tpendingLinks: Map<ArchiveIndexEntry, PendingTarLink>,\n\tlimits: ArchiveLimits,\n): void {\n\tassertIndexSize(data.byteLength, limits, \"old-GNU name metadata\");\n\tconst terminator = data.indexOf(0);\n\tconst end = terminator === -1 ? data.byteLength : terminator;\n\tlet start = 0;\n\twhile (start < end) {\n\t\tconst newline = data.indexOf(0x0a, start);\n\t\tconst lineEnd = newline === -1 || newline > end ? end : newline;\n\t\tconst line = data.subarray(start, lineEnd);\n\t\tif (bytesMatchAscii(line, 0, \"Rename \")) {\n\t\t\tconst separator = indexOfAscii(line, \" to \", \"Rename \".length);\n\t\t\tif (separator === -1) throw new ArchiveError(\"Invalid old-GNU name record\");\n\t\t\tconst source = readMetadataPath(line.subarray(\"Rename \".length, separator), \"old-GNU source path\", limits);\n\t\t\tconst targetEnd = line[line.byteLength - 1] === 0x2f ? line.byteLength - 1 : line.byteLength;\n\t\t\tconst target = readMetadataPath(\n\t\t\t\tline.subarray(separator + \" to \".length, targetEnd),\n\t\t\t\t\"old-GNU target path\",\n\t\t\t\tlimits,\n\t\t\t);\n\t\t\trenameOldGnuEntries(\n\t\t\t\tentries,\n\t\t\t\tpendingLinks,\n\t\t\t\tnormalizeOldGnuName(source, \"source path\", limits),\n\t\t\t\tnormalizeOldGnuName(target, \"target path\", limits),\n\t\t\t\tlimits,\n\t\t\t);\n\t\t}\n\t\tstart = lineEnd + 1;\n\t}\n}","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/utils/src/ar/tar.ts#L290-L326","documentation":"Thrown when parsing an old-GNU name record (typeflag 'N') whose line starts with 'Rename ' but lacks the required ' to ' separator between source and target paths. The record format is structurally malformed.","triggerScenarios":"readTar/readTarEntriesFromBuffer encounters a 'Rename ...' line inside an old-GNU name metadata block where indexOfAscii(line, \" to \") returns -1 — e.g. 'Rename foo' with no target.","commonSituations":"Corrupted archives, truncated metadata blocks, archives from broken writers, or fuzzed input where the ' to ' delimiter bytes were damaged.","solutions":["Verify archive integrity and re-download or re-extract from the original source.","Re-create the archive with a standard tar tool; modern tar does not emit old-GNU rename records.","Reject untrusted archives that fail this check — it indicates tampering or corruption."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await readTar(bytes, opts);\n} catch (e) {\n  if (e instanceof ArchiveError && e.message === \"Invalid old-GNU name record\") {\n    throw new Error(\"Archive old-GNU metadata is corrupt; obtain a clean copy\");\n  }\n  throw e;\n}","preventionTips":["Verify archive checksums/signatures before parsing.","Avoid tools that emit old-GNU rename records; prefer ustar/PAX archives.","Re-download rather than retry-parse when this fires — the bytes are damaged."],"tags":["archive","tar","gnu","corrupt-input"],"backgroundTag":"corrupt-archive-header","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}