Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bun accessSync bug with symlink files #2558

Open
byawitz opened this issue Apr 5, 2023 · 1 comment
Open

Bun accessSync bug with symlink files #2558

byawitz opened this issue Apr 5, 2023 · 1 comment
Labels
bug Something isn't working node.js Compatibility with Node.js APIs

Comments

@byawitz
Copy link

byawitz commented Apr 5, 2023

What version of Bun is running?

0.5.9

What platform is your computer?

Linux 5.10.0-11-amd64 x86_64 unknown

What steps can reproduce the bug?

I have a simple hono.dev project that runs on bun.

I'm trying to add certbot TLS files as such

export default {
    port    : 3000,
    fetch   : app.fetch,
    keyFile : "/certificates/privkey.pem",
    certFile: "/certificates/fullchain.pem",
}

This didn't work because the privatekey.pem and fullchain.pem are symlinks for the certbot archive folder.

So when I pointed to those files directly, it deed worked.

What is the expected behavior?

It be great if Bun be able to load those files as they regular files and not symlink

What do you see instead?

I've point to the direct files, this is not a long-term solution as they can change

Additional information

No response

@byawitz byawitz added the bug Something isn't working label Apr 5, 2023
@Jarred-Sumner
Copy link
Collaborator

For future reference, the following test does not reproduce it:

it.only("ssl keyFile symlink works", async () => {
  const keyFileContents = `
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAt9xYiIonscC3vz/A2ceR7KhZZlDu/5bye53nCVTcKnWd2seY
6UAdKersX6njr83Dd5OVe1BW/wJvp5EjWTAGYbFswlNmeD44edEGM939B6Lq+/8i
BkrTi8mGN4YCytivE24YI0D4XZMPfkLSpab2y/Hy4DjQKBq1ThZ0UBnK+9IhX37J
u/ZoGYSlTIGIhzyaiYBh7wrZBoPczIEu6et/kN2VnnbRUtkYTF97ggcv5h+hDpUQ
jQW0ZgOMcTc8n+RkGpIt0/iM/bTjI3Tz/gsFdi6hHcpZgbopPL630296iByyigQC
PJVzdusFrQN5DeC+zT/nGypQkZanLb4ZspSx9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GxXKrodtzS
J1YuaNkkO/YRZah285lQ6QCIhCFo4Oa4ILjgoTQISuw7nQj5ESyncauzLUBXKX0c
XDUej64KNTvVF9UXdG48fYvNmSZWCnTye4UmPu17FmwpVra38U+EdoLyWyMIAI5t
rP6Hhgc9BxOo41Im9QpTcAPfKAknP8Rbm3ACJG5T9FKq/c29d1E//eFR6SL51e/a
yWdCgJN/FJOAX60+erPwoVoRFEttAeDPkklgFGdc8F4LIYAig9gEZ92ykFFz3fWz
jIcUVLrL+IokFbPVUBoMihqVyMQsWH+5Qq9wjxf6EDIf0BVtm9U4BJoOkPStFIfF
Kof7OVv7izyL8R/GIil9VQs9ftwkIUPeXx2Hw0bE3HJ3C8K4+mbLg3tKhGnBDU5Z
Xm5mLHoCRBa3ZRFWZtigX7POszdLAzftYo8o65Be4OtPS+tQAORk9gHsXATv7dDB
OGw61x5KA55LHVHhWaRvu3J8E7nhxw0q/HskyZhDC+Y+Xs6vmQSb4nO4ET4NYX1P
m3PMdgGoqRDJ2jZw4eoQdRKCM0EHSepSAYpO1tcAXhPZS4ITogoRgPpVgOebEQUL
nKNeNu/BxMSH/IH15jjDLF3TiEoguF9xdTaCxIBzE1SFpVO0u9m9vXpWdPThVgsb
VcEI487p7v9iImP3BYPT8ZYvytC26EH0hyOrwhahTvTb4vXghkLIyvPUg1lZHc6e
aPHb2AzYAHLnp/ehDQGKWrCOJ1JE2vBv8ZkLa+XZo7YASXBRZitPOMlvykEyzxmR
QAmNhKGvFmeM2mmHAp0aC03rgF3lxNsXQ1CyfEdq3UV9ReSnttq8gtrJfCwxV+wY
-----END RSA PRIVATE KEY-----
`.trim();
  const keyFile = join(realpathSync(mkdtempSync(join(tmpdir(), "key"))), "key.pem");
  await Bun.write(keyFile, "\n" + keyFileContents + "\n");

  const certFile = join(realpathSync(mkdtempSync(join(tmpdir(), "cert"))), "cert.pem");
  await Bun.write(certFile, "\n" + certFileContents + "\n");

  symlinkSync(keyFile, keyFile + ".link");
  symlinkSync(certFile, certFile + ".link");
  server = Bun.serve({
    keyFile,
    certFile,
    fetch(req) {},
  });
  server.stop(true);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node.js Compatibility with Node.js APIs
Projects
None yet
Development

No branches or pull requests

3 participants