Open nestor-custodio opened 3 years ago
Thanks for the detailed walk through of the multiple scenarios.
We don't use the home folder to keep our rc files. We only use ~/.config/pgcli/config location.
When pgcli was first created we were using ~/.pgclirc file and we were told this behavior of storing rc files in home folder is antiquated and we should really be using XDG_CONFIG_HOME location. Hence the change.
We copy the file from ~/.pgclirc to ~/.config/pgcli/config as a means of easing the transition for users so they don't have to start from scratch due to the sudden change in rc file location.
You point about rc file backup doesn't make sense to me. The rc file backup should backup the file located in ~/.config/pgcli/config location and not the ~/.pgclirc file.
Ah. If you're sticking to XDGBDS, that makes sense and I consider item 1 addressed.
I would still argue, however, that (a) the --pgclirc
flag should be respected with no side effects, and that (b) --pgclirc="~/.pgclirc"
resulting in a default config being loaded regardless of the file's original contents is a legitimate bug.
Description
I've identified 2 broken behaviours (detailed below) pertaining to how RC files are handled.
Scenario 1: in certain cases the RC file is moved
The Setup:
The Command:
/usr/bin/pgcli "postgres://[user]@[host]/[database]"
The Outcome: Note I cannot verify exactly what order some of the below items occur in, as I can only attest to what order I see output generated in.
The Problem:
pgcli
will fail to start at all (with aPermissionError: [Errno 13]
) if the process cannot create "\~/.config/pgcli" or write to "\~/.config/pgcli/config"The Expectation:
Scenario 2: in certain cases the RC file is moved and also replaced with the default config
Thinking that explicitly setting the
--pgclirc
option might make it clear that "this is where my config file is and this is where you should read it from, do nothing else please and thank you", I found a related (but somehow worse) problem.The Setup:
The Command:
/usr/bin/pgcli --pgclirc="\~/.pgclirc" "postgres://[user]@[host]/[database]"
The Outcome: Note I cannot verify exactly what order some of the below items occur in, as I can only attest to what order I see output generated in.
The Problem:
pgcli
will:multi_line = true
and a lowrow_limit
, and expect that entering ...... will normally execute your query fairly quickly, but now the request is fired off to the DB on the first newline, before any
WHERE
is seen.pgcli
had been invoked with-D
/--dsn
, this would fail as the loaded config dose not contain your "[alias_dsn]" entries.The Expectation:
Your Environment
[X] Please provide your OS and version information.
uname -s -r -o
yields:lsb_release --all
yields:[X] Please provide your CLI version.
/usr/bin/pgcli --version
yields:(This is the newest available version in my distro's repos. I have verified none of the above behaviours are changed by any commit made between the v3.0.0 release and the v3.1.0 release.)
[X] What is the output of
pip freeze
command.pip freeze
yields:(Note I'm not sure if the above is actually useful or not, as I did not install
pgcli
viapip
.)