# \#GP4 tester error

**URL:** https://forum.codecrafters.io/t/gp4-tester-error/6831
**Category:** Challenges
**Tags:** challenge:shell
**Created:** [March 15, 2025, 5:54pm UTC](https://forum.codecrafters.io/t/gp4-tester-error/6831 "2025-03-15T17:54:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![amarjen](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/amarjen/32/3916_2.png) [@amarjen](https://forum.codecrafters.io/u/amarjen)
#### Post date: [March 15, 2025, 5:54pm UTC](https://forum.codecrafters.io/t/gp4-tester-error/6831/1 "2025-03-15T17:54:54Z")

</div>

Hello,

I’m having issue passing #GP4 but not sure why.

If I do codecrafter test , it goes well with this output:

```auto
[tester::#GP4] Running tests for Stage #GP4 (Navigation - The cd builtin: Home directory)
[tester::#GP4] Running ./your_program.sh
[your-program] $ cd /tmp/grape/strawberry/strawberry
[your-program] $ pwd
[your-program] /tmp/grape/strawberry/strawberry
[tester::#GP4] Received current working directory response
[your-program] $ cd ~
[your-program] $ pwd
[your-program] /tmp/apple/pear/apple
[tester::#GP4] Received current working directory response
[your-program] $
[tester::#GP4] Test passed.
```

Then, I do codecrafter submit, and it throws a weird result:

```auto
[tester::#GP4] Running tests for Stage #GP4 (Navigation - The cd builtin: Home directory)
[tester::#GP4] Running ./your_program.sh
[your-program] $ cd /tmp/mango/grape/grape
[your-program] $ pwd
[your-program] /tmp/mango/grape/grape
[tester::#GP4] Received current working directory response
[your-program] $ cd ~
[your-program] $ pwd
[your-program] malloc(): invalid size (unsorted)
[tester::#GP4] Output does not match expected value.
[tester::#GP4] Expected: "/tmp/raspberry/pear/pineapple"
[tester::#GP4] Received: "malloc(): invalid size (unsorted)"
[tester::#GP4] Assertion failed.
[tester::#GP4] Test failed
```

I’m doing something wrong, or the tester has a bug?

Thanks,

---

<div class="post-metadata">

### Author: ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)
#### Post date: [March 16, 2025, 1:58pm UTC](https://forum.codecrafters.io/t/gp4-tester-error/6831/4 "2025-03-16T13:58:00Z")

</div>

Hey @amarjen, it was likely a tester bug that allowed the code to pass the first time.

Passing `~` directly into `chdir` will not work as expected:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/8/8b48c7af53844bc108020d28ae184e7b8bb12c6c.png)

You’ll need to expand `~` to the full path for `chdir` to work properly.

Let me know if you’d like further clarification!

---

<div class="post-metadata">

### Author: ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)
#### Post date: [March 24, 2025, 11:11am UTC](https://forum.codecrafters.io/t/gp4-tester-error/6831/6 "2025-03-24T11:11:01Z")

</div>

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)
#### Post date: [March 29, 2025, 11:11am UTC](https://forum.codecrafters.io/t/gp4-tester-error/6831/7 "2025-03-29T11:11:56Z")

</div>

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