Opened 9 years ago

Last modified 8 years ago

#3255 closed defect

[PATCH] Use date + time in sim-log directory instead of pid — at Initial Version

Reported by: elexis Owned by:
Priority: Must Have Milestone: Alpha 20
Component: Core engine Keywords: patch
Cc: Patch:

Description

Currently the commands.txt files (and ooslog output) are created in a subdirectory of the sim-log directory.

The commands.txt file contains all commands sent by players and is therefore the key file when filing bug reports and replaying previous games visually with #9.

The problem I want to address here is that the subdirectory that contains the commands.txt file has a bad name. It uses the process ID and a sequential number. There are three problems with that:

  1. Old files will be overwritten.
  2. It is not easy to identify the correct directory when filing bugreports.
  3. The visual replay function #9 will be accessible from the main menu at some point. It should then display the correct date and time without relying on a fragile timestamp.

Deeper analysis:

1. Why files will be overwritten

Quoting from: http://en.wikipedia.org/wiki/Process_identifier#Unix-like

Process IDs are usually allocated on a sequential basis, beginning at 0 and rising to a maximum value which varies from system to system. Once this limit is reached, allocation restarts at 300 and again increases.

Therefore pIDs are not random but have a very limited keyspace (4 to 5 figures), which makes it very possible that old files will be overwritten. The sequential number that will be added to the PID will only be added if you play multiple games with the same instance of 0ad. If you reboot and get the same PID, then you overwrite the commands.txt file.

2. Identifying the correct directory

When people want to file a bugreport and the error appeared on the last game they played, then they only have to identify the file with the most recent filedate. Some have already problems with that (Mac users in particular, since that information isn't displayed by default). If the match was some time ago, the timestamp definitely helps identifying the correct file.


Open question: Should we make a subdirectory for the revision, so that the directory won't contain replay logs of different revisions? I.e. .../sim-log/alpha18/2015-05-20_03-38-38/commands.txt ?

Change History (1)

Note: See TracTickets for help on using tickets.