Re: minor: ~ not resolved in psql

Lists: pgsql-bugs
From: "Bas Scheffers" <bas(at)scheffers(dot)net>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: minor: ~ not resolved in psql
Date: 2003-10-27 09:02:48
Message-ID: 54597.212.124.229.3.1067245368.squirrel@io.scheffers.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Bas Scheffers
Your email address : bas(at)scheffers(dot)net

System Configuration
---------------------
Architecture (example: Intel Pentium) : Athlon

Operating System (example: Linux 2.0.26 ELF) : Linux 2.4.22

PostgreSQL version (example: PostgreSQL-7.3.4): PostgreSQL-7.3.4

Compiler used (example: gcc 2.95.2) : RPM (Red Hat "Severn")

Please enter a FULL description of your problem:
------------------------------------------------
When opening a file in psql, ~ (the user's home dir) is resolved when
using tab completion to find the file, but when you hit enter and psql
actualy tries to open it, you get a file not found error.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
N/A

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------


From: Rod Taylor <rbt(at)rbt(dot)ca>
To: bas(at)scheffers(dot)net
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: minor: ~ not resolved in psql
Date: 2003-10-27 16:57:53
Message-ID: 1067273871.96436.15.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

> Please enter a FULL description of your problem:
> ------------------------------------------------
> When opening a file in psql, ~ (the user's home dir) is resolved when
> using tab completion to find the file, but when you hit enter and psql
> actualy tries to open it, you get a file not found error.

This is an issue in 7.4 as well.


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bas Scheffers <bas(at)scheffers(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: minor: ~ not resolved in psql
Date: 2003-10-30 18:13:20
Message-ID: Pine.LNX.4.44.0310301912370.2800-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Bas Scheffers writes:

> When opening a file in psql, ~ (the user's home dir) is resolved when
> using tab completion to find the file, but when you hit enter and psql
> actualy tries to open it, you get a file not found error.

This is not a bug. If there is not file named ~ then it can't be opened.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: "Bas Scheffers" <bas(at)scheffers(dot)net>
To: <peter_e(at)gmx(dot)net>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: minor: ~ not resolved in psql
Date: 2003-10-30 18:18:05
Message-ID: 10354.80.177.109.207.1067537885.squirrel@io.scheffers.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Peter Eisentraut said:
> This is not a bug. If there is not file named ~ then it can't be
> opened.
I am not trying to open a file named ~, I am using it as part of a file
name, ie: ~/ewap/sql/ewap.sql. (where ~=/home/bas) This is perfectly valid
on any unix system and especialy since tab completion of \i supports it,
so should the function that does the actual opening of the file, I would
think...

Bas.


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Bas Scheffers <bas(at)scheffers(dot)net>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: minor: ~ not resolved in psql
Date: 2003-10-30 18:24:50
Message-ID: 200310301824.h9UIOod20933@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Peter Eisentraut wrote:
> Bas Scheffers writes:
>
> > When opening a file in psql, ~ (the user's home dir) is resolved when
> > using tab completion to find the file, but when you hit enter and psql
> > actualy tries to open it, you get a file not found error.
>
> This is not a bug. If there is not file named ~ then it can't be opened.

If I am in psql and do:

\i ~/<tab>

I see all the files in home directory. If I then type in a file name:

test=> \i ~/server.log
~/server.log: No such file or directory

I get file not found. Sure looks like a bug to me.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Bas Scheffers <bas(at)scheffers(dot)net>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: minor: ~ not resolved in psql
Date: 2003-10-30 18:27:33
Message-ID: 1067538453.14851.10.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Thu, 2003-10-30 at 13:13, Peter Eisentraut wrote:
> Bas Scheffers writes:
>
> > When opening a file in psql, ~ (the user's home dir) is resolved when
> > using tab completion to find the file, but when you hit enter and psql
> > actualy tries to open it, you get a file not found error.
>
> This is not a bug. If there is not file named ~ then it can't be opened.

If the file doesn't exist, then surely tab completion shouldn't pick it
up either.

\i ~/.b<tab><tab> <- picks up files

After finishing a name, hit enter -- the file could not be found.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Bas Scheffers <bas(at)scheffers(dot)net>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: minor: ~ not resolved in psql
Date: 2003-10-30 22:16:14
Message-ID: 3394.1067552174@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Peter Eisentraut wrote:
>> Bas Scheffers writes:
>>> When opening a file in psql, ~ (the user's home dir) is resolved when
>>> using tab completion to find the file, but when you hit enter and psql
>>> actualy tries to open it, you get a file not found error.
>>
>> This is not a bug. If there is not file named ~ then it can't be opened.

> Sure looks like a bug to me.

I think so too. If tab completion can find the file then we ought to be
willing to open it. Changing tab completion to not find the file would
be okay too, or at least consistent. It's the inconsistency that leads
me to call it a bug.

regards, tom lane


From: Francisco Olarte Sanz <folarte(at)peoplecall(dot)com>
To: bas(at)scheffers(dot)net, <peter_e(at)gmx(dot)net>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: minor: ~ not resolved in psql
Date: 2003-10-31 09:46:32
Message-ID: 200310311046.32816.folarte@peoplecall.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Thursday 30 October 2003 19:18, Bas Scheffers wrote:

> > This is not a bug. If there is not file named ~ then it can't be
> > opened.
> I am not trying to open a file named ~, I am using it as part of a file
> name, ie: ~/ewap/sql/ewap.sql. (where ~=/home/bas) This is perfectly valid
> on any unix system and especialy since tab completion of \i supports it,
> so should the function that does the actual opening of the file, I would
> think...

It's not valid in a unix system. It's an expansion performed by most shells.
In my system (Linux, bash2):

[patxifijo:~] ls ~/2do.txt
/home/folarte/2do.txt
[patxifijo:~] ls '~/2do.txt'
ls: ~/2do.txt: No such file or directory

In fact it works with all programs:

[patxifijo:~] echo ~/2do.txt
/home/folarte/2do.txt
[patxifijo:~] echo '~/2do.txt'
~/2do.txt

F.O.S.


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Bas Scheffers <bas(at)scheffers(dot)net>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: minor: ~ not resolved in psql
Date: 2003-11-09 04:23:44
Message-ID: 200311090423.hA94Nit25977@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Peter Eisentraut wrote:
> >> Bas Scheffers writes:
> >>> When opening a file in psql, ~ (the user's home dir) is resolved when
> >>> using tab completion to find the file, but when you hit enter and psql
> >>> actualy tries to open it, you get a file not found error.
> >>
> >> This is not a bug. If there is not file named ~ then it can't be opened.
>
> > Sure looks like a bug to me.
>
> I think so too. If tab completion can find the file then we ought to be
> willing to open it. Changing tab completion to not find the file would
> be okay too, or at least consistent. It's the inconsistency that leads
> me to call it a bug.

Added to TODO:

* Have psql '\i ~/<tab><tab>' actually load files it displays
from home dir

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073