v
v copied to clipboard
v fails to run and generate binaries from / folder
Describe the bug
The compiler will not generate a binary if it is invoked on a file in the root.
Reproduction Steps
/ # cat hello.v
fn main() {
println("Hello, world!");
}
/ # /v/v hello.v
/ # ls -a
. bin foo home mnt root srv usr
.. dev hello.c lib opt run sys v
.dockerenv etc hello.v media proc sbin tmp var
/ # /v/v run hello.v
No such file or directory; code: 2
/ #
Expected Behavior
It should compile a hello
binary placed in / and it should run the code in the v run hello.v
instance.
Current Behavior
Silent ignores to generate binary and No such file or directory; code 2 error message (not helpful)
Possible Solution
Fix the path assumptions that the source file is located in a sub directory.
Additional Information/Context
No response
V version
V 0.4.3 5306469
Environment details (OS name and version, etc.)
Docker container:
/ # cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.19.0
PRETTY_NAME="Alpine Linux v3.19"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
/ #
[!NOTE] You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.
Indeed, the file is generated to /v/v/hello
, is a bug.
Looks like this was a regression from v0.4.3 (744b92a)
docker run -it --rm thevlang/vlang:alpine sh
/src # cd /
/ # ln -s /opt/vlang/ v
/ # /v/v version
V 0.4.3 744b92a
/ # cat > hello.v
fn main() {
println("Hello, world!");
}
/ # /v/v hello.v
/ # stat hello
File: hello
Size: 422360 Blocks: 832 IO Block: 4096 regular file
Device: 6ah/106d Inode: 1910023 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2024-05-03 21:37:37.429283373 +0000
Modify: 2024-05-03 21:37:37.440283274 +0000
Change: 2024-05-03 21:37:37.440283274 +0000
/ # /v/v run hello.v
Hello, world!
/ #
The bug:
import os
fn main() {
p := os.join_path("/", "test")
assert p == "/test"
}