View Issue Details

IDProjectCategoryView StatusLast Update
0001383Anope Development (1.9.x series)Otherpublic2012-05-07 03:11
Reportercbiedl Assigned ToAdam  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinux 
Summary0001383: Database file backup fails for DatabaseFile with path
DescriptionHello,

I'm not very happy with

    Anope::string newname = "backups/" + DatabaseFile + "." + stringify(tm->tm_year) + stringify(tm->tm_mon) + stringify(tm->tm_mday);

(both in modules/database/db_flatfile.cpp and modules/database/db_plain.cpp).

At first, if the DatabaseFile is configured to an absolute path like

    database = "/var/lib/anope/anope.db"

the code above will try to backup a database file to

    backups/var/lib/anope/anope.db.NNNN (number depends on date)

which will very likely fail. Please consider using the base name of
DatabaseFile only.

A second thing, the filename created has a small risk for collisions.
Please consider padding (preferred as this keeps backup files sorted)
or insert separators between the date components.

Regards,

    Christoph
TagsNo tags attached.

Activities

Adam

2012-05-07 03:11

administrator   ~0006147

I've added the ability for the directory databases are stored in to be changed at runtime in 675b113c3e03cf1917b2a731c21fe82b5f1f2b2b by command line options. I've also added options to cmake to allow installing binaries/libs/configs/whatever in directories other than the default, if you want to use those you define one or more of BIN_DIR, DB_DIR, DOC_DOC, LIB_DIR, CONF_DIR, LOCALE_DIR, or LOGS_DIR in ./Config for cmake.

Adam

2012-03-07 10:13

administrator   ~0006094

For now I have pushed a fix for the backup database name collision.

Adam

2012-03-06 03:04

administrator   ~0006093

The database configuration option actually is supposed to just be a name. I'm not sure if we want to support saving and loading databases from outside of the services data directory.

Issue History

Date Modified Username Field Change
2012-03-06 01:00 cbiedl New Issue
2012-03-06 03:04 Adam Note Added: 0006093
2012-03-07 10:13 Adam Note Added: 0006094
2012-03-07 10:14 Adam Status new => acknowledged
2012-05-07 03:11 Adam Note Added: 0006147
2012-05-07 03:11 Adam Status acknowledged => resolved
2012-05-07 03:11 Adam Resolution open => fixed
2012-05-07 03:11 Adam Assigned To => Adam