Configuration file becomes blank for an unknown reason.


Joined
Apr 8, 2007
Messages
436
I've been making the PND for the latest ReisdualVM and one issue/bug I am having is that the configuration file sometimes becomes blank.. even if the PND is not run... it often happens after using Residual then taking the memory card out then putting the memory card back in..


the configuration file is still fine before I eject the card... but when I put the card back in and have a look at the file.. it just becomes blank.


Here is the shell script for the PND:



Code:
#!/bin/sh

export PATH="/mnt/utmp/residualvm/bin:${PATH:-"/usr/bin:/bin:/usr/local/bin"}"

export LD_LIBRARY_PATH=":${LD_LIBRARY_PATH:-"/usr/lib:/lib"}"

export HOME="/mnt/utmp/residualvm" XDG_CONFIG_HOME="/mnt/utmp/residualvm"

if [ -d /mnt/utmp/residualvm/share ];then

export XDG_DATA_DIRS=/mnt/utmp/residualvm/share:$XDG_DATA_DIRS:/usr/share

fi

export SDL_AUDIODRIVER="alsa"

cd $HOME

if [ ! -f residualvm.config ] ; then

cp .residualvmrc residualvm.config

fi

mkdir -p saves

[ -e "$HOME/scripts/pre_script.sh" ] && . $HOME/scripts/pre_script.sh

if [ -e "$HOME/scripts/post_script.sh" ];then

residualvm $*

. $HOME/scripts/post_script.sh

else

exec residualvm -c residualvm.config $*

fi



and here is a CRUDE video recording of it actually happening:

https://www.youtube.com/embed/dr6QJ7ErkVo?feature=oembed

I've attached the current PND..


Maybe it is something dead obvious I am missing.. maybe there is some weird bug in the RAM from ResidualVM..

residualvm-op(1).pnd
 

Attachments

  • residualvm-op(1).pnd
    5.3 MB · Views: 218
Last edited by a moderator:
Well been trying to investigate more and I can get it down to a patten where it happens all the time.


1st I start ResidualVM via the desktop,, then I close it.


Then I start ResidualVM via the menu... then I close it.


Then if I take the memory card out and put it in another device (my computer) I look at the appdata folder and it's already been blanked... so something seems to happen when I open ResidualVM via another method..


is this some weird Pandora bug I have found? However I've not been able to replicate it on any other software.
 
Last edited by a moderator:
Not sure, but it might be this:


By looking at your script it seems like you jump into the directory of the mounted PND, but do not jump out of it at the end of the script (for example by writing "cd /tmp/").


Because of this it's possible that the PND can not be clearly unmounted. You can test this by running ResidualVM, ending it, opening a terminal and typing "mount". You should not see any entry like "/mnt/utmp/residualvm". If you see such an entry, then the pnd is still mounted.


And if you remove the SD-card without the PND being clearly unmounted then some cache-buffer might not have been written to the SD-card. And because of this the file is blank.


Not sure if this is the source of the problem, but worth a try.

or maybe the "exec" is the problem. Try without it. I'm not sure if you need it.
 
Last edited by a moderator:
Sadly no luck with either of those things... :/ added "cd /tmp/" to the end and removed "exec".. the configuration file still sometimes blanks out when the card is ejected..


maybe there is some weird hardware issue going on.. but it's just on this one file... so that doesn't make sense..


so maybe it's just a bug in residualvm itself and something left in the RAM..?


I need someone to see if happens on their pandora...
 
Last edited by a moderator:
did you try to run the "mount"-command afterwards anyway? Would be good to know if the pnd is cleanly unmounted no matter what causes it.
 
Please edit the thread title ;)

took me a few seconds to realise what you meant.. XD

did you try to run the "mount"-command afterwards anyway? Would be good to know if the pnd is cleanly unmounted no matter what causes it.

Ok.. with a fresh memory card.

  • Rebooted Pandora.
  • output of "mount" shows no mention of ResidualVM
  • double clicked ResidualVM on the desktop
  • ResidualVM loads
  • output of "mount" shows: /dev/loop0 on /mnt/utmp/residualvm type squashfs (ro, relatime) none on /mnt/utmp/residualvm type aufs (rw,relatime,si=44779e91,noplink)
  • I quit ResidualVM
  • output of "mount" shows no mention of ResidualVM
  • clicked on ResidualVM in the menu
  • ResidualVM loads
  • output of "mount" shows: /dev/loop0 on /mnt/utmp/residualvm type squashfs (ro, relatime) none on /mnt/utmp/residualvm type aufs (rw,relatime,si=4467e791,noplink)
  • I quit ResidualVM
  • output of "mount" shows no mention of ResidualVM
  • I eject the memory card and reinsert it.
  • the config file is now 0B
 
then the issue is obviously not related to some clean unmounting as that seems to work fine.


Something I noticed that I myself do not understand, but which probably still is correct:



Code:
[ -e "$HOME/scripts/pre_script.sh" ] && . $HOME/scripts/pre_script.sh


I do understand the first half of that line, but what's the "." after the "&&" for?
 
It's mostly an auto generated script.. that I havn't touched too much...


but I just cut it down to more basics... and the code is now just:



Code:
#!/bin/sh

export PATH="/mnt/utmp/residualvm/bin:${PATH:-"/usr/bin:/bin:/usr/local/bin"}"

export LD_LIBRARY_PATH=":${LD_LIBRARY_PATH:-"/usr/lib:/lib"}"

export HOME="/mnt/utmp/residualvm" XDG_CONFIG_HOME="/mnt/utmp/residualvm"


cd $HOME


if [ ! -f residualvm.config ] ; then

cp .residualvmrc residualvm.config

fi

mkdir -p saves


residualvm -c residualvm.config $*

cd /tmp/


I'm not sure if/or what exports are needed so left those ones.. but I still have the same issue..
 
Last edited by a moderator:
what if you copy the configfile to another file after ending the program? is that file erased at sdcard removal, too or could you copy that file back to the original one on next startup?


would only be a workaround but could solve it until you find the real problem.
 
It was a good idea and I tried it but it still does blank out.. both the backup and the config.. even told the backup to move to the saves directory in case it was some issue with being in the root of the pnd..


Edit: I'm going to reflash my Pandora... just incase
 
Last edited by a moderator:
OK I think I have worked out the reason, as I have done a few tests.


Essentially if a file (any file) is created on the Pandora on the SD card then the file is added to the file index on the SD card. However the contents of that file are not fully written until a certain time has elapsed.. (maybe a minute?) .


I created a new text document on the card and just wrote the words "test" in it... saved it.. then waited 10 seconds.. and ejected the memory card... inserted it back in.. and the file was there.. but it was totally blank.


So I tried another test.. and I opened up scummvm... loaded a game (monkey island 3) and saved it.. let it save.. then quit scummvm.. then ejected the memory card... I put the card back in.. and had a look to see what happened.. and the save file was there.. but it was an "invalid save file" in scummvm..


So essentially there wasn't any problem with my PND, just when testing it, ejecting and inserting it I created a situation which caused the files to not properly save as I wasn't leaving the card in long enough..


Most of the time this shouldn't be an issue.. but it might be a pain if someone is in a middle of a game..(on any application) or just makes a quick note.. and then has to eject the memory card.. for whatever reason.. as the files wont have saved properly.
 
Last edited by a moderator:
Add a "sync" in there; I imagine there should be a sync when the pnd exits, but maybe there isn't (I got 4 hours sleep in the last 2 days, don't listen to me ;)


Anyway, it sure sounds like a sync is not occuring prior to your ejecting the card.


1) check the /tmp/pndrun output for your job, make sure theres no errors coming out


2) try syncing and unmounting the card, then ejecting it .. probably no file loss then. ("sync" at a shell, for one way)


3) if there _is_ lossage after sync and unmount clean, then its something else, app doing something like write/fsetpos/write or something :p


Hmm, its possible current pnd_run doesn't do a sync at the end, but it might be wise; I thoguht we did.


jeff


ie: Could also check the mount options for FAT .. you can set FAT to not cache at all, which we used to, but I think due to request we started enabling cache on SD mounts for performance sake, at the risk that you should likely unmount cleanly before ripping it out, or wait a bit after writing to it. (This effects all devices by the way.. a device either has uncached writes or has cached writes and requires users to not act crazy.)
 
Last edited by a moderator:
Back
Top