feat(libc): implement dirname #1761

Closed
MarcZX10 wants to merge 1 commit from upstream-pr/1761 into main
MarcZX10 commented 2026-10-08 18:39:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T18:39:38Z.


What

Implement the missing dirname path operation with FreeBSD-style handling of empty paths, trailing slashes, root paths, and paths without a parent component. The missing import is listed in #1578.

Tested

Linux: built libc and guest_string_tests; ctest --test-dir build -R '^guest_strings$' --output-on-failure passed. python3 tools/check_conventions.py --base upstream/main passed. Windows and PS5 hardware not tested.

Checklist

  • Based on current main; no other open PR implements this function
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no stub added
  • No notes, investigation files or images added
  • No third-party code added
  • Generic behavior
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4791262209 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1761). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-08T18:39:38Z. --- ### What Implement the missing `dirname` path operation with FreeBSD-style handling of empty paths, trailing slashes, root paths, and paths without a parent component. The missing import is listed in #1578. ### Tested Linux: built `libc` and `guest_string_tests`; `ctest --test-dir build -R '^guest_strings$' --output-on-failure` passed. `python3 tools/check_conventions.py --base upstream/main` passed. Windows and PS5 hardware not tested. ### Checklist - [x] Based on current `main`; no other open PR implements this function - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no stub added - [x] No notes, investigation files or images added - [x] No third-party code added - [x] Generic behavior - [x] Depends on: none - [x] AI-assisted: yes
oneandonlydean commented 2026-10-08 19:22:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T19:22:13Z.


No title reaches dirname on main yet: the homebrew audit lists the import, but those titles stop earlier at other missing imports. Closing for now; reopen when it's a title's next stop on main, with the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6067360228 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1761#issuecomment-6067360228). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T19:22:13Z. --- No title reaches `dirname` on main yet: the homebrew audit lists the import, but those titles stop earlier at other missing imports. Closing for now; reopen when it's a title's next stop on main, with the log line.
reyani-dev commented 2026-10-11 01:37:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T01:37:56Z.


@MarcZX100 dirname is now a title's next stop. Per @babyhuey's run in #3190 (with #3190–#3192 stacked on main d31b57a4, sce_module/libc.prx unwrapped), Porpoise (PPSA99764) gets past asinh and stops at dirname (E4wZaG1zSFc):

  • Linux: app.elf: symbol lookup error: app.elf: undefined symbol: E4wZaG1zSFc
  • Windows: FAIL: unresolved ELF import E4wZaG1zSFc (dirname) from libSceLibcInternal.prx

dirname is still absent on main, and no open PR implements it, in case you want to resubmit this.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104263869 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1761#issuecomment-6104263869). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-11T01:37:56Z. --- @MarcZX100 `dirname` is now a title's next stop. Per @babyhuey's run in #3190 (with #3190–#3192 stacked on `main` d31b57a4, `sce_module/libc.prx` unwrapped), Porpoise (PPSA99764) gets past `asinh` and stops at `dirname` (`E4wZaG1zSFc`): - Linux: `app.elf: symbol lookup error: app.elf: undefined symbol: E4wZaG1zSFc` - Windows: `FAIL: unresolved ELF import E4wZaG1zSFc (dirname) from libSceLibcInternal.prx` `dirname` is still absent on `main`, and no open PR implements it, in case you want to resubmit this.
MarcZX10 commented 2026-10-11 04:02:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T04:02:16Z.


Thanks for the new title evidence. GitHub would not reopen #1761 after its branch was force-pushed while closed, so I submitted the rebased and validated implementation as #3261. It is the only open dirname implementation; the diff and original tests are preserved, with validation rerun against current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6105252606 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1761#issuecomment-6105252606). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T04:02:16Z. --- Thanks for the new title evidence. GitHub would not reopen #1761 after its branch was force-pushed while closed, so I submitted the rebased and validated implementation as [#3261](https://github.com/boykopovar/AnyPS5/pull/3261). It is the only open `dirname` implementation; the diff and original tests are preserved, with validation rerun against current `main`.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1761
No description provided.