Re: psql: small patch to correct filename formatting error in '\s FILE' output

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: psql: small patch to correct filename formatting error in '\s FILE' output
Дата
Msg-id 27311.1358890594@sss.pgh.pa.us
обсуждение исходный текст
Ответ на psql: small patch to correct filename formatting error in '\s FILE' output  (Ian Lawrence Barwick <barwick@gmail.com>)
Ответы Re: psql: small patch to correct filename formatting error in '\s FILE' output  ("Dickson S. Guedes" <listas@guedesoft.net>)
Re: psql: small patch to correct filename formatting error in '\s FILE' output  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Ian Lawrence Barwick <barwick@gmail.com> writes:
> I've noticed a filename error in feedback messages from psql's '\s' command
> when saving the command line history to a file specified by an absolute
> filepath:

>   psql (9.2.2)
>   Type "help" for help.

>   pgdevel=# \s history.txt
>   Wrote history to file "./history.txt".
>   pgdevel=# \s /tmp/history.txt
>   Wrote history to file ".//tmp/history.txt".
>   pgdevel=# \cd /tmp
>   pgdevel=# \s /tmp/history.txt
>   Wrote history to file "/tmp//tmp/history.txt".

> The second and third '\s' commands display incorrect filepaths in the feedback
> message, despite writing correctly to the specified file.

I wonder why we don't just revert commit 0725065b --- this complaint
shows that it was quite poorly thought out, and I don't really see the
need for it anyway.  Aside from the complained-of bug, the code added to
the \cd command is entirely incapable of tracking through multiple \cd
operations properly.

If we did think that this specific backslash command needed to be able
to print something other than the filename as-entered, I'd be inclined
to just apply make_absolute_path() to the name, instead of relying on
inadequate dead-reckoning.  However, that would require making
make_absolute_path available in src/port/ or someplace, which seems
a bit more than this "feature" is worth.  Why should \s, and \s alone,
need to remind you where you're cd'd to?

Thoughts?
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Event Triggers: adding information
Следующее
От: "Dickson S. Guedes"
Дата:
Сообщение: Re: psql: small patch to correct filename formatting error in '\s FILE' output