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

stat $TMPDIR/bud/cache/4Lh3YtPjLfk: not a directory #27

Closed
alecthomas opened this issue May 14, 2022 · 23 comments · Fixed by #50
Closed

stat $TMPDIR/bud/cache/4Lh3YtPjLfk: not a directory #27

alecthomas opened this issue May 14, 2022 · 23 comments · Fixed by #50

Comments

@alecthomas
Copy link

Thanks!

@codenoid
Copy link
Contributor

You could temporary use tj/gobinaries

curl -sf https://gobinaries.com/livebud/bud | sh

@alecthomas
Copy link
Author

The darwin/amd64 binaries work okay through Rosetta for now.

@alecthomas
Copy link
Author

tj/gobinaries is pretty cool though!

@alecthomas
Copy link
Author

Although it fails to work for me:

$ curl -sf https://gobinaries.com/livebud/bud | sh

  ==> Downloading github.com/livebud/bud@master
  ==> Resolved version master to v0.0.9
  ==> Downloading binary for darwin arm64

  Error downloading, got 500 response from server

@matthewmueller
Copy link
Contributor

matthewmueller commented May 14, 2022

Hey @alecthomas, thanks for stopping by! I'm a fan of your work.

I've been told it works through Rosetta emulation:

I was able to get Bud running under Rosetta 2 by starting a Rosetta2 shell: arch -arch x86_64 zsh. I have this aliased to rosetta because I need it every once in a while.

But I'll add native support for darwin/arm64 this weekend. Closing as a duplicate of #6.

@alecthomas
Copy link
Author

🙏

@matthewmueller
Copy link
Contributor

Please try again:

curl -sf curl https://raw.githubusercontent.com/livebud/bud/main/install.sh | sh

Wasn't able to test this since I'm not on an M1. I did see some V8 warnings, so let's see 😅

@alecthomas
Copy link
Author

Nice, thanks!

It does run, but it fails to serve or build with:

🐚 ~/…/hello/hello $ bud run         
| Listening on http://0.0.0.0:3000
| stat /var/folders/33/k1v9knb976dfb6s0f94qxn080000gn/T/bud/cache/4Lh3YtPjLfk: not a directory

@matthewmueller
Copy link
Contributor

Ah interesting, that shouldn't be a directory, it's actually a cached binary. Looking into it!

@alecthomas
Copy link
Author

🐚 ~/Projects/hello $ cat /var/folders/33/k1v9knb976dfb6s0f94qxn080000gn/T/bud
Internal Server Error

@alecthomas
Copy link
Author

Deleting that file fixed it, but I have no idea how it got there 🤔

@matthewmueller
Copy link
Contributor

I'll look into this after dinner 😄

@matthewmueller matthewmueller changed the title Request: provide darwin arm64 binaries stat $TMPDIR/bud/cache/4Lh3YtPjLfk: not a directory May 14, 2022
@kevwan
Copy link

kevwan commented May 14, 2022

Got the same issue.

@matthewmueller
Copy link
Contributor

matthewmueller commented May 14, 2022

Looked into it but haven't been able to repro it. A couple questions:

  1. Were the repro steps the following?

    curl -sf curl https://raw.githubusercontent.com/livebud/bud/main/install.sh | sh
    bud create hello
    cd hello
    bud run
    
  2. Were you able to reliably reproduce the error multiple times?

  3. @kevwan are you on an M1 as well?

The problem appears to be somewhere in https://github.com/livebud/bud/blob/main/internal/buildcache/buildcache.go.

What's odd is the "not a directory" error only seems to occur within an os.ReadDir: https://github.com/golang/go/blob/2580d0e08d5e9f979b943758d3c49877fb2324cb/src/cmd/go/internal/fsys/fsys.go. This makes me think there's a ReadDir happening under the hood somewhere.

@alecthomas
Copy link
Author

I suspect the error occurs with Open() when an intermediate path element is a file. eg. os.Open("/etc/passwd/foo")

@kevwan
Copy link

kevwan commented May 15, 2022

Looked into it but haven't been able to repro it. A couple questions:

  1. Were the repro steps the following?
    curl -sf curl https://raw.githubusercontent.com/livebud/bud/main/install.sh | sh
    bud create hello
    cd hello
    bud run
    
  2. Were you able to reliably reproduce the error multiple times?
  3. @kevwan are you on an M1 as well?

The problem appears to be somewhere in https://github.com/livebud/bud/blob/main/internal/buildcache/buildcache.go.

What's odd is the "not a directory" error only seems to occur within an os.ReadDir: https://github.com/golang/go/blob/2580d0e08d5e9f979b943758d3c49877fb2324cb/src/cmd/go/internal/fsys/fsys.go. This makes me think there's a ReadDir happening under the hood somewhere.

Yes, latest M1.

Maybe I can try to fix it, if you cannot reproduce it.

@matthewmueller
Copy link
Contributor

matthewmueller commented May 15, 2022

Thanks @kevwan, I think I'm unable to repro it because either it works on darwin/amd64 or because I'm still on OSX Catalina (v10.15).

I'm tempted to move the cache and tmp directories into your project's bud build directory Most people will .gitignore that directory anyways. I was thinking of doing this earlier to keep everything self-contained, but wasn't sure if it was worth cluttering up the bud directory. These problems seem to make this solution more enticing. That should fix this issue and also #30.

What do you think?

@kevwan
Copy link

kevwan commented May 15, 2022

Thanks @kevwan, I think I'm unable to repro it because either it works on darwin/amd64 or because I'm still on OSX Catalina (v10.15).

I'm tempted to move the cache and tmp directories into your project's bud build directory Most people will .gitignore that directory anyways. I was thinking of doing this earlier to keep everything self-contained, but wasn't sure if it was worth cluttering up the bud directory. These problems seem to make this solution more enticing. That should fix this issue and also #30.

What do you think?

I think self-contained is great. I think both clear architecture and better user experience are important.

If we can ship the project with the usage stable for further changes, I'd like to provide better user experience. And we improve the design later. My point is compatibility concern.

@matthewmueller
Copy link
Contributor

matthewmueller commented May 15, 2022

Would you mind pulling down the branch in the following PR and testing if this fixes your problem? #50

You can get Bud running locally by following the Contributor Guide.

@kevwan
Copy link

kevwan commented May 16, 2022

I'm still getting this error.

image

@matthewmueller
Copy link
Contributor

Ah, it looks like you're not on latest. I'm going to create a new release now, hang tight.

@matthewmueller
Copy link
Contributor

matthewmueller commented May 16, 2022

@kevwan can you try again on v0.1.3?

curl -sf https://raw.githubusercontent.com/livebud/bud/main/install.sh | sh

@kevwan
Copy link

kevwan commented May 16, 2022

Great! It's working now. Thanks!

I guess you updated v0.1.2, but it's cached by CDN.

image

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

Successfully merging a pull request may close this issue.

4 participants