If USE_READLINE exists, but HAVE_RL_FILENAME_COMPLETION_FUNCTION does not,
-current build breaks:
gcc -O2 -pipe -Wall -Wmissing-prototypes -Wmissing-declarations
-I../../../src/interfaces/libpq -I../../../src/include   -c tab-complete.c
-o tab-complete.o
tab-complete.c: In function `psql_completion':
tab-complete.c:754: `filename_completion_function' undeclared (first use
in this function)
tab-complete.c:754: (Each undeclared identifier is reported only once
tab-complete.c:754: for each function it appears in.)

I am not sure what should it be defined as when RL_FILENAME_COMPLETION is
not available...?

-alex


Fri, 15 Jun 2001 18:54:59 -0400 (EDT)
Alex Pilosov <alex@pilosoft.com>
[current] readline breakage 
Alex Pilosov writes:

> If USE_READLINE exists, but HAVE_RL_FILENAME_COMPLETION_FUNCTION does not,
> -current build breaks:
> gcc -O2 -pipe -Wall -Wmissing-prototypes -Wmissing-declarations
> -I../../../src/interfaces/libpq -I../../../src/include   -c tab-complete.c
> -o tab-complete.o
> tab-complete.c: In function `psql_completion':
> tab-complete.c:754: `filename_completion_function' undeclared (first use
> in this function)
> tab-complete.c:754: (Each undeclared identifier is reported only once
> tab-complete.c:754: for each function it appears in.)
>
> I am not sure what should it be defined as when RL_FILENAME_COMPLETION is
> not available...?

It should be in the readline.h header file.  Is this yet another case of a
broken OpenBSD readline installation?

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Sat, 16 Jun 2001 01:15:07 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: [current] readline breakage 
On Sat, 16 Jun 2001, Peter Eisentraut wrote:

> Alex Pilosov writes:
> 
> > If USE_READLINE exists, but HAVE_RL_FILENAME_COMPLETION_FUNCTION does not,
> > -current build breaks:
> > gcc -O2 -pipe -Wall -Wmissing-prototypes -Wmissing-declarations
> > -I../../../src/interfaces/libpq -I../../../src/include   -c tab-complete.c
> > -o tab-complete.o
> > tab-complete.c: In function `psql_completion':
> > tab-complete.c:754: `filename_completion_function' undeclared (first use
> > in this function)
> > tab-complete.c:754: (Each undeclared identifier is reported only once
> > tab-complete.c:754: for each function it appears in.)
> >
> > I am not sure what should it be defined as when RL_FILENAME_COMPLETION is
> > not available...?
> 
> It should be in the readline.h header file.  Is this yet another case of a
> broken OpenBSD readline installation?

Yeah, sorry, my fault. OpenBSD 2.8 ships with a broken readline (dated
1996). 2.9 has a recent GNU readline. I don't think its worth supporting
2.8 readline either, but I forgot to check the archives.

-alex


Fri, 15 Jun 2001 22:13:51 -0400 (EDT)
Alex Pilosov <alex@pilosoft.com>
Re: [current] readline breakage 
Alex Pilosov writes:

> > > tab-complete.c: In function `psql_completion':
> > > tab-complete.c:754: `filename_completion_function' undeclared (first use
> > > in this function)

> Yeah, sorry, my fault. OpenBSD 2.8 ships with a broken readline (dated
> 1996). 2.9 has a recent GNU readline. I don't think its worth supporting
> 2.8 readline either, but I forgot to check the archives.

We used to declare filename_completion_function explicitly, but it seems
to have been removed recently by a Cygwin-related patch from Jason
Tishler.  Jason, was this required to work on Cygwin or was it merely a
"cleaning up" issue?

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Sat, 16 Jun 2001 18:51:59 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: [current] readline breakage 
Peter,

[This may not make it to pgsql-hackers since I'm not subscribed, feel
free to forward it on my behalf...]

On Sat, Jun 16, 2001 at 06:51:59PM +0200, Peter Eisentraut wrote:
> Alex Pilosov writes:
> 
> > > > tab-complete.c: In function `psql_completion':
> > > > tab-complete.c:754: `filename_completion_function' undeclared (first use
> > > > in this function)
> 
> > Yeah, sorry, my fault. OpenBSD 2.8 ships with a broken readline (dated
> > 1996). 2.9 has a recent GNU readline. I don't think its worth supporting
> > 2.8 readline either, but I forgot to check the archives.
> 
> We used to declare filename_completion_function explicitly, but it seems
> to have been removed recently by a Cygwin-related patch from Jason
> Tishler.  Jason, was this required to work on Cygwin or was it merely a
> "cleaning up" issue?

Yes, this change is required under Cygwin when building against
readline 4.2.  Note that my patch is modeled after the one that you
did for completion_matches():

    http://www.ca.postgresql.org/~petere/rl42-pg.patch

Shouldn't the declaration for filename_completion_function() be picked up
via readline.h?  IMO, redeclaring functions especially from an external
library (i.e., readline) is generally not considered good programming
practice.

Thanks,
Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: 732.264.8770 x235
Dot Hill Systems Corp.               Fax:   732.264.8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

Sat, 16 Jun 2001 22:10:27 -0400
Jason Tishler <Jason.Tishler@dothill.com>
Re: [current] readline breakage
Jason Tishler writes:

> Shouldn't the declaration for filename_completion_function() be picked up
> via readline.h?  IMO, redeclaring functions especially from an external
> library (i.e., readline) is generally not considered good programming
> practice.

It should, but on some systems it evidently isn't.  But since on Cygwin a
correct import/export decorated declaration should be in the header files,
would a second declaration without those attributes override or otherwise
interfere with that?  Otherwise I might have to stick it back covered by
some #ifdef's.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Sun, 17 Jun 2001 12:08:59 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: [current] readline breakage
Peter,

On Sun, Jun 17, 2001 at 12:08:59PM +0200, Peter Eisentraut wrote:
> Jason Tishler writes:
> 
> > Shouldn't the declaration for filename_completion_function() be picked up
> > via readline.h?  IMO, redeclaring functions especially from an external
> > library (i.e., readline) is generally not considered good programming
> > practice.
> 
> It should, but on some systems it evidently isn't.  But since on Cygwin a
> correct import/export decorated declaration should be in the header files,
> would a second declaration without those attributes override or otherwise
> interfere with that?

No, after applying the attached patch, Cygwin psql built against readline
4.2 without any problems.  After some reflection, this outcome should
have been obvious to me since my previous distributions built fine with
the duplicate (but different) filename_completion_function() declarations.

Note that I did not test this patch against the other three configuration
that I used to test my original patch but I would not anticipate any issues
with these configurations either.

> Otherwise I might have to stick it back covered by some #ifdef's.

The #ifdefs do not appear to be necessary.

Do you want to submit this patch to pgsql-patches or should I?

Thanks,
Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: 732.264.8770 x235
Dot Hill Systems Corp.               Fax:   732.264.8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com
Sun, 17 Jun 2001 20:50:23 -0400
Jason Tishler <Jason.Tishler@dothill.com>
Re: [current] readline breakage
I have checked this in:

*** tab-complete.c      2001/06/11 22:12:48     1.33
--- tab-complete.c      2001/06/20 18:37:09
***************
*** 62,67 ****
--- 62,70 ----

  #ifdef HAVE_RL_FILENAME_COMPLETION_FUNCTION
  #define filename_completion_function rl_filename_completion_function
+ #else
+ /* missing in some header files */
+ extern char *filename_completion_function();
  #endif

  #ifdef HAVE_RL_COMPLETION_MATCHES

I hope it still works for both of you. ;-)


Jason Tishler writes:

> Peter,
>
> On Sun, Jun 17, 2001 at 12:08:59PM +0200, Peter Eisentraut wrote:
> > Jason Tishler writes:
> >
> > > Shouldn't the declaration for filename_completion_function() be picked up
> > > via readline.h?  IMO, redeclaring functions especially from an external
> > > library (i.e., readline) is generally not considered good programming
> > > practice.
> >
> > It should, but on some systems it evidently isn't.  But since on Cygwin a
> > correct import/export decorated declaration should be in the header files,
> > would a second declaration without those attributes override or otherwise
> > interfere with that?
>
> No, after applying the attached patch, Cygwin psql built against readline
> 4.2 without any problems.  After some reflection, this outcome should
> have been obvious to me since my previous distributions built fine with
> the duplicate (but different) filename_completion_function() declarations.
>
> Note that I did not test this patch against the other three configuration
> that I used to test my original patch but I would not anticipate any issues
> with these configurations either.
>
> > Otherwise I might have to stick it back covered by some #ifdef's.
>
> The #ifdefs do not appear to be necessary.
>
> Do you want to submit this patch to pgsql-patches or should I?
>
> Thanks,
> Jason
>
>

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Wed, 20 Jun 2001 20:42:06 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: [current] readline breakage
Peter,

On Wed, Jun 20, 2001 at 08:42:06PM +0200, Peter Eisentraut wrote:
> I have checked this in:
> 
> *** tab-complete.c      2001/06/11 22:12:48     1.33
> --- tab-complete.c      2001/06/20 18:37:09
> ***************
> *** 62,67 ****
> --- 62,70 ----
> 
>   #ifdef HAVE_RL_FILENAME_COMPLETION_FUNCTION
>   #define filename_completion_function rl_filename_completion_function
> + #else
> + /* missing in some header files */
> + extern char *filename_completion_function();
>   #endif
> 
>   #ifdef HAVE_RL_COMPLETION_MATCHES
> 
> I hope it still works for both of you. ;-)

I just tried the above with Cygwin/readline 4.2 (which is more important
than Cygwin/readline 4.1 -- at least to me) and it still works.

Thanks,
Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: 732.264.8770 x235
Dot Hill Systems Corp.               Fax:   732.264.8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

Thu, 21 Jun 2001 08:56:11 -0400
Jason Tishler <Jason.Tishler@dothill.com>
Re: [current] readline breakage