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

v fails to run and generate binaries from / folder #20231

Closed
hholst80 opened this issue Dec 20, 2023 · 3 comments · Fixed by #21425
Closed

v fails to run and generate binaries from / folder #20231

hholst80 opened this issue Dec 20, 2023 · 3 comments · Fixed by #21425
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@hholst80
Copy link
Contributor

hholst80 commented Dec 20, 2023

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.

@hholst80 hholst80 added the Bug This tag is applied to issues which reports bugs. label Dec 20, 2023
@shove70
Copy link
Contributor

shove70 commented Dec 22, 2023

Indeed, the file is generated to /v/v/hello, is a bug.

@hholst80
Copy link
Contributor Author

hholst80 commented May 3, 2024

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!
/ # 

@hholst80
Copy link
Contributor Author

hholst80 commented May 4, 2024

The bug:

import os
fn main() {
  p := os.join_path("/", "test")
  assert p == "/test"
}

hholst80 added a commit to hholst80/v that referenced this issue May 4, 2024
hholst80 added a commit to hholst80/v that referenced this issue May 4, 2024
hholst80 added a commit to hholst80/v that referenced this issue May 4, 2024
hholst80 added a commit to hholst80/v that referenced this issue May 4, 2024
Closes vlang#20231

Co-authored-by: Turiiya <34311583+ttytm@users.noreply.github.com>
spytheman added a commit to spytheman/v that referenced this issue May 5, 2024
hholst80 added a commit to hholst80/v that referenced this issue May 5, 2024
Closes vlang#20231

Co-authored-by: Turiiya <34311583+ttytm@users.noreply.github.com>
hholst80 added a commit to hholst80/v that referenced this issue May 5, 2024
Closes vlang#20231

Co-authored-by: Turiiya <34311583+ttytm@users.noreply.github.com>
hholst80 added a commit to hholst80/v that referenced this issue May 5, 2024
Closes vlang#20231

On popular demand, re-added primitive support for path normalization.

Co-authored-by: Turiiya <34311583+ttytm@users.noreply.github.com>
hholst80 added a commit to hholst80/v that referenced this issue May 5, 2024
Closes vlang#20231

On popular demand, re-added primitive support for path normalization.

Co-authored-by: Turiiya <34311583+ttytm@users.noreply.github.com>
hholst80 added a commit to hholst80/v that referenced this issue May 5, 2024
Closes vlang#20231

On popular demand, re-added primitive support for path normalization.

Co-authored-by: Turiiya <34311583+ttytm@users.noreply.github.com>
spytheman added a commit to spytheman/v that referenced this issue May 6, 2024
spytheman added a commit to spytheman/v that referenced this issue May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
2 participants