Opened 10 years ago

Closed 3 years ago

Last modified 3 years ago

#2553 closed defect (fixed)

VFS problem with user.cfg on Windows

Reported by: Itms Owned by: wraitii
Priority: Must Have Milestone: Alpha 25
Component: Core engine Keywords: vfs
Cc: Patch: Phab:D3217

Description (last modified by wraitii)

I encountered this problem on the alpha16 rcs: my config changes were not remembered.

After a quick research I found out that a file mods/user/config/user.cfg was created in my My Games/ folder (see GameDataPaths). This file was identical to my %appdata/0ad/config/user.cfg but none of the two files was modified by the game.

This only happens for a non-development copy. The reason is the code in GameSetup.cpp, at line 405 a "user" mod is created and at line 465 the use of My Games/ folder is forced with higher priority.

I know issues with VFS are already investigated but I wanted to log this issue somewhere for information.

I solved the problem by removing all the contents of mods/ in My Games/. I can't remember if I touched the files in there nor when.

Change History (9)

comment:1 by leper, 10 years ago

Was it mods/user/user.cfg or mods/user/config/user.cfg?

comment:2 by Itms, 10 years ago

Description: modified (diff)

Sorry, it was actually mods/user/config/user.cfg. I correct the ticket.

comment:3 by sanderd17, 8 years ago

Another problem noted with user.cfg on IRC: http://irclogs.wildfiregames.com/2016-04-25-QuakeNet-%230ad.log

The user.cfg wasn't created when setting the language, but it was created when changing another setting.

in reply to:  3 comment:4 by Vladislav Belov, 7 years ago

Replying to sanderd17:

Another problem noted with user.cfg on IRC: http://irclogs.wildfiregames.com/2016-04-25-QuakeNet-%230ad.log

The user.cfg wasn't created when setting the language, but it was created when changing another setting.

Fixed in r18960 (refs #4146).

comment:5 by Vladislav Belov, 7 years ago

What was the problem? What did you try to save (options, languages, etc)?

comment:6 by wraitii, 4 years ago

Description: modified (diff)
Milestone: BacklogAlpha 24
Patch: Phab:D2781

Thanks Stan for noticing. This is fixed by Phab:D2781.

comment:7 by wraitii, 3 years ago

Cc: leper removed
Milestone: Alpha 24Alpha 25
Patch: Phab:D2781Phab:D3217

Moved to Phab:D3217 I ain't fixing this for A24, somewhat likely to introduce weirdness.

comment:8 by wraitii, 3 years ago

Owner: set to wraitii
Resolution: fixed
Status: newclosed

In 25104:

Make real directory paths on the VFS predictable.

Partial revert/fix of rP13167 and rP13472.

Before this diff, it was possible for a mod containing a cache/ or a config/ folder to get written to incorrectly.
The issue is VFS can map multiple directories to one 'virtual' path, for reading mods. However, writing data is problematic: which path to choose?
The only viable solution is to use a path relative to the highest priority directory encountered in the VFS path, or write paths could be 'hijacked' by lower-priority mods.

This fixes these issues by:

  • Adding a new lookup mode ('Real-path') that explicitly picks the real path relative to the highest-priority subdirectory in the VFS Path.
  • Preventing overwriting a real directory with a lower priority one in general.
  • Revert rP8082's GetRealPath change, re-introducing the function as GetOriginalPath.

This also cleans up some duplication that led to empty mod folders in the user mod path, and cleans up loading the 'user' mod.

Note that the new 'realpath' lookup can still be somewhat complex with many mount points at various hierarchy levels, but it is at least predictable/deterministic without having to be careful about populating order.

Fixes #2553

Differential Revision: https://code.wildfiregames.com/D3217

comment:9 by wraitii, 3 years ago

In 25107:

Make real directory paths on the VFS predictable (retry)

This is the same commit as rP25104, reverted in rP25105. Noted issues were fixed.

Partial revert/fix of rP13167 and rP13472.

Before this diff, it was possible for a mod containing a cache/ or a config/ folder to get written to incorrectly.
The issue is VFS can map multiple directories to one 'virtual' path, for reading mods. However, writing data is problematic: which path to choose?
The only viable solution is to use a path relative to the highest priority directory encountered in the VFS path, or write paths could be 'hijacked' by lower-priority mods.

This fixes these issues by:

  • Adding a new lookup mode ('Real-path') that explicitly picks the real path relative to the highest-priority subdirectory in the VFS Path.
  • Preventing overwriting a real directory with a lower priority one in general.
  • Revert rP8082's GetRealPath change, re-introducing the function as GetOriginalPath.

This also cleans up some duplication that led to empty mod folders in the user mod path, and cleans up loading the 'user' mod.
It also makes it explicit that a directory must be passed to Mount().

Note that the new 'realpath' lookup can still be somewhat complex with many mount points at various hierarchy levels, but it is at least predictable/deterministic without having to be careful about populating order.

Fixes #2553

Differential Revision: https://code.wildfiregames.com/D3728

Note: See TracTickets for help on using tickets.