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

Building a package at the filesystem root causes... Weirdness? #4305

Open
kawaii-Code opened this issue Sep 25, 2024 · 0 comments
Open

Building a package at the filesystem root causes... Weirdness? #4305

kawaii-Code opened this issue Sep 25, 2024 · 0 comments

Comments

@kawaii-Code
Copy link

Steps to Reproduce

Windows

Make an odin file at C:\

Run cmd as administrator at C:\

odin build .

This will output a peculiar empty file C without any extensions

image

(Which is kinda hilarious)

Interestingly, odin run . works fine, as well as -file variants.

Linux

# As root
cat > /main.odin << EOF
package main

import "core:fmt"

main :: proc() {
    fmt.println("Hellope!")
}
EOF
cd / && odin build .

Here, the crash is more straightforward:

src/build_settings.cpp(1828): Assertion Failure: `build_project_name.len > 0`

Note: this also works without any odin files, just launching odin build . or odin run . at / is enough.

Context

        Odin:    dev-2024-09:791b05b
        OS:      Windows 10 Professional (version: 22H2), build 19045.4894
        CPU:     AMD Ryzen 7 5800X 8-Core Processor
        RAM:     32711 MiB
        Backend: LLVM 18.1.8

Notes

The bug obviously occurs because while building a package, odin tries to use the parent directory name as the name for the executable. At the root, there is no parent. So, here is the bug.

My issue isn't really about wanting to make a package at filesystem root, that's weird. It's more about using the parent directory name for the executable name. Why do this? We already have the package name and, unlike go, the package doesn't have to be main. I usually call the package the same as the project. Is there any reason for using parent directory name?

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

1 participant