patchbench / pilot /verified /js.jsonl
rootxhacker's picture
pilot js: verified
28bbd25 verified
Raw
History Blame Contribute Delete
13.1 kB
{"id": "patchbench-js-real-0081", "language": "javascript", "source": "real", "origin": "swe-bench-live-multilang", "upstream_instance_id": "cthackers__adm-zip-559", "repo": "cthackers/adm-zip", "base_commit": "1cd32f7e0ad3c540142a76609bb538a5cda2292f", "issue_text": "addLocalFolderPromise is broken when providing absolute path on mac\ncaused by this change. fixPath is calling path.join which will join two absolute paths.\r\n\r\nhttps://github.com/cthackers/adm-zip/blame/b148463f5f9f67427df6dd19798cdce20bde3d74/adm-zip.js#L488\n", "hints_text": "Also have this issue. Resulting zip is empty\nsame here\r\nIt's also happening on linux\nalso have this issue\n\n", "gold_patch": "diff --git a/adm-zip.js b/adm-zip.js\nindex 31dddf2..4bac5c8 100644\n--- a/adm-zip.js\n+++ b/adm-zip.js\n@@ -86,7 +86,7 @@ module.exports = function (/**String*/ input, /** object */ options) {\n function fixPath(zipPath) {\n const { join, normalize, sep } = pth.posix;\n // convert windows file separators and normalize\n- return join(\".\", normalize(sep + zipPath.split(\"\\\\\").join(sep) + sep));\n+ return join(pth.isAbsolute(zipPath) ? \"/\": '.', normalize(sep + zipPath.split(\"\\\\\").join(sep) + sep));\n }\n \n function filenameFilter(filterfn) {\n", "test_patch": "diff --git a/test/methods/methods.test.js b/test/methods/methods.test.js\nindex 4cf8777..8d61807 100644\n--- a/test/methods/methods.test.js\n+++ b/test/methods/methods.test.js\n@@ -638,6 +638,26 @@ describe(\"adm-zip.js - methods handling local files\", () => {\n \n expect(zip1Entries.sort()).to.deep.equal(expected.sort());\n });\n+\n+\n+\n+ it(\"zip.addLocalFolderPromise(destination, {zipPath}) with absolute path\", async function () {\n+ const zip = new Zip();\n+ await zip.addLocalFolderPromise(pth.resolve(destination), { zipPath: \"parent\" });\n+ const zip1Entries = zip.getEntries().map((e) => e.entryName);\n+\n+ const expected = [\n+ \"parent/subfolder1/\",\n+ \"parent/subfolder1/subfolder2/\",\n+ \"parent/subfolder1/subfolder2/subfolder3/\",\n+ \"parent/subfolder1/subfolder2/zipEntry1.txt\",\n+ \"parent/subfolder1/subfolder2/subfolder3/subfolder4/\",\n+ \"parent/subfolder1/subfolder2/subfolder3/zipEntry2.txt\",\n+ \"parent/subfolder1/subfolder2/subfolder3/zipEntry3.txt\"\n+ ];\n+\n+ expect(zip1Entries.sort()).to.deep.equal(expected.sort());\n+ });\n });\n });\n \n", "fail_to_pass": ["adm-zip.js - methods handling local files .addLocalFolderPromise() - promise zip.addLocalFolderPromise(destination, {zipPath}) with absolute path"], "pass_to_pass": ["headers main-header test toString function", "Multibyte Character Sets in Filename ascii filename and chinese content", "method - zipcrypto zipcrypto decrypt should throw if invalid password is provided for Info-Zip bit 3 flag", "adm-zip zip.addFile - add directory", "adm-zip testing noSort option", "method - zipcrypto zipcrypto decrypt is test data valid", "headers main-header compare correct read values", "method - zipcrypto zipcrypto encrypt test encryption and decrytion with node random salt", "adm-zip.js - methods handling local files .addLocalFolderPromise() - promise zip.addLocalFolderPromise(destination)", "Multibyte Character Sets in Filename add files with Unicode symbols filename (utf8) into new zip", "headers central-header construct header with values and compare, binaries have to be equal", "adm-zip.js - methods handling local files .deleteFile() zip.deleteFile() - delete folder", "utils crc32 function handle strings", "Multibyte Character Sets in Filename add files with japanese filename (EUC-JP) into new zip", "crc Bad CRC - async method returns err string", "headers central-header local-header construct header by values and compare binaries have to be equal", "read zip file header with invalid large number of entries throws too large error", "decryption with info-zip spec password check test decrypted data with password", "adm-zip.js - methods handling local files .addLocalFolder() - sync zip.addLocalFolder(destination, zipPath)", "Multibyte Character Sets in Filename fetch file with chinese filename (gbk) in existing zip", "ADM-ZIP - Issues Issue 130 - Created zip's under Windows are corrupt", "headers central-header local-header read binary and create new binary from it, they have to be equal", "adm-zip passes issue-438-AddFile with windows path sepator", "adm-zip.js - methods handling local files .addLocalFolderAsync2() - async zip.addLocalFolderAsync2({localPath, namefix}, callback)", "Multibyte Character Sets in Filename add files with chinese filename into new zip", "headers main-header write empty file", "adm-zip.js - methods handling local files .extractEntryTo() - sync zip.extractEntryTo(entry, destination, false, true) - [ extract folder from file where folders does not exists ]", "method - zipcrypto zipcrypto encrypt test encrypting and decryting with some javascript objects", "adm-zip.js - methods handling local files .addLocalFolderAsync2() - async zip.addLocalFolderAsync2({localPath, filter}, callback)", "method - zipcrypto zipcrypto decrypt should throw if invalid password is provided", "Multibyte Character Sets in Filename add files with japanese filename (UTF-8) into new zip", "utils sanitizing functions : function zipnamefix()", "adm-zip.js - methods handling local files .deleteFile() zip.deleteFile() - delete folder with subfolders", "adm-zip.js - methods handling local files .extractEntryTo() - sync zip.extractEntryTo(entry, destination, true, true) - [ extract folder from file where folders exists ]", "method - zipcrypto zipcrypto decrypt handles invalid data field values / types", "adm-zip zip pathTraversal", "adm-zip.js - methods handling local files .addLocalFolder() - sync zip.addLocalFolder(destination)", "adm-zip.js - methods handling local files .extractEntryTo() - sync zip.extractEntryTo(entry, destination, false, true)", "adm-zip.js - methods handling local files .extractAllToAsync - sync zip.extractAllToAsync(destination, false) [Promise]", "headers central-header local-header compare binary header values with predetermined values", "adm-zip adds multibyte ZIP comment in UTF-8 with appropriate byte", "crc Good CRC - trailing data descriptor ", "adm-zip.js - methods handling local files .extractAllToAsync - sync zip.extractAllToAsync(destination, false, false) [Promise]", "method - zipcrypto zipcrypto encrypt test binary results with known salt", "adm-zip.js - methods handling local files .extractAllTo() - sync zip.extractAllTo(destination)", "adm-zip.js - methods handling local files .addLocalFolderAsync2() - async zip.addLocalFolderAsync2({localPath}, callback)", "adm-zip.js - methods handling local files .addLocalFolderPromise() - promise zip.addLocalFolderPromise(destination, {namefix})", "Multibyte Character Sets in Filename add file with chinese filename into existing zip", "utils sanitizing functions : function sanitize()", "headers main-header read empty file", "headers central-header compare binary header values with some predetermined values", "adm-zip.js - methods handling local files .addLocalFolderAsync2() - async zip.addLocalFolderAsync2({localPath, zipPath}, callback)", "crc Bad CRC - sync method throws an error object", "headers main-header set comment length", "adm-zip.js - methods handling local files .addLocalFileAsync() - async zip.addLocalFileAsync({ localPath, comment, zipPath }, callback)", "utils sanitizing functions : function canonical()", "Multibyte Character Sets in Filename add files with bulgarian filename (win1251) into new zip", "headers central-header centralHeader date if date is specified", "Multibyte Character Sets in Filename add files with chinese filename (UTF-8) into new zip", "adm-zip.js - methods handling local files .extractAllToAsync - sync zip.extractAllToAsync(destination, false, callback)", "Multibyte Character Sets in Filename read and keep entry.extra while write zip", "adm-zip.js - methods handling local files .extractAllToAsync - sync zip.extractAllToAsync(destination, false, false, callback)", "headers central-header centralHeaderSize results if postdata is specified", "adm-zip.js - methods handling local files .deleteFile() zip.deleteFile() - delete files", "adm-zip zip.writeZip - multiple times", "crc Good CRC", "adm-zip.js - methods handling local files .extractAllToAsync - sync zip.extractAllToAsync(destination) [Promise]", "method - zipcrypto zipcrypto decrypt test decrypted data with password", "adm-zip.js - methods handling local files .extractAllToAsync - sync zip.extractAllToAsync(destination)", "adm-zip.js - methods handling local files .extractAllTo() - sync zip.extractAllTo(destination) - streamed file", "adm-zip windows style path with backslash should be converted to slashes", "Multibyte Character Sets in Filename add files with hebrew filename (win1255) into new zip", "method - zipcrypto zipcrypto encrypt test encryption and decrytion with known source data", "headers central-header handles fileAttr when attr above 0x80000000", "adm-zip passes issue-237-Twizzeld test case", "adm-zip.js - methods handling local files .addLocalFolderAsync2() - async zip.addLocalFolderAsync2(destination, callback)", "adm-zip.js - methods handling local files .extractEntryTo() - sync zip.extractEntryTo(entry, destination, false, true) - [ extract folder from file where folders exists ]", "Multibyte Character Sets in Filename add files with chinese filename (Big5) into new zip", "headers central-header read binary and create new binary from it, they have to be equal", "crc CRC is not changed after re-created", "adm-zip.js - methods handling local files .addLocalFolderPromise() - promise zip.addLocalFolderPromise(destination, {zipPath})", "adm-zip.js - methods handling local files .extractEntryTo() - sync zip.extractEntryTo(entry, destination, true, true)", "adm-zip.js - methods handling local files .addLocalFolder() - sync zip.addLocalFolder(destination, '', filter)", "Multibyte Character Sets in Filename add files with japanese filename (Shift_JIS) into new zip", "Multibyte Character Sets in Filename add files with hebrew filename (UTF-8) into new zip", "adm-zip.js - methods handling local files .extractEntryTo() - sync zip.extractEntryTo(entry, destination, true, true) - [ extract folder from file where folders does not exists ]"], "test_cmds": ["mkdir -p reports; npx mocha --reporter json > reports/mocha-results.json"], "log_parser": "def parser(log: str) -> dict[str, str]:\n import json\n import re\n\n results = {}\n\n def add(name, status):\n if name:\n results[name] = status\n\n data = None\n # Try direct JSON parse\n try:\n data = json.loads(log)\n except Exception:\n pass\n\n # Fallback: regex extract JSON object\n if data is None:\n matches = re.findall(r\"\\{.*\\}\", log, flags=re.DOTALL)\n for chunk in reversed(matches):\n try:\n data = json.loads(chunk)\n if isinstance(data, dict):\n break\n except Exception:\n data = None\n\n if not isinstance(data, dict):\n return results\n\n tests = data.get(\"tests\") or []\n for test in tests:\n if not isinstance(test, dict):\n continue\n name = test.get(\"fullTitle\") or test.get(\"title\")\n state = (test.get(\"state\") or \"\").lower()\n pending_flag = bool(test.get(\"pending\") or test.get(\"isPending\"))\n err = test.get(\"err\") or {}\n\n if state in (\"failed\", \"fail\", \"error\"):\n status = \"fail\"\n elif state in (\"pending\", \"skipped\", \"skip\"):\n status = \"skip\"\n elif pending_flag:\n status = \"skip\"\n elif isinstance(err, dict) and err:\n if err.get(\"message\") or err.get(\"stack\") or err.get(\"name\") or err != {}:\n status = \"fail\"\n else:\n status = \"pass\"\n else:\n status = \"pass\"\n add(name, status)\n\n for test in data.get(\"passes\") or []:\n if isinstance(test, dict):\n add(test.get(\"fullTitle\") or test.get(\"title\"), \"pass\")\n for test in data.get(\"pending\") or []:\n if isinstance(test, dict):\n add(test.get(\"fullTitle\") or test.get(\"title\"), \"skip\")\n for test in data.get(\"failures\") or []:\n if isinstance(test, dict):\n add(test.get(\"fullTitle\") or test.get(\"title\"), \"fail\")\n\n return results", "docker_image": "starryzhang/sweb.eval.x86_64.cthackers_1776_adm-zip-559", "context_files": null, "result": {"timing": {"setup": 0.8, "pre_test_0": 2.6, "pre_test_1": 0.6, "post_test_0": 1.3, "post_test_1": 0.6, "total": 6.0}, "context_lines": 1499, "buggy_files": ["adm-zip.js"]}}