Open JeffSpies opened 5 months ago
The function doesn't print the errno currently (I will do it later), so can you provide the output of strace -e trace=setxattr bun run <the ts file>
?
Thank you for the reply; here's that output:
setxattr("./IMG_8054.jpg", "user.mime", "text/html", 10, 0x96558520 /* XATTR_??? */) = -1 EINVAL (Invalid argument)
7 | export function cstr(jsstr: string) {
8 | return (jsstr ? encoder.encode(jsstr + "\x00") : EMPTY) as unknown as CString;
9 | }
10 |
11 | export function checkReturnValue<T extends number | bigint>(ret: T): T {
12 | if (typeof ret === "number" && ret < 0) throw new Error("native error");
^
error: native error
at checkReturnValue (/home/jspies/code/bun-hasher/node_modules/bun-xattr/utils.ts:12:49)
at setxattr (/home/jspies/code/bun-hasher/node_modules/bun-xattr/impl/Linux.ts:78:5)
at /home/jspies/code/bun-hasher/index.ts:22:1
+++ exited with 1 +++
edit: To add some context, I've tried this with a number of files and a number of attribute keys and values. I also checked the value of type()
from node:os
, and it is indeed Linux
. Thanks!
it should be fixed in 0.0.3
That worked. Thank you! Have you thought about expanding the error messages? It seems like a file not having a given attribute will throw the same error as, for example, a system error. Being able to distinguish the former would probably be useful. Thanks again!
That worked. Thank you! Have you thought about expanding the error messages? It seems like a file not having a given attribute will throw the same error as, for example, a system error. Being able to distinguish the former would probably be useful. Thanks again!
Unfortunately, due to limitations of bun, there is no reliable way to get the value of errno...
Hi there! I was very happy to see that someone built this package for the bun ecosystem--thank you! But I'm encountering the following error when running identical code--other than the path--to the README:
The return value seems to be -1, causing this error to be thrown.
Have you encountered this? Any debugging tips? Thanks!