Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#279 closed defect (fixed)

vfs_Lookup does mkdir incorrectly

Reported by: Philip Taylor Owned by: Jan Wassenberg
Priority: Nice to Have Milestone:
Component: Core engine Keywords:
Cc: Patch:

Description

On Linux: Delete binaries/data/cache. Run the game. Get an error:

/usr/include/boost/shared_ptr.hpp:375: T* boost::shared_ptr<T>::operator->() const [with T = RealDirectory]: Assertion `px != 0' failed.

vfs_lookup.cpp attempts to create the directory with mkdir. Two problems:

First: It appears to call mkdir("/.../binaries/data/") with subdirectoryName == "cache". Then it calls mkdir("/.../binaries/data/cache/mods") with subdirectoryName == "mods". It never actually creates cache, so it fails.

Second: If mkdir fails, then no error is reported, and the shared_ptr assertion occurs arbitrarily later. If it returns -1 and errno != EEXIST then the error should probably be reported immediately.

Change History (2)

comment:1 by Jan Wassenberg, 15 years ago

Resolution: fixed
Status: newclosed

Good point, I have no idea why possible mkdir errors were ignored, but that has been remedied.

As to the first issue, I looked at it earlier today and was worried that we wouldn't know into which real directory a new subdirectory should be placed in the case of mounting a new directory into the new VFS root. However, the fix is trivial: instead of only building the path if an existing directory is known, start with "" (path.cpp's root directory), add existing directory if known and always append the new subdirectoryName. We're now able to correctly create e.g. cache/ on Windows at least. If I'm missing something, please feel free to reopen the ticket :)

comment:2 by (none), 14 years ago

Milestone: Open Source Release

Milestone Open Source Release deleted

Note: See TracTickets for help on using tickets.