Re: Yikes! Bitten by line length?

Поиск
Список
Период
Сортировка
От Ken Corey
Тема Re: Yikes! Bitten by line length?
Дата
Msg-id 3A6742C8.799CA6DC@kencorey.com
обсуждение исходный текст
Ответ на Yikes! Bitten by line length?  (Ken Corey <ken@kencorey.com>)
Ответы Re: Yikes! Bitten by line length?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
Tom Lane wrote:
[...] extraneous bug description removed.
> > Solaris' fgets function *only* returns the last part of a string if the
> > string is over 256 bytes!  The test was this little program:
>
> > #include <stdio.h>
> > int main(int argc,char **argv) {
> >   char line[1024];
> >   while((fgets(line,1024,stdin)) != EOF) {
> >     printf("Got '%s'\n",line);
> >   }
> > }
>
> > Enter in really big lines (> 256 characters), and you'll see what I
> > mean.
>
> Yeesh.  I wonder if any other Unixen are equally broken?

FWIW, I tested it on my Linux box (2.2.15-4mdk, a mandrake 7.2 distro),
and it worked fine.  I can't speak to other unixes.

> Perhaps we should reduce psql's fgets() buffers to 256 bytes or less to
> avoid this problem?

Hrm...I don't know so much about that.  That would limit it on boxes
where the fgets works as advertised.

Actually, how hard is it to add another test to the auto-configurtion
file?  The little program above is small enough that it should be a
fairly simple deal to compile it during configuration, pipe input
through it, and see if fputs is limited. If it is, then the
configuration script could output a big warning message saying 'for your
own good, download and install readline, and then recompile'.

*shrug* At the very least, perhaps it could be put in the FAQ and/or
install docs?

-Ken

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

Предыдущее
От: Ken Corey
Дата:
Сообщение: Re: Yikes! Bitten by line length?
Следующее
От: "zivit"
Дата:
Сообщение: ERROR: plpgsql: cache lookup from pg_proc failed -- Why?