Skip to content

Conversation

alexreg
Copy link
Contributor

@alexreg alexreg commented Apr 9, 2016

@kirkalx
Copy link
Contributor

kirkalx commented Apr 9, 2016

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

@sipa
Copy link
Member

sipa commented Apr 10, 2016

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

@paveljanik
Copy link
Contributor

Looks like this is not for merging...

@alexreg
Copy link
Contributor Author

alexreg commented Apr 10, 2016

??

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

@paveljanik
Copy link
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$ 

@paveljanik
Copy link
Contributor

@mrCertified ?

@kirkalx
Copy link
Contributor

kirkalx commented Apr 10, 2016

@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.

@sipa
Copy link
Member

sipa commented Apr 11, 2016 via email

@paveljanik
Copy link
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?

@kirkalx
Copy link
Contributor

kirkalx commented Apr 11, 2016

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.

@paveljanik
Copy link
Contributor

... exist and is writable...

@jonasschnelli
Copy link
Contributor

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

@alexreg
Copy link
Contributor Author

alexreg commented Apr 11, 2016

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)

@paveljanik
Copy link
Contributor

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

@alexreg
Copy link
Contributor Author

alexreg commented Apr 11, 2016

Oh right. Done now.

@sipa
Copy link
Member

sipa commented Apr 12, 2016

utACK 0f2fd2cec05b90d071b30eb522061e1c5144b367 after squash

@paveljanik
Copy link
Contributor

Please squash both commits into one.

@alexreg
Copy link
Contributor Author

alexreg commented Apr 12, 2016

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)

@kirkalx
Copy link
Contributor

kirkalx commented Apr 12, 2016

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

…/util.cpp`.

See bitcoin#7845 (comment).
Also refactored `GetDefaultDataDir` function to return path for Mac in one expression.
@fanquake
Copy link
Member

utACK 41dbc48

@paveljanik
Copy link
Contributor

ACK 41dbc48

@laanwj
Copy link
Member

laanwj commented Apr 14, 2016

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

Happy that this solves your problem.

utACK 41dbc48

@laanwj laanwj merged commit 41dbc48 into bitcoin:master Apr 14, 2016
laanwj added a commit that referenced this pull request Apr 14, 2016
…aDir` in `src/util.cpp`.

41dbc48 Removed call to `TryCreateDirectory` from `GetDefaultDataDir` in `src/util.cpp`. (Alexander Regueiro)
@paveljanik
Copy link
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)

@alexreg
Copy link
Contributor Author

alexreg commented Apr 14, 2016

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

maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Apr 27, 2016
…/util.cpp`.

See bitcoin#7845 (comment).
Also refactored `GetDefaultDataDir` function to return path for Mac in one expression.

Github-Pull: bitcoin#7850
Rebased-From: 41dbc48
@maflcko
Copy link
Member

maflcko commented Jun 9, 2016

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

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants