Relative -datadir=… broken #1125

issue laanwj openend this issue on April 19, 2012
  1. laanwj commented at 6:21 pm on April 19, 2012: member

    Trying to start my testnet-in-a-box instances (with master) I get the following error in the console:

    Command line:

    0orion@amethyst:~/projects/bitcoin/box$ ../bitcoin/src/bitcoind -datadir=1 -daemon
    1
    2************************
    3EXCEPTION: 22DbRunRecoveryException       
    4DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery       
    5bitcoin in AppInit()       
    6
    7terminate called after throwing an instance of 'DbRunRecoveryException'
    8  what():  DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery
    

    debug.log shows:

    0Bitcoin version v0.6.0-169-g4040598-beta (2012-04-19 18:21:45 +0200)
    1Default data directory /home/orion/.bitcoin
    2Loading addresses...
    3dbenv.open LogDir=1/testnet/database ErrorFile=1/testnet/db.log
    4************************
    5EXCEPTION: 22DbRunRecoveryException       
    6DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery       
    7bitcoin in AppInit()      
    

    db.log shows:

    01/testnet/1/testnet/database: No such file or directory
    1PANIC: No such file or directory
    2unable to join the environment
    

    I’ve deleted everything except wallet.dat from the data directory, so that cannot be the problem.

    Note the weird 1/testnet/1/testnet/database. Maybe something is going wrong while building the path?

  2. laanwj commented at 6:37 pm on April 19, 2012: member

    Hmmm. Changing line 85 of db.cpp to just:

    0        filesystem::path pathLogDir = "database";
    

    Seems to solve the problem. When the log path is relative, it will take it relative to the data directory, not relative to the current directory.

    This is documented here: http://docs.oracle.com/cd/E17076_02/html/gsg_txn/CXX/enabletxn.html

    0You can cause log files to be created in a directory other than the environment home 
    1directory by using the DbEnv::set_lg_dir() method. The directory identified here must exist. 
    2If a relative path is provided, then the directory location is resolved relative to the 
    3environment's home directory.
    

    I don’t understand what broke it though. Looking back, pathLogDir was always built in this way.

    (note: this is not a correct fix, as the filesystem::create_directory will use the current directory as base…)

  3. freewil commented at 8:30 pm on April 19, 2012: contributor
    #1086 Seems related to this.
  4. sipa commented at 10:01 pm on April 22, 2012: member
    Fixed in #1133
  5. sipa closed this on Apr 22, 2012

  6. suprnurd referenced this in commit eca1e8a4f1 on Dec 5, 2017
  7. lateminer referenced this in commit 8049e13625 on Jan 22, 2019
  8. lateminer referenced this in commit c6e238ca4d on Dec 25, 2019
  9. Bushstar referenced this in commit b42db318b2 on Jun 22, 2020
  10. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me