Skip to Content.
Sympa Menu

freetds - Re: [freetds] tsql bug fixes that got lost between 0.64 and 0.65

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] tsql bug fixes that got lost between 0.64 and 0.65
  • Date: Thu, 24 Aug 2006 21:21:18 +0200

Il giorno gio, 24/08/2006 alle 13.28 -0400, Christos Zoulas ha scritto:
> On Aug 24, 12:47pm, entropy AT freetds.org (entropy AT freetds.org) wrote:
> -- Subject: Re: [freetds] tsql bug fixes that got lost between 0.64 and 0.65
>
> | Christos Zoulas wrote:
> | > 1. You cannot use readline when stdin is not a tty. You need to use the
> | > home-brewed version. If you don't believe me, try passing a script
> | > to tsql via stdin that has lines that begin with tab. Yes, you
> guessed
> | > it right, readline will helpfully give directory listings.
> |
> | I'm pretty sure I already fixed that in rev 1.88 of tsql.c. What
> | revision do you have?
>
> Well, you did indeed fix it with:
>
> > #ifdef HAVE_READLINE
> > rl_inhibit_completion = 1;
> > #endif
>

I would never though readline was so complicated! I just opened the
header....

> Have you tried strace'ing/truss'ing tsql when it reads an input file?
> Using readline(3), it issues a read(2) per character, not counting the large
> number of failed ioctl(2)'s in the beginning. We have the code in tsql to
> do the readline, why not just use it when we are not connected to the tty?
> This way, in the future, when readline(3) decides to do something else bogus
> with the input stream we are not going to be affected.
>
> christos

Well... tsql was written mainly as a test program so it should not be a
performance problem... however I think you are right. However I not
would test for isatty in my_readline...

I was not able to apply this part

@@ -276,12 +282,10 @@
free(argv);
return 0;
}
-
- if (optind != argc) {
- fprintf(stderr, "flags = %x [%d != %d]\n",
*opt_flags, optind, argc);
- }
-
}
+ if (optind != argc) {
+ fprintf(stderr, "flags = %x [%d != %d]\n", *opt_flags,
optind, argc);
+ }

free(argv);
return 1;

Applied patch at
http://freetds.cvs.sourceforge.net/freetds/freetds/src/apps/tsql.c?r1=1.92&r2=1.93

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page