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

Error: No such file or directory (os error 2) #147

Closed
ibnishak opened this issue Sep 9, 2021 · 19 comments
Closed

Error: No such file or directory (os error 2) #147

ibnishak opened this issue Sep 9, 2021 · 19 comments

Comments

@ibnishak
Copy link

ibnishak commented Sep 9, 2021

OS: ArchLinux
Tinysearch version: Tried 0.6.2 and 0.6.0

What I did

  • Installed wasm-pack, terser, binaryen, and finally tinysearch
  • copied the given example file to index.json
  • ran the following variations of commands
tinysearch index.json
tinyseach "index.json"
tinesearch /absolute/path/to/index.json

All of them gave the following output

Unpacking tinysearch WASM engine into temporary directory "/tmp/.tmpk894cL"
Start unpack
Copying index into crate
Error: No such file or directory (os error 2)

Kindly advice as to what other info would be useful

@mre
Copy link
Member

mre commented Sep 9, 2021

Huh, it looks like the engine is not statically included inside the tinysearch binary. Maybe I broke something during the last release... 🤔

@blackary
Copy link

blackary commented Oct 5, 2021

Any updates on this?

@mre
Copy link
Member

mre commented Oct 26, 2021

@blackary did you run into the same issues? Any additional output you could provide to narrow this down a little? Sorry for the late response.

@blackary
Copy link

@mre Nothing much to add -- I used my own index.js, and got pretty much the same response:

tinysearch index.js
Unpacking tinysearch WASM engine into temporary directory "/var/folders/1r/hd1d6v0s7hx68wnb2y1_9pd40000gn/T/.tmpt9tVy4"
Start unpack
Copying index into crate
Error: No such file or directory (os error 2)

@siuying
Copy link

siuying commented Nov 3, 2021

@mre I saw same error messages when installing the cargo. When building from source, I see error message Error: failed to run "wasm-pack", and later Error: wasm32-unknown-unknown target not found. After I install both I can use this copy of tinysearch, but if I reinstall tinysearch from cargo I'd still get the same error.

@expilo
Copy link
Contributor

expilo commented Nov 29, 2021

Same issue here.
OS: Ubuntu 21.10
wasm-pack 0.10.1
tinysearch 0.6.2

@AlexMikhalev
Copy link

Bump:

./target/release/tinysearch fixtures/index.json
Unpacking tinysearch WASM engine into temporary directory "/tmp/.tmpZTOX8N"
Starting unpack
Copying "../engine/src/lib.rs"
Copying "../engine/Cargo.toml"
Copying "../shared/.gitignore"
Copying "../engine/.gitignore"
Copying "../shared/src/lib.rs"
Copying "../shared/Cargo.toml"
Copying index into crate
Error: Invalid cross-device link (os error 18)

tinysearch from master git log -1

Author: Matthias <matthias-endler@gmx.net>
Date:   Thu Sep 9 13:30:31 2021 +0200

    Update FUNDING.yml

wasm-pack 0.10.1
Ubuntu 21.10 (PopOS!)
binaryen is version (91-1) from apt.

@blakehawkins
Copy link

blakehawkins commented Dec 23, 2021

0.6.2 release is not working for me either, but current head of master branch works

I think that this fixed it.

@mre I recommend to make a new cargo release 0.6.3

@mre
Copy link
Member

mre commented Dec 29, 2021

Oh! Sorry, I forgot to release 0.6.3 with the patch. Apologies.
Released v0.6.3 now. Also added some pre-built binaries to make installation a little easier and quicker. If anyone could test it and report back that would be very helpful. At least on my homepage it works with that version.

@blakehawkins
Copy link

blakehawkins commented Jan 3, 2022

0.6.3 is not working for me:

...
Starting unpack
Name: /home/blake/workspace/myproject/storage
Name: /home/blake/workspace/myproject/.gitignore
Name: /home/blake/workspace/myproject/.sass-cache
Name: /home/blake/workspace/myproject/docker-compose.yml
Name: /home/blake/workspace/myproject/README.md
Name: /home/blake/workspace/myproject/.git
Name: /home/blake/workspace/myproject/assets
Name: /home/blake/workspace/myproject/Gemfile.lock
Name: /home/blake/workspace/myproject/404.md
Name: /home/blake/workspace/myproject/Gemfile
Name: /home/blake/workspace/myproject/_config.yml
Name: /home/blake/workspace/myproject/.github
Name: /home/blake/workspace/myproject/_pages
Name: /home/blake/workspace/myproject/CNAME
Name: /home/blake/workspace/myproject/_layouts
Name: /home/blake/workspace/myproject/_sass
Name: /home/blake/workspace/myproject/index.md
Name: /home/blake/workspace/myproject/images
Name: /home/blake/workspace/myproject/tmp
Name: /home/blake/workspace/myproject/_site
Name: /home/blake/workspace/myproject/_includes
Error: Engine directory could not be created at /tmp/.tmpZGQ8M1/engine

Is it possible that the cargo publish release is missing this binary data?

.dir("../engine", Compression::Gzip)

I don't see any of

println!("Copying {:?}", file);

Edit: I forgot to specify that I used cargo install tinysearch, not prebuilt binary from tags page

@mre
Copy link
Member

mre commented Jan 7, 2022

Could be, yeah. Reading through the source code of includedir, it writes the output to an out_file:
https://github.com/tilpner/includedir/blob/6a81c906e233649af1acec9835fe0a034b9274e2/codegen/src/lib.rs#L118-L149
Limited time right now, but maybe this file has to be included somewhere to make it into the release build?

At least the pre-built binary seems to work for my blog:
https://github.com/mre/endler.dev/runs/4657973699?check_suite_focus=true#step:11:16

Same for 0.6.3 installed with cargo install:
https://github.com/mre/endler.dev/runs/4718539058?check_suite_focus=true#step:11:18

Can you try one of the pre-built binaries for comparison?
And if you have an idea where the binary data has to be added to make it work, that would also be greatly appreciated.

@mre
Copy link
Member

mre commented Jan 7, 2022

This is where it fails for you:

tinysearch/bin/src/main.rs

Lines 93 to 102 in 18b0dc5

let engine_dir = temp_dir.path().join("engine");
if !engine_dir.exists() {
for path in fs::read_dir(out_path)? {
println!("Name: {}", path.unwrap().path().display())
}
bail!(
"Engine directory could not be created at {}",
engine_dir.display()
);
}

It tries to unpack the engine code and if that directory doesn't exist after that, it means there was an error.

So I wonder what's above

...
Starting unpack
Name: /home/blake/workspace/myproject/storage
Name: /home/blake/workspace/myproject/.gitignore
...

in your output. This is where it unpacks the engine code and prints the path.
Is this running locally or inside Github Actions? If it's local, can you check that the path exists and looks fine? If not, is the directory writeable?

@blakehawkins
Copy link

@mre thanks for taking a look.

So I wonder what's above

It's just:

Unpacking tinysearch WASM engine into temporary directory "/tmp/.tmp3fYKc5"
Starting unpack
Name: /home/blake/workspace/myproject/storage
...

Is this running locally or inside Github Actions?

Local.

If it's local, can you check that the path exists and looks fine?

The temp directory doesn't exist, but /tmp/ is writeable:

$ file /tmp/
/tmp/: sticky, directory
$ file /tmp/.tmp3fYKc5/
/tmp/.tmp3fYKc5/: cannot open `/tmp/.tmp3fYKc5/' (No such file or directory)
$ [ -w /tmp/ ]
$ echo $?
0

The weird thing for me is still that there are none of these:

println!("Copying {:?}", file);

@keyneom
Copy link

keyneom commented Jan 19, 2022

I'm running into the same issue locally:

Unpacking tinysearch WASM engine into temporary directory "/tmp/.tmpVHlnPa"
Starting unpack
Name: [absolute path]/public/search/tinysearch_engine.js
Name: [absolute path]/public/search/tinysearch_engine_bg.wasm
Error: Engine directory could not be created at /tmp/.tmpVHlnPa/engine

I've tried downloading the source and building tinysearch locally (both debug and release mode) and both the locally built versions seemed to run successfully. Only when using the cargo installed version of tinysearch do I get the error above.

@mre
Copy link
Member

mre commented Mar 25, 2022

I created a pull request here: #154.
If someone could test this and report back I'd be very thankful.

@Jieiku
Copy link
Collaborator

Jieiku commented Apr 9, 2023

I just tested from a fresh install today, no issues.

@mre
Copy link
Member

mre commented Apr 12, 2023

Can you try again using cargo install tinysearch? I think that's what people have problems with.

@Jieiku
Copy link
Collaborator

Jieiku commented Apr 13, 2023

see here: #151 (comment)

@mre
Copy link
Member

mre commented Jul 27, 2023

This is resolved now.

The reason why it broke was a limitation by cargo: it does not allow including one crate inside another one. This is done to avoid unwanted complexity and is a sane default. In our case, however, it leads to the situation that the engine crate was missing from the tinysearch crate on crates.io.
See also #170 (comment).

The latest tinysearch 0.8.2 fixes this issue. Apologies for the long delay to produce a fix.

@mre mre closed this as completed Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants