Issue Details (XML | Word | Printable)

Key: CORE-3199
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Trivial Trivial
Assignee: Alexander Peshkov
Reporter: Christian Heimes
Votes: 1
Watchers: 3

If you were logged in you would be able to see more operations.
Firebird Core

nbackup fails due to O_NOATIME flag in database open

Created: 27/Oct/10 01:12 AM   Updated: 25/May/17 08:25 PM
Component/s: NBACKUP
Affects Version/s: 2.1.3, 3.0 Initial, 2.5.0
Fix Version/s: 2.5.1, 3.0 Alpha 1

Environment: Linux
Issue Links:

QA Status: Cannot be tested

 Description  « Hide
nbackup is unable to open a FDB file when the file is not owner by the current user although the current user has read permission. This happens because O_NOATIME is only allowed if the current user either owns the file or is root.

open(".../database.fdb", O_RDONLY|O_DIRECT|O_NOATIME) = -1 EPERM (Operation not permitted)

Proposed fix:

--- src/utilities/nbackup.cpp.orig 2010-10-27 03:00:32.068887122 +0200
+++ src/utilities/nbackup.cpp 2010-10-27 03:03:36.801352983 +0200
@@ -336,6 +336,10 @@
 #define O_DIRECT 0
 #endif // O_DIRECT
        dbase = open(dbname.c_str(), O_RDONLY | O_LARGEFILE | O_NOATIME | O_DIRECT);
+ if (dbase < 0 && O_NOATIME)
+ // O_NOATIME fails unless we are either root or the owner of the file
+ // try again without O_NOATIME
+ dbase = open(dbname.c_str(), O_RDONLY | O_LARGEFILE | O_DIRECT);
        if (dbase < 0)
                b_error::raise("Error (%d) opening database file: %s", errno, dbname.c_str());

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alexander Peshkov added a comment - 01/Jun/11 12:17 PM
Slightly modified patch applied.