Removed call to `TryCreateDirectory` from `GetDefaultDataDir` in `src/util.cpp`. #7850

pull alexreg wants to merge 1 commits into bitcoin:master from alexreg:issue7845 changing 1 files +1 −3
  1. alexreg commented at 1:38 PM on April 9, 2016: contributor
  2. kirkalx commented at 9:54 PM on April 9, 2016: contributor

    utACK. If there is a good reason for that line to be there on OSX only, then it needs a comment justifying it.

  3. sipa commented at 12:09 PM on April 10, 2016: member

    It seems that this was there as long as GetDefaultDatadir has been there: https://github.com/bitcoin/bitcoin/tree/d882773789ea3894de7163f7bb880c5b23072882/util.cpp

  4. paveljanik commented at 3:39 PM on April 10, 2016: contributor

    Looks like this is not for merging...

  5. alexreg commented at 5:50 PM on April 10, 2016: contributor

    ??

    Sent from my iPhone

    On 10 Apr 2016, at 16:40, paveljanik notifications@github.com wrote:

    Looks like this is not for merging...

    — You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

  6. paveljanik commented at 6:01 PM on April 10, 2016: contributor

    According to the comment mentioned above, you are only trying if this will work. Your real problem is different though, I think. Can you investigate it a bit more please?

    pavel$ sudo -u test env | grep HOME
    HOME=/Users/pavel
    pavel$ sudo -H -u test env | grep HOME
    HOME=/Users/test
    pavel$ 
    
  7. paveljanik commented at 6:41 PM on April 10, 2016: contributor
  8. kirkalx commented at 11:15 PM on April 10, 2016: contributor

    @paveljanik The change is for merging. As I said above, if there is a reason for the line to be there it needs to be justified with a comment.

  9. sipa commented at 6:48 AM on April 11, 2016: member

    And I added that the behaviour has been there for as long as the GetDefaultDatadir function has existed, implying that we'll probably never find out why.

    Concept ACK

  10. paveljanik commented at 7:29 AM on April 11, 2016: contributor

    @sipa yes, but someone should really investigate, how bitcoind/-Qt works when the parent directory (ie. Library/Application Support) is not created/is not writable by the current user or does not exist at all (where/how will we write the config file, blocks, chainstate etc?). I suspect this hides some other problem down in the code...

    But if proven to work (not just compile ;-), I'm happy with making OS X the same as "Unix" branch there - @alexreg can you please make the OS X branch to directly return the full path and not changing it in two passes (1. add L/A S, 2. add /Bitcoin) and then test with a real user without that directory or with bad permissions on that directory? How will bitcoind/-Qt work in such cases?

  11. kirkalx commented at 7:48 AM on April 11, 2016: contributor

    But if the data directory has been changed to a different value, the only reason GetDefaultDataDir() is called is to display what the default would have been. (I'm ignoring the slightly more complicated behaviour in -qt). So making sure that (part of) that path exists makes no sense.

  12. paveljanik commented at 7:59 AM on April 11, 2016: contributor

    ... exist and is writable...

  13. laanwj added the label Utils and libraries on Apr 11, 2016
  14. jonasschnelli commented at 1:42 PM on April 11, 2016: contributor

    utACK. Creating ~/Library/Application Support is useless (on OSX).

  15. alexreg commented at 2:47 PM on April 11, 2016: contributor

    I’m not sure exactly what you mean. I don’t really code C++. Could you give me the diff please, and I’ll apply it?

    I’ve already tested both those cases though, and it works as it should.

    On 11 Apr 2016, at 08:30, paveljanik notifications@github.com wrote:

    @sipa https://github.com/sipa yes, but someone should really investigate, how bitcoind/-Qt works when the parent directory (ie. Library/Application Support) is not created/is not writable by the current user or does not exist at all (where/how will we write the config file, blocks, chainstate etc?). I suspect this hides some other problem down in the code...

    But if proven to work (not just compile ;-), I'm happy with making OS X the same as "Unix" branch there - @alexreg https://github.com/alexreg can you please make the OS X branch to directly return the full path and not changing it in two passes (1. add L/A S, 2. add /Bitcoin) and then test with a real user without that directory or with bad permissions on that directory? How will bitcoind/-Qt work in such cases?

    — You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub #7850 (comment)

  16. paveljanik commented at 3:03 PM on April 11, 2016: contributor

    Just return pathRet / "Library/Application Support/Bitcoin" ...

  17. alexreg commented at 4:39 PM on April 11, 2016: contributor

    Oh right. Done now.

  18. sipa commented at 1:53 PM on April 12, 2016: member

    utACK 0f2fd2cec05b90d071b30eb522061e1c5144b367 after squash

  19. paveljanik commented at 7:59 PM on April 12, 2016: contributor

    Please squash both commits into one.

  20. alexreg commented at 9:05 PM on April 12, 2016: contributor

    I don’t use Git much, so no idea how to do that.

    On 12 Apr 2016, at 21:00, paveljanik notifications@github.com wrote:

    Please squash both commits into one.

    — You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub #7850 (comment)

  21. kirkalx commented at 10:35 PM on April 12, 2016: contributor

    Wladimir explains in #7458, or just do a google search

  22. Removed call to `TryCreateDirectory` from `GetDefaultDataDir` in `src/util.cpp`.
    See https://github.com/bitcoin/bitcoin/issues/7845#issuecomment-207684728.
    Also refactored `GetDefaultDataDir` function to return path for Mac in one expression.
    41dbc4849e
  23. alexreg force-pushed on Apr 12, 2016
  24. laanwj commented at 11:27 AM on April 14, 2016: member

    Hmm this is indeed weird, why would this need a TryCreateDirectory on OSX.

    Happy that this solves your problem.

    utACK https://github.com/bitcoin/bitcoin/pull/7850/commits/41dbc4849e0bf14eef98962b0f0bddcde0bb3014

  25. laanwj added the label Needs backport on Apr 14, 2016
  26. laanwj merged this on Apr 14, 2016
  27. laanwj closed this on Apr 14, 2016

  28. laanwj referenced this in commit 229a17ca91 on Apr 14, 2016
  29. paveljanik commented at 12:48 PM on April 14, 2016: contributor

    I digged in the git history, but could not find something important. But here is the wild guess: on OS X, the config files are in ~/Library/Application Support. On other unixes, config directory .bitcoin is directly in the home directory. And the wild guess is that this "mkdir -p parent_directory" had to be somewhere, so someone decided it could be here 8)

  30. alexreg commented at 1:17 PM on April 14, 2016: contributor

    Thanks for accepting this, guys.

    Sent from my iPhone

    On 14 Apr 2016, at 12:28, Wladimir J. van der Laan notifications@github.com wrote:

    Hmm this is indeed weird, why would this need a TryCreateDirectory on OSX.

    Happy that this solves your problem.

    utACK 41dbc48

    — You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

  31. MarcoFalke referenced this in commit f711640561 on Apr 25, 2016
  32. MarcoFalke referenced this in commit 06c73a1751 on Apr 27, 2016
  33. MarcoFalke commented at 10:58 AM on June 9, 2016: member

    Backported as part of #7938. Removing label 'Needs backport'.

  34. MarcoFalke removed the label Needs backport on Jun 9, 2016
  35. nomnombtc referenced this in commit da6397ae77 on Nov 12, 2016
  36. nomnombtc referenced this in commit 3d6cf4ad88 on Nov 12, 2016
  37. nomnombtc referenced this in commit 766dc32428 on Nov 13, 2016
  38. sickpig referenced this in commit 8f1b384654 on Nov 14, 2016
  39. 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: 2026-04-13 15:15 UTC

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