libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
9.8k stars 1.78k forks source link

playlist lost when disk is full after game is started #16713

Open rofl0r opened 2 weeks ago

rofl0r commented 2 weeks ago

Description

when the disk which contains the retroarch home dir and it's lpl database files is full, loading any game will result in a deleted playlist.

Expected behavior

after loading a game from a playlist, the playlist should stay available even when the disk is currently full.

Actual behavior

after selecting a game, retroarch seems to want to update the playlist file with "number of times played" or a similar information, and when the disk is full writing the file back fails, leaving it empty.

Steps to reproduce the bug

  1. put full mame rom set (zip in zip!) on the slow SD card in your raspberry pi
  2. scan the directory containing it
  3. come back to the pi 24 hours laters when retroarch has hopefully finished writing the MAME playlist.
  4. in a terminal, type: dd if=/dev/zero of=$HOME/.config/retroarch/filler.dat bs=1M
  5. start retroarch
  6. wait until dd task finishes when disk/SD card is full
  7. select a game in your mame playlist, run it
  8. quit the game and go back to your mame playlist - it is now empty!

alternative smaller steps to reproduce

  1. create a manual playlist with 1 game
  2. continue with point 4 above

Version/Commit

You can find this information under Information/System Information

Environment information

RobLoach commented 2 weeks ago

If you have a full disk, you'll likely have lots of issues using your machine, let alone RetroArch. What is causing your disk to fill up?

rofl0r commented 2 weeks ago

needed to free up an SD card, so i mounted it and copied the roms on it to the device as root (on linux, root can access the entire storage, but regular users only 95% or so). therefore i didnt notice that i was above the "disk full for regular user quota".

most other programs are wellbehaving when ENOSPC happens - they just display an error message and stop the task they were about to do.

but really, this question appears odd as we're in rom land, where the full USA PSX romset already takes > 1 TERABYTE. many users use a dedicated rpi for retroarch, and afaik it supports only microsds up to 256gb.

btw it gets better than the above - if you exit retroarch while there's no space available and have "save settings on exit" ticked, then your entire retroarch.cfg gets wiped too. the sane thing to do before any overwrite is to atomically rename the old file to .bak or whatever, then write the new file, and if it fails move the old file back and display a notice. that would also be helpful if you try to do a savestate while the disk is full, rather than failing silently (i havent tested that yet but i'd guess that's what happens).