Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support XDG_CONFIG_HOME dir for pwn.conf #1827

Merged
merged 2 commits into from
Mar 8, 2021

Conversation

WGH-
Copy link
Contributor

@WGH- WGH- commented Feb 27, 2021

~/.pwn.conf support is not removed.

@heapcrash
Copy link
Collaborator

I don't mind having this as an ADDITIONAL configuration that gets loaded, but we should keep ~/.pwn.conf the canonical one (and the one recommended by documentation).

@heapcrash heapcrash self-requested a review February 27, 2021 21:20
pwnlib/update.py Outdated Show resolved Hide resolved
pwnlib/update.py Show resolved Hide resolved
pwnlib/update.py Outdated
if should_check():
message = ["Checking for new versions of %s" % package_name]
message += ["To disable this functionality, set the contents of %s to 'never' (old way)." % cache_file()]
message += ["""Or add the following lines to ~/.pwn.conf (or /etc/pwn.conf system-wide):
message += ["Or add the following lines to %s (or /etc/pwn.conf system-wide):" % (xdg_config_home + "/pwn.conf")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List both locations, not one or the other.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we need to handle the case where XDG_CONFIG_HOME is not set (e.g. macOS) and not recommend that path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to ~/.config vs $XDG_CONFIG_HOME discussion above, or you're suggesting that all three of /etc/pwn.conf, ~/.config/pwn.conf and ~/.pwn.conf should be mentioned here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all three of /etc/pwn.conf, ~/.config/pwn.conf and ~/.pwn.conf should be mentioned here

This, we should continue to support loading from ~/.pwn.conf even if $XDG_HOME/pwn.conf exists. If they both exist, load them both, don't really care about ordering.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably ordering should be

/etc/pwn.conf
XDG_CONFIG_HOME/pwn.conf
~/.pwn.conf

This keeps the current behavior (~/.pwn.conf wins), while adding support for the XDG_CONFIG_HOME you're proposing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose the macOS question was answered in the duscussion above?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, if $XDG_CONFIG_HOME is not set, then just don't try to load that file.

~/.pwn.conf support is not removed.
@heapcrash
Copy link
Collaborator

Fixed CHANGELOG, merging

@heapcrash heapcrash merged commit ec9dfe1 into Gallopsled:dev Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants