After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 690430 - Scores should be saved in home folders (in addition to/replacement of /var/games)
Scores should be saved in home folders (in addition to/replacement of /var/ga...
Status: RESOLVED FIXED
Product: gnome-nibbles
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-nibbles-maint
gnome-nibbles-maint
Depends on:
Blocks:
 
 
Reported: 2012-12-18 16:45 UTC by Vincent Untz
Modified: 2014-01-16 00:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Move scores from /var/games to home directory (25.11 KB, patch)
2013-11-08 05:32 UTC, Michael Catanzaro
rejected Details | Review
Move scores from /var/games to home directory (40.33 KB, patch)
2014-01-15 01:15 UTC, Michael Catanzaro
accepted-commit_now Details | Review
Move scores from /var/games to home directory (40.79 KB, patch)
2014-01-15 23:08 UTC, Michael Catanzaro
committed Details | Review

Description Vincent Untz 2012-12-18 16:45:00 UTC
+++ This bug was initially created as a clone of Bug #638425 +++

Since scores are stored in /var/games, users depend on the system administrator. For example, if the system is installed again or if users move to another computer, users can loose their scores.

Personally, I consider games scores as user data, so it would make sense to save them in home folders (or to have an option to make users able to).

The first time I lost all my scores, I was a bit disappointed, I thought they were saved in my home folder.
Comment 1 gQuigs 2013-09-16 21:21:56 UTC
Scores stopped working in a previous release and have been temporarily disabled (saving and viewing them). 

When we re-implement, I'll consider something like this structure:
In /var/games, have file gnome_nibbles_players_w_scores:
/home/bob/.local/gnome_nibbles/
/home/alice/.local/gnome_nibbles/
/anotherhome/eve/.local/gnome_nibbles/

Then store just those users scores in the .local/gnome_nibbles folders.  Obviously this would only work on a system where read access is given to other users, and I can make it check first to see if the scores stored locally would have access by everyone before writing to the gnome_nibbles_players_w_scores file. 

Any thoughts/comments to this solution?  Are we overthinking this?
Comment 2 Michael Catanzaro 2013-09-16 22:09:03 UTC
I think it's safe to assume that you can't read other users' home directories.  That's a very unconventional setup.

If we want to put scores anywhere other than ~/.local/share/gnome-nibbles, then we should probably brainstorm on the games list, so that we can implement the same thing in other games.
Comment 3 Michael Catanzaro 2013-11-08 05:32:05 UTC
Created attachment 259239 [details] [review]
Move scores from /var/games to home directory

This means we can get rid of the setguid-related code and still have
functional scores.
Comment 4 Michael Catanzaro 2013-11-08 05:35:52 UTC
Hopefully this works for you as well as it does for me. It will be really easy to port over to the remaining games keeping scores in /var/games. (Bug #690429, Bug #690431, Bug #690432).
Comment 5 Michael Catanzaro 2013-11-08 05:43:36 UTC
We still need to remove the column where you write your name (since all the scores are yours now); I haven't done that yet.
Comment 6 Michael Catanzaro 2013-11-08 05:51:50 UTC
Review of attachment 259239 [details] [review]:

I also forgot to teach it how to handle multiple game types... a fairly big oversight.  (There used to be several files to store scores for different difficulties in; now there's only one, like the Vala games, so it needs a new column to store the type.)
Comment 7 Michael Catanzaro 2014-01-15 01:15:51 UTC
Created attachment 266317 [details] [review]
Move scores from /var/games to home directory

Hey Bryan, could you review this patch to make sure it's working well for you? If you don't find anything wrong, we can commit similar patches to Robots, Tali, and Four in a Row.
Comment 8 gQuigs 2014-01-15 02:54:08 UTC
Review of attachment 266317 [details] [review]:

It worked!  This is the first time I've seen a score recorded in Nibbles in ages... Well done.
Comment 9 Michael Catanzaro 2014-01-15 15:52:53 UTC
Ah, I got the /var/games scores working for me a couple of months back... that's why I did a 3.8.1 release. Wonder why it didn't work for you.

Anyway, thanks for the review. I'll commit this later today when I get a chance to look over the other games at the same time.
Comment 10 Michael Catanzaro 2014-01-15 15:54:18 UTC
(In reply to comment #7)
> If you don't find anything wrong, we can commit similar patches to Robots,
> Tali, and Four in a Row.

I also need to hit Five or More.
Comment 11 Michael Catanzaro 2014-01-15 17:18:51 UTC
The width of the scores column is too big: it should be split roughly half-and-half between Date and Score. I've been having trouble figuring out where this is set (surely in GamesScoreDialog somewhere); if you have time, you could look into this.
Comment 12 Michael Catanzaro 2014-01-15 19:58:41 UTC
(In reply to comment #11)
> The width of the scores column is too big: it should be split roughly
> half-and-half between Date and Score. I've been having trouble figuring out
> where this is set (surely in GamesScoreDialog somewhere); if you have time, you
> could look into this.

Got it.

Next regression is that we don't highlight the newest score anymore, but we can fix that later.
Comment 13 Michael Catanzaro 2014-01-15 21:37:20 UTC
Haven't pushed yet because I discovered it's really crashy. :(  Working on it....
Comment 14 Michael Catanzaro 2014-01-15 23:08:01 UTC
I was mixing up fseek() and lseek()... that do be bad.

The following fix has been pushed:
6001f68 Move scores from /var/games to home directory
Comment 15 Michael Catanzaro 2014-01-15 23:08:04 UTC
Created attachment 266416 [details] [review]
Move scores from /var/games to home directory

The score system was originally designed for multi-user systems where
storing scores in a central location allowed different users on the same
computer at different times to compete amongst each other for high
scores. This might still be fun in a computer lab, but nowadays most
users have individual machines, and we are more concerned about ensuring
a user's scores are his own data, on his home partition, to remain even
after blowing away / for an OS upgrade.

All of the modernized games have already switched to scores in the home
directory: time for the rest to do so as well.

Also, I get to delete a lot of code, and that's fun.
Comment 16 Michael Catanzaro 2014-01-16 00:46:06 UTC
(In reply to comment #7) 
> Hey Bryan, could you review this patch to make sure it's working well for you?
> If you don't find anything wrong, we can commit similar patches to Robots,
> Tali, and Four in a Row.

Four in a Row doesn't save scores