Re: pgbench: handring empty lines in external scripts

From: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org, itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: pgbench: handring empty lines in external scripts
Date: 2006-08-16 02:26:43
Message-ID: 20060816.112643.86878413.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Thanks. I have committed your patches.
--
Tatsuo Ishii
SRA OSS, Inc. Japan

> Hi Tatsuo-san and folks,
>
> This is a fix in pgbench to handle empty lines in external scripts.
> The manual says
> | Empty lines and lines begging with "--" will be ignored.
> but AFAICS, it cannot accept empty lines and exit with error.
>
>
> The cause seems to be the usage of isspace(). The characters assumed
> spaces are not only ' ' and '\t' but also '\n'. So the empty-lines-test
> should be the below:
>
>
> *** pgbench.orig.c Tue Aug 15 17:04:58 2006
> --- pgbench.c Tue Aug 15 17:06:38 2006
> *************** process_file(char *filename)
> *** 1006,1012 ****
> while (isspace((unsigned char) buf[i]))
> i++;
>
> ! if (strncmp(&buf[i], "\n", 1) != 0 && strncmp(&buf[i], "--", 2) != 0) {
> commands = process_commands(&buf[i]);
> if (commands == NULL)
> {
> --- 1006,1012 ----
> while (isspace((unsigned char) buf[i]))
> i++;
>
> ! if (buf[i] != '\0' && strncmp(&buf[i], "--", 2) != 0) {
> commands = process_commands(&buf[i]);
> if (commands == NULL)
> {
>
> Regards,
> ---
> ITAGAKI Takahiro
> NTT Open Source Software Center
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message mdean 2006-08-16 02:45:37 Re: BugTracker (Was: Re: 8.2 features status)
Previous Message Christopher Browne 2006-08-16 02:21:17 Re: BugTracker

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2006-08-16 06:05:47 Re: [HACKERS] Forcing current WAL file to be archived
Previous Message Bruce Momjian 2006-08-16 00:31:20 Re: [PATCHES] Custom variable class segmentation fault