ulif / diceware

Passphrases to remember
GNU General Public License v3.0
357 stars 45 forks source link

Whitespace values in diceware.ini file #23

Closed dwcoder closed 8 years ago

dwcoder commented 8 years ago

This isn't really a bug, but I want to mention it anyway, just to make sure.

If my diceware.ini file contains the following:

[diceware]
delimiter = " "
caps = off

an example output from the diceware -n 2 command is as follows:

rowdy" "aubrey

That is, the delimiter is being read literally as " " from the .ini file. Thus, there is no way (that I am aware of) to set space as your default delimiter using the ini file.

One way to fix this (if it is indeed an issue) is to add a strip('"') to line 85 in the config.py file in the get_config_dict function, as mentioned in this answer. That will strip out all instances of " from the ini file. This may or may not be a good thing.

ulif commented 8 years ago

Hey @dwcoder , yes, that's a shortcoming of standard libs ConfigParser / configparser I guess.

Generally, I would not oppose to strip quote symbols from string values. There will hardly be many users with literally "something-so-weird" as delimiter.

We should, however, take care to support stripping both, " as well as '.

That would make a nice little improvement with low user impact.

ulif commented 8 years ago

@dwcoder, I took the liberty to rename the issue. Mentioning spaces might describe more concise what the problem is. I hope you do not mind!

dwcoder commented 8 years ago

@ulif yeah, good idea with renaming the issue.

I will add the stripping function (and unit tests) and submit a pull request when I am done.

ulif commented 8 years ago

@dwcoder great, thanks a lot!