Menu

#93 [lbreakouthd] Flatpak version does not save high scores

None
closed-fixed
nobody
None
5
2023-01-28
2023-01-05
Alex
No

I have only Flatpak version for my distro, and it fails to use high score table:

Loading hiscores /app/var/lbreakouthd.hscr
...blah blah blah...
ERROR: hiscores.cpp:133: save(): Could not open hiscores file /app/var/lbreakouthd.hscr

So every run the table is initialized as if never played before.

Discussion

  • Michael Speck

    Michael Speck - 2023-01-06
    • status: open --> closed-rejected
    • Group: -->
     
  • Michael Speck

    Michael Speck - 2023-01-06

    That is a bug with the flatpak package, you will need to report this to the respective maintainer (which is not me). The file lbreakouthd.hscr must be created with permission 666. This seems to be missing in the flatpak package.

    As a workaround you can start a console and run
    sudo touch /app/var/lbreakouthd.hscr
    sudo chmod 666 /app/var/lbreakouthd.hscr
    That should do the trick.

     
  • Atri

    Atri - 2023-01-19

    Great game, love playing it! Would be great if this did the same thing as ltris and lbreakout2 do, for example, and saved the hscr file to a user config dir. Ltris/Lbreakout2 both save their high-scores to $HOME/.lgames/. In addition to avoiding a world-writable file in /var, with potential security issues, this would benefit multi-user systems where one user's high-scores do not get upstaged by another's. Just a thought.

    Many thanks for the great suite of games in the first place.

     
  • Atri

    Atri - 2023-01-19

    Something like the following patch does the trick for me:

    Index: lbreakouthd-1.1.1/src/hiscores.cpp
    ===================================================================
    --- lbreakouthd-1.1.1.orig/src/hiscores.cpp
    +++ lbreakouthd-1.1.1/src/hiscores.cpp
    @@ -100,7 +100,7 @@ Hiscores::Hiscores()
        int l, s;
        string prefix;
    
    
    -   fname = string(HISCOREDIR) + "/lbreakouthd.hscr";
    +   fname = getHomeDir() + "/" + CONFIGDIR + "/lbreakouthd.hscr";
        if (!fileExists(fname)) {
            _loginfo("No hiscores file yet.\n");
            return; /* no hiscores yet */
    
     
  • Michael Speck

    Michael Speck - 2023-01-21

    hi, i'm happy you like the games and that's interesting, because ALL lgames including ltris and lbreakout2 store the high scores in $localstatedir. (intentionally btw, i like the idea of shared global highscores and think the security risk is low). but if you run, e.g., configure with --prefix=/home/myuser/ you can have a single-user installation with your own private highscores. so you must have some modified copies? anyways, to keep it consistent and as it's configurable i'll leave lbreakouthd's highscores location as it is.

     
    • Atri

      Atri - 2023-01-21

      Thanks for the feedback.

      As regards to ltris, I meant that it implements something like this (chart.c):

      Load highscore. If it doesn't exist try to create it in HI_DIR if
      this fails fall back to ~/.lbreakout and create highscore there.
      ====================================================================
      */
      void chart_load()
      {...
      

      so if it cannot save to global statedir, it falls back to saving it inside a user's home dir. Perhaps lbreakouthd could do with such a backup plan as well.

      I think for Linux distros packaging your games (I help out with packaging on openSUSE), users typically expect to install RPMs/DEBs from the package manager for convenience, which installs to prefix=/usr (generally speaking). In these cases, having a fall back option to save to the user's config dir may be useful, esp. if the distro balks at the idea of installing world-writable files to root.

       
  • Michael Speck

    Michael Speck - 2023-01-28
    • status: closed-rejected --> open
     
  • Michael Speck

    Michael Speck - 2023-01-28

    my bad, I only checked chart_load_from_path and not chart_load. so yeah I see the point and added it for consistency. lbreakouthd will now fallback as well.

     
  • Michael Speck

    Michael Speck - 2023-01-28
    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB