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

filepath.walk does not work on Linux #2793

Closed
laytan opened this issue Sep 9, 2023 · 1 comment · Fixed by #3008
Closed

filepath.walk does not work on Linux #2793

laytan opened this issue Sep 9, 2023 · 1 comment · Fixed by #3008

Comments

@laytan
Copy link
Sponsor Collaborator

laytan commented Sep 9, 2023

I believe the main issue is that the directory is not seen as a directory, and thats why it doesn't keep going to the other files.

package main

import "core:path/filepath"
import "core:fmt"
import "core:os"

main :: proc() {
	filepath.walk(
	".",
	proc(info: os.File_Info, in_err: os.Errno, user_data: rawptr) -> (err: os.Errno, skip_dir: bool) {
		// We only get here once, with the root directory, even though there are more files.

		assert(err == os.ERROR_NONE)

		fmt.println(info.fullpath) // /app (the root)
		fmt.println(info.is_dir)   // false (this is certainly a directory)
		return
	}, nil)
}

Dockerfile I used to test it (and make sure it wasn't my os)

FROM alpine:latest

WORKDIR /odin

ENV PATH "$PATH:/usr/lib/llvm14/bin:/odin"

RUN apk add --no-cache git bash make clang14 llvm14-dev musl-dev linux-headers

RUN git clone --depth=1 https://github.com/odin-lang/Odin . && \
	LLVM_CONFIG=llvm14-config make

WORKDIR /app

# random file, doesn't get a call in the walk
RUN echo "testing" > testing123.txt

# the file above
COPY test.odin test.odin

CMD ["odin", "run", "test.odin", "-file"]
@laytan
Copy link
Sponsor Collaborator Author

laytan commented Sep 12, 2023

Weird stuff, I made this issue when I built/ran the docker image from my mac machine, and it does not work there (verified again right now).

Just tried the exact same Dockerfile built/ran on my Linux machine and it does work.

So much for reproducibility of Docker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants