Menu

#2927 A blank line in .fgfsrc causes 'next' to terminate

2024.1
Fixed
None
Low
2024-11-10
2024-10-30
No

Insert a blank line in, or at the end of, .fgfsrc and Flightgear 'next' terminates with a message "Unknown command line option:" and no other message.
Running 2024.1 with the same .fgfsrc results in Flightgear running, presumably ignoring the blank line.

Related

Tickets: #2929

Discussion

  • Huntley Palmer

    Huntley Palmer - 2024-10-30
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,2 +1,2 @@
    -Insert a blank line in, or at the end of, .fgfsrc and Flightgear terminates with a message "Unknown command line option:"  and no other message. 
    +Insert a blank line in, or at the end of, .fgfsrc and Flightgear 'next' terminates with a message "Unknown command line option:"  and no other message. 
       Running 2024.1 with the same .fgfsrc results in Flightgear running, presumably ignoring the blank line. 
    
     
  • James Turner

    James Turner - 2024-10-30

    Weird, those branches are basically identical.

     
  • Julian Smith

    Julian Smith - 2024-10-30

    Actually i found that clicking on the dialogue repeatedly enabled FG to run.

    But here's a patch that fixes it for me:

    commit 8d9f68a71711b7352b048413ce519afc8e5f2f9c (HEAD -> next)
    Author: Julian Smith <jules@op59.net>
    Date:   Sun Oct 27 16:45:02 2024 +0000
    
        src/Main/options.cxx: don't open warning dialogue for blank config lines.
    
    diff --git a/src/Main/options.cxx b/src/Main/options.cxx
    index 0cc8f090d..ff167b457 100644
    
    --- a/src/Main/options.cxx
    +++ b/src/Main/options.cxx
    @@ -2728,7 +2728,7 @@ void Options::readConfig(const SGPath& path)
         }
    
         if ( parseOption(line, value, /* fromConfigFile */ true) == FG_OPTIONS_ERROR ) {
    
    -      cerr << endl << "Config file parse error: " << path << " '"
    +      cerr << endl << "Config file parse error: path='" << path << "' line='"
           << line << "'" << endl;
                p->showHelp = true;
         }
    @@ -2754,6 +2754,9 @@ bool Options::paramToBool(const std::string& param)
      */
     int Options::parseOption(const string& s, const simgear::optional<std::string>& val, bool fromConfigFile)
     {
    +  if (s == "") {
    +    return FG_OPTIONS_OK;
    +  }
       if ((s == "--help") || (s=="-h")) {
         return FG_OPTIONS_HELP;
       } else if ( (s == "--verbose") || (s == "-v") ) {
    
     
    🎉
    1
  • Mariusz Matuszek

    Actually I ran across this yesterday and also patched this, at an earlier processing stage. Please consider.

    --- a/src/Main/options.cxx
    +++ b/src/Main/options.cxx
    @@ -2714,6 +2714,14 @@ void Options::readConfig(const SGPath& path)
             break;
         line = line.substr( 0, i );
    
    
    +    // do not bother parser with empty lines
    +    if (line.length() == 0) {
    +      in >> skipcomment;
    +      continue;
    +    }
    +
    +    SG_LOG( SG_GENERAL, SG_DEBUG, "Processing .fgfsrc line: " << line );
    +
         simgear::optional<std::string> value;
         const size_t space = line.find(' ');
         const size_t equal = line.find('=');
    
     
    🎉
    2

    Last edit: Mariusz Matuszek 2024-11-01
  • ranguli

    ranguli - 2024-11-03
    • Milestone: 2020.4 --> 2024.1
     
  • ranguli

    ranguli - 2024-11-06

    Hey @jmturner, we have two patches available to solve this ticket, do you have any preference on which one to go with? I can go ahead and make the MR if need be.

     
  • James Turner

    James Turner - 2024-11-06

    Skipping at the parsing stage makes more sense, but we shouldn't add the SG_LOG call. I'll submit a tweaked version later today.

     
  • James Turner

    James Turner - 2024-11-06

    Fix pushed to next in commit f71d818e911f47ed1c4b19ac5e757e9075b85d82 - once verified I can cherry pick to 2024.1

     
  • James Turner

    James Turner - 2024-11-06
    • status: New --> Fixed
    • assigned_to: James Turner
     
  • linguisticmind

    linguisticmind - 2024-11-07

    Unable to verify because of this: https://sourceforge.net/p/flightgear/codetickets/2932/

    Not sure if related.

     
  • James Turner

    James Turner - 2024-11-07

    Just to comment, next is not really intended to be in a 'download and test' state right now, due to other changes which are ongoing. So maybe between is to switch over to 2023.1 branch using D&C, and cherry-pick this fix?

     
    • linguisticmind

      linguisticmind - 2024-11-07

      All right. I'm still able to run next from a build I did about a month ago. This issue doesn't affect it. I accidentally made a duplicate [#2929] for this issue, and explained what happened for me there. I saw today that this was labeled Fixed, and wanted to test it.

      I'm not sure how to switch over to a different branch with download_and_compile. My current next build is working, so there isn't much need to do anything at the moment, but if you could give me some pointers as to how to do that, I think it could be really useful to know in the future.

      Thanks!

       

      Related

      Tickets: #2929


      Last edit: linguisticmind 2024-11-07
      • Mariusz Matuszek

        $ cd dnc_managed/flightgear (or wherever you have the downloaded FG sources)

        run 'git status' (output you will get will be similar to the one below)

        $ git status

        On branch next
        Your branch is behind 'origin/next' by 21 commits, and can be fast-forwarded.
        (use "git pull" to update your local branch)

        $ git pull

        remote: Enumerating objects: 9, done.
        remote: Counting objects: 100% (9/9), done.
        remote: Compressing objects: 100% (5/5), done.
        remote: Total 5 (delta 4), reused 0 (delta 0)
        Unpacking objects: 100% (5/5), 438 bytes | 219.00 KiB/s, done.
        From https://git.code.sf.net/p/flightgear/flightgear
        1ab1d56ac..a1d4c6c48 next -> origin/next
        Updating e72317c7d..a1d4c6c48
        Fast-forward .... (lots of output skipped)

        $ cd ../build/flightgear
        $ make

        if make succeeds:
        $ make install

        $ cd ../..

        Run FG (likely ./run_fgfs.sh)

        The above assumes you are on Linux and used default makefiles.

        Hope this helps and that it was OK to post this in a ticket comment.

         
        • linguisticmind

          linguisticmind - 2024-11-10

          Thanks 👍

           

Log in to post a comment.

MongoDB Logo MongoDB