Skip to content

Conversation

@hebasto
Copy link
Member

@hebasto hebasto commented Jul 18, 2019

This PR introduces a new behavior for -datadir (w/o a value) or -datadir="": it means "use the default one". It allows to unset a datadir option specified in the config file by passing -datadir or -datadir="" as a command line option.

Credits:
This PR is inspired by ryanofsky's idea:

If somebody has a datadir option specified in the config file, but wants to unset it on the command line by passing -nodatadir or -datadir="", it seems like this should be allowed.

The more general approach, however, has been described by ryanofsky here.

@hebasto
Copy link
Member Author

hebasto commented Jul 18, 2019

ping @ryanofsky

@hebasto hebasto force-pushed the 20190718-nodatadir branch from 76bccef to a6ca963 Compare July 18, 2019 18:37
@ryanofsky
Copy link
Contributor

ryanofsky commented Jul 18, 2019

This seems ok. I think it could make sense for -nodatadir and -datadir= on the command line to override any datadir string in the configuration file and override any datadir in qt settings, and use default platform datadir as if no value was ever specified.

Or alternately, it could make sense for -nodatadir to print an error, because it's similar enough to -nowallet, -nowalletdir, -nopid, -norpccookiefile options where you might want to be able to disable bitcoin from creating files & directories, but different from those options because bitcoin can't function without a datadir.

In either case, I think the PR description here should be updated to be more self contained. I think an ideal PR description would first say what the change in behavior is, then give reasons for the change, and only then go into deeper history and assigning credit for ideas, to be comprehensible as possible without digging into previous discussion.

Also a change like this should have release notes.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 18, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@hebasto
Copy link
Member Author

hebasto commented Jul 19, 2019

@ryanofsky

In either case, I think the PR description here should be updated to be more self contained. I think an ideal PR description would first say what the change in behavior is, then give reasons for the change, and only then go into deeper history and assigning credit for ideas, to be comprehensible as possible without digging into previous discussion.

The PR description has been updated.

@promag
Copy link
Contributor

promag commented Jul 23, 2019

I would rather see just -datadir or -datadir="" as a way to set the default and override config.

-nodatadir doesn't make any sense to me.

@promag
Copy link
Contributor

promag commented Jul 23, 2019

Each arg could have a flag whether it can be negated or not. For instance ArgsManager::AddArg(..., bool allow_negated = true).

@hebasto
Copy link
Member Author

hebasto commented Jul 23, 2019

@promag

I would rather see just -datadir or -datadir="" as a way to set the default and override config.
-nodatadir doesn't make any sense to me.

You and @ryanofsky have convinced me. Going to implement your suggestion tonight.

Each arg could have a flag whether it can be negated or not. For instance ArgsManager::AddArg(..., bool allow_negated = true).

Could you look into #16097?

-datadir or -datadir="" in command line will set the default datadir 
(overriding config file options).
@hebasto hebasto force-pushed the 20190718-nodatadir branch from a6ca963 to 3a1ea8e Compare July 23, 2019 13:33
@hebasto hebasto changed the title Negated -datadir option implies default datadir -datadir or -datadir="" option implies default datadir Jul 23, 2019
@hebasto
Copy link
Member Author

hebasto commented Jul 23, 2019

@ryanofsky and @promag Thank you for your reviews.

I would rather see just -datadir or -datadir="" as a way to set the default and override config.

Done. The OP has been updated.

... it could make sense for -nodatadir to print an error...

I'd rather use a more general solution like #16097.

@hebasto hebasto mentioned this pull request Jul 24, 2019
@hebasto
Copy link
Member Author

hebasto commented Jul 24, 2019

Closed in favor of #15864.

See: 740d41c#r306906349

@hebasto hebasto closed this Jul 24, 2019
@hebasto hebasto deleted the 20190718-nodatadir branch July 26, 2019 16:12
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 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.

5 participants