Unclear instructions surrounding path resolution on #IP1

I’m stuck on Stage #IP1.

I think I might be misunderstanding something or have missed a step somewhere, It mentions that the executable should be found in the path, but the test executable is in a /tmp/ directory. It also doesn’t seem to exist on my machine but that might be because the tester removes it before I can see it.

I got the tests to pass by implementing a full path check after failing to find the exe on the path fails, but the directions don’t indicate I should need to do that. Is there an issue here or have I missed something?

2 Likes

I faced the same problem here.

Worked around that problem by checking if the command is executable if it is not in the path.

Yeah I also worked around it by trying it as an absolute path if it’s not in the PATH but the instructions implied it should’ve already been there.

2 Likes

Thanks for highlighting this everyone! Definitely a mismatch between tests & instructions here - I think we initially intended to test one thing but must’ve changed along the way for some reason.

I’m going to wait for @ryan-gang to wake up so I can ask him if we had a specific reason to go with one over the other. After that we’ll either fix either the instructions or the tests!

We’re updating the tester! PR here: Pass exe name instead of full path in run test by ryan-gang · Pull Request #18 · codecrafters-io/shell-tester · GitHub. Should be deployed soon

This is fixed now!

Previously we were passing the full path (i.e. /tmp/foo/my_exe arg) , now we just run my_exe arg , and my_exe will be present in PATH.

I am having trouble finding the executable and am unsure whether its on my end or not. Running ls -R /tmp/ shows that the /tmp/fruit/fruit/fruit/ directory is empty, is this not where my_exe should be?

Here is the full output of my program which just prints the output of ls -R /tmp/ :

[tester::#IP1] Running tests for Stage #IP1 (Run a program)
[tester::#IP1] Running ./your_shell.sh
[your-program] /tmp/:
[your-program] codecrafters-shell-target
[your-program] go-build498371273
[your-program] go-build524240018
[your-program] strawberry
[your-program] test-run2844824492
[your-program]
[your-program] /tmp/codecrafters-shell-target:
[your-program] CACHEDIR.TAG
[your-program] release
[your-program]
[your-program] /tmp/codecrafters-shell-target/release:
[your-program] build
[your-program] deps
[your-program] examples
[your-program] incremental
[your-program] shell-starter-rust
[your-program] shell-starter-rust.d
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/build:
[your-program] anyhow-1e352edcb8dfbf5c
[your-program] anyhow-a152da5b52ccf273
[your-program] proc-macro2-085ffb844e20729e
[your-program] proc-macro2-2ea58b3c8269c9c6
[your-program] thiserror-1ce144b0733d0229
[your-program] thiserror-79ac027c908e4dad
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/build/anyhow-1e352edcb8dfbf5c:
[your-program] build-script-build
[your-program] build_script_build-1e352edcb8dfbf5c
[your-program] build_script_build-1e352edcb8dfbf5c.d
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/build/anyhow-a152da5b52ccf273:
[your-program] invoked.timestamp
[your-program] out
[your-program] output
[your-program] root-output
[your-program] stderr
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/build/anyhow-a152da5b52ccf273/out:
[your-program] anyhow.d
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/build/proc-macro2-085ffb844e20729e:
[your-program] build-script-build
[your-program] build_script_build-085ffb844e20729e
[your-program] build_script_build-085ffb844e20729e.d
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/build/proc-macro2-2ea58b3c8269c9c6:
[your-program] invoked.timestamp
[your-program] out
[your-program] output
[your-program] root-output
[your-program] stderr
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/build/proc-macro2-2ea58b3c8269c9c6/out:
[your-program] proc_macro2.d
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/build/thiserror-1ce144b0733d0229:
[your-program] invoked.timestamp
[your-program] out
[your-program] output
[your-program] root-output
[your-program] stderr
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/build/thiserror-1ce144b0733d0229/out:
[your-program] thiserror.d
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/build/thiserror-79ac027c908e4dad:
[your-program] build-script-build
[your-program] build_script_build-79ac027c908e4dad
[your-program] build_script_build-79ac027c908e4dad.d
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/deps:
[your-program] anyhow-3fca6204e97cc146.d
[your-program] bytes-175ef7f639dc9387.d
[your-program] libanyhow-3fca6204e97cc146.rlib
[your-program] libanyhow-3fca6204e97cc146.rmeta
[your-program] libbytes-175ef7f639dc9387.rlib
[your-program] libbytes-175ef7f639dc9387.rmeta
[your-program] libproc_macro2-7a217364744e0fab.rlib
[your-program] libproc_macro2-7a217364744e0fab.rmeta
[your-program] libquote-96c2cb863daef7e7.rlib
[your-program] libquote-96c2cb863daef7e7.rmeta
[your-program] libsyn-ec65543b7ff1e5a3.rlib
[your-program] libsyn-ec65543b7ff1e5a3.rmeta
[your-program] libthiserror-a4a6e36992d401cf.rlib
[your-program] libthiserror-a4a6e36992d401cf.rmeta
[your-program] libthiserror_impl-2bf23e3fdf6c1f21.so
[your-program] libunicode_ident-356ca83e39e30310.rlib
[your-program] libunicode_ident-356ca83e39e30310.rmeta
[your-program] proc_macro2-7a217364744e0fab.d
[your-program] quote-96c2cb863daef7e7.d
[your-program] shell_starter_rust-14a34e66cdf1f835
[your-program] shell_starter_rust-14a34e66cdf1f835.d
[your-program] syn-ec65543b7ff1e5a3.d
[your-program] thiserror-a4a6e36992d401cf.d
[your-program] thiserror_impl-2bf23e3fdf6c1f21.d
[your-program] unicode_ident-356ca83e39e30310.d
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/examples:
[your-program]
[your-program] /tmp/codecrafters-shell-target/release/incremental:
[your-program]
[your-program] /tmp/go-build498371273:
[your-program]
[your-program] /tmp/go-build524240018:
[your-program]
[your-program] /tmp/strawberry:
[your-program] strawberry
[your-program]
[your-program] /tmp/strawberry/strawberry:
[your-program] pear
[your-program]
[your-program] /tmp/strawberry/strawberry/pear:

@omuhr the executable might not be present when the shell starts, but it should be present when the command is executed. Can you try moving your logs to when you receive the command?

Here’s what the tester does:

I see. I’d been caching the executables in PATH at shell-start, running a check at the time the command is run works :slight_smile:

Thanks!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.