bun
bun copied to clipboard
crash on unzipper zip file
How can we reproduce the crash?
i dont know whats it is ...
code :
import fs from "fs"; import path from "path";
import express from "express"; import cors from "cors"; import helmet from "helmet"; import dotenv from "dotenv"; import morgan from "morgan"; import axios from "axios"; import unzipper from "unzipper";
const icon_urls = [ // download all icons and save to icon folder "https://phosphoricons.com/assets/phosphor-icons.zip", ];
// make icon folder, if it doesn't exist if (!fs.existsSync("./icon")) { fs.mkdirSync("./icon"); }
// delete all files in icon folder fs.readdirSync("./icon").forEach((file) => { fs.unlinkSync(path.join("./icon", file)); });
console.log("Downloading icons!");
for (const url of icon_urls) {
const response = await axios.get(url, { responseType: "arraybuffer" });
const buffer = Buffer.from(response.data, "binary");
const filename = url.split("/").pop() as string;
const file = await Bun.file(./icon/${filename}
);
const writer = await file.writer();
await writer.write(buffer);
// if file is zipped, extract it
if (filename.endsWith(".zip")) {
const directory = await unzipper.Open.file(./icon/${filename}
);
await directory.extract({ path: "./icon" });
}
}
dotenv.config();
const app = express(); app.use(cors()); app.use(helmet()); app.use(morgan("dev"));
app.get("/", async (req, res) => { res.json({ message: "Hello, world!", }); });
app.listen(3000, () => { console.log("Server is running on port 3000"); });
Relevant log output
$ yarn dev
yarn run v1.22.22
warning package.json: No license field
$ bun run --watch index.ts
Downloading icons!
============================================================
Bun v1.1.39 (1d485617) Windows x64
Windows v.win10_fe
CPU: sse42 avx avx2
Args: "bun" "run" "--watch" "index.ts"
Features: fetch jsc tsconfig(15)
Builtins: "bun:main" "node:assert" "node:async_hooks" "node:buffer" "node:constants" "node:crypto" "node:events" "node:fs" "node:http" "node:https" "node:net" "node:os" "node:path" "node:querystring" "node:stream" "node:string_decoder" "node:tty" "node:url" "node:util" "node:util/types" "node:zlib"
Elapsed: 9844ms | User: 1078ms | Sys: 921ms
RSS: 0.91GB | Peak: 0.91GB | Commit: 1.17GB | Faults: 224774
panic(main thread): cast causes pointer to be null
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:
https://bun.report/1.1.39/wr11d48561Ahg87//Dwj4mNq44trB896urB604urB2yosMk4q+G2pwgmBkxt9F6z29F00shGA0eNpLTiwuUUhOLC1OLVYoyM/MK0ktUijJV0hKVcgrzckBAK96CzY
--- Bun is auto-restarting due to crash [time: 1734578232744] ---
25 | fs.mkdirSync("./icon");
26 | }
27 |
28 | // delete all files in icon folder
29 | fs.readdirSync("./icon").forEach((file) => {
30 | fs.unlinkSync(path.join("./icon", file));
^
EPERM: Operation not permitted
errno: -1
syscall: "unlink"
path: "icon\Fonts"
at D:\Projects\RWID\microservice\rwid-icon\index.ts:30:6
at forEach (1:11)
at D:\Projects\RWID\microservice\rwid-icon\index.ts:29:26
Stack Trace (bun.report)
Bun v1.1.39 (1d48561
) on windows x86_64 [RunCommand]
panic: cast causes pointer to be null
-
bun.zig:341
:cast
-
queue.h:33
:uv__queue_empty
-
req-inl.h:189
:uv__process_reqs
-
core.c:657
:uv_run
-
uws.zig:4290
:tickWithTimeout
-
javascript.zig:3178
:loadEntryPoint
-
bindings.cpp:5068
:JSC__VM__holdAPILock
-
shimmer.zig:201
:cppFn
-
run_command.zig:1373
:exec
-
cli.zig:2078
:start
Features: fetch, jsc, tsconfig, tsconfig
Sentry Issue: BUN-A0J