Retroarch: Retroarch CLI does not handle tilde (~) expansion properly for `--libretro` argument

Created on 23 Jun 2020  路  4Comments  路  Source: libretro/RetroArch

Description

Retroarch CLI does not handle tilde (~) expansion properly for --libretro argument. I have not thoroughly checked other arguments, but --config does also seem affected. Using -L instead of --libretro works as expected.

Expected behavior

It should handle tilde expansions properly.

Actual behavior

Commands used:

# This craps out
/usr/bin/retroarch --libretro=~/.config/retroarch/cores/mednafen_psx_hw_libretro.so psxgame.iso

# This works perfectly
/usr/bin/retroarch --libretro=/home/user/.config/retroarch/cores/mednafen_psx_hw_libretro.so psxgame.iso

# This also works
/usr/bin/retroarch -L ~/.config/retroarch/cores/mednafen_psx_hw_libretro.so psxgame.iso

This is the error log:

[ERROR] Frontend is built for dynamic libretro cores, but path is not set. Cannot continue.
[ERROR] Fatal error received in: "init_libretro_symbols()"

Steps to reproduce the bug

Run retroarch on the command line with --libretro argument and specify a "tilde-d" path within your home directory. Please refer to the commands I used above.

Version/Commit

  • RetroArch: Frontend for libretro -- v1.8.8 -- 9552f87 --

Environment information

  • OS: Pop!_OS 20.04 LTS 5.4.0-7634-generic
  • Compiler: GCC (9.3.0) 64-bit Built: Jun 1 2020

Most helpful comment

The problem of this case:

# This craps out
/usr/bin/retroarch --libretro=~/.config/retroarch/cores/mednafen_psx_hw_libretro.so psxgame.iso

Is that there is a = symbol directly in front of the ~. The tilde only works when there is a blank before it:

$ echo ~/
/home/user/
$ echo =~/
=~/

Perhaps you want this?

/usr/bin/retroarch --libretro ~/.config/retroarch/cores/mednafen_psx_hw_libretro.so psxgame.iso

EDIT: for completeness, note that variable assignment does work (even though is not related to the issue):

$ some=~/
$ echo $some
/home/user/

All 4 comments

Parameter expansion is supposed to be the shell job so i have little clue why yours is screwing up. It probably shouldn't, but regardless, this is the definition of 'not a (retroarch) bug'.

Are you sure you're not single quoting on the cases it fails?

The problem of this case:

# This craps out
/usr/bin/retroarch --libretro=~/.config/retroarch/cores/mednafen_psx_hw_libretro.so psxgame.iso

Is that there is a = symbol directly in front of the ~. The tilde only works when there is a blank before it:

$ echo ~/
/home/user/
$ echo =~/
=~/

Perhaps you want this?

/usr/bin/retroarch --libretro ~/.config/retroarch/cores/mednafen_psx_hw_libretro.so psxgame.iso

EDIT: for completeness, note that variable assignment does work (even though is not related to the issue):

$ some=~/
$ echo $some
/home/user/

Does retroarch expand paths in the config files btw?

I know that the shell is the one handling expansion, and I am aware of the alternatives recommended by @hhromic, but I was under the impression that the actual parsing of command line arguments and values are up to the programmers' discretion as well.

In any case, my mistake was my false memories of instances like --arg=~/value working as expected. When I tried it on other commands, they did not work, so I guess it is normal for programmers not to support the handling of tilde's in those cases. Anyway, thank you for your help. I will close this issue now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

parkerlreed picture parkerlreed  路  3Comments

RobLoach picture RobLoach  路  3Comments

orbea picture orbea  路  3Comments

alki-apps picture alki-apps  路  3Comments