Project

General

Profile

Bug #3045

Settings containing '#' cannot be loaded

Added by Joel Steinberg almost 2 years ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Configuration
Target version:
Start date:
11/29/2015
% Done:

100%

Reproducibility:
Always
Operating system:
Other
Severity:
Normal

Description

openmw quits with the error message that the file cannot be loaded, when reaching it in the loading queue on startup. In the error message the name of the file up to the letter before the # is printed.


Related issues

Related to OpenMW - Bug #3243: Ampersand in configuration files isn't escaped automatically Closed 03/09/2016
Related to OpenMW - Bug #2976: data lines in global openmw.cfg take priority over user openmw.cfg Confirmed 10/26/2015

History

#1 Updated by scrawl . almost 2 years ago

The # character is used in our configuration files to denote comments.

#2 Updated by Lars Söderberg almost 2 years ago

Just a thought: if esp-files are added to the config file unencoded, would it be possible to rename a file in such a manner that something malicious happens, similar to SQL injection?

#3 Updated by scrawl . almost 2 years ago

I imagine with a newline in the file name you could break out of the content= line and start a new configuration line. But what is 'malicious'? None of available settings in openmw.cfg can be used to compromise the system.

#4 Updated by scrawl . almost 2 years ago

  • Category changed from General to Configuration

#5 Updated by Marc Zinnschlag almost 2 years ago

  • Target version changed from openmw-0.38 to openmw-0.39

#6 Updated by scrawl . over 1 year ago

  • Related to Bug #3243: Ampersand in configuration files isn't escaped automatically added

#7 Updated by scrawl . over 1 year ago

  • Related to Bug #2976: data lines in global openmw.cfg take priority over user openmw.cfg added

#8 Updated by Marc Zinnschlag over 1 year ago

  • Target version changed from openmw-0.39 to openmw-0.40

#9 Updated by AnyOldName 3 over 1 year ago

I think I've learned how to fix this without completely overhauling everything, but there's a decision that needs to be made regarding when the hash character '#' starts a comment, and when it should be interpreted as part of an option.

The current situation is that Boost interprets anything between a hash and the next line break as a comment. This means we can't use it in options. There are a few alternatives possible:
  • Make it possible to precede a hash with some escape sequence so it doesn't count as a comment. If done robustly, this could be the most flexible.
  • Make a decision that a hash only counts if it's at the start of a line (either as the first character or first non-whitespace character). This would match how the launcher behaves.
  • Make it so hashes will be considered data when used in a data= or content= line. Personally, I don't like this as it'd add a lot of complexity to the required code, and also add to maintainance more, as we'd need to keep track of which options had this rule.

For now, the middle option is probably simplest to implement, so I'll get started on that, and can switch to another option if someone with authority wants something different.

#10 Updated by AnyOldName 3 over 1 year ago

My changes just got merged, so I think this can be closed.

#11 Updated by Marc Zinnschlag over 1 year ago

  • Status changed from New to Closed
  • Assignee set to AnyOldName 3
  • % Done changed from 0 to 100
  • Operating system changed from Windows to Other

#12 Updated by AnyOldName 3 about 1 month ago

  • Subject changed from Esp files containing the letter '#' in the file name cannot be loaded on startup to Settings containing '#' cannot be loaded
  • Status changed from Closed to Confirmed
  • Target version deleted (openmw-0.40)

I just looked, and apparently, I never fixed this for the CS or for the fallback=key,value lines. Hopefully, I'll have that sorted out by the end of the day.

#13 Updated by AnyOldName 3 about 1 month ago

Apparently, I had actually made it work for the fallback=key,value lines, so the only issue was with the CS loading everything else. I've fixed that with this PR: https://github.com/OpenMW/openmw/pull/1504

#14 Updated by AnyOldName 3 about 1 month ago

  • Status changed from Confirmed to Resolved
  • Target version set to openmw-0.43

#15 Updated by Alexei Dobrohotov about 1 month ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF