Thread: 9.0 beta2 pg_upgrade command line parsing

9.0 beta2 pg_upgrade command line parsing

From
Steve Singer
Date:
When I try running pg_upgrade from beta2 on an AIX server I'm unable to
get beyond the command line parsing (no matter what command line
arguments I pass in it always complains about the usage).


When I compile pg_upgrade it complains about:

option.c: In function 'parseCommandLine':
option.c:103: warning: comparison is always true due to limited range of
data type

getopt_long  (both our version in ports and the gnu version) is defined
to return an int.

The attach patch allows me to get beyond the options loop under AIX.





--
Steve Singer
Afilias Canada
Data Services Developer
416-673-1142
diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c
index 83300a9..a4760a7 100644
--- a/contrib/pg_upgrade/option.c
+++ b/contrib/pg_upgrade/option.c
@@ -46,7 +46,7 @@ parseCommandLine(migratorContext *ctx, int argc, char *argv[])
         {"verbose", no_argument, NULL, 'v'},
         {NULL, 0, NULL, 0}
     };
-    char        option;            /* Command line option */
+    int        option;            /* Command line option */
     int            optindex = 0;    /* used by getopt_long */
     int            user_id;


Re: 9.0 beta2 pg_upgrade command line parsing

From
Bruce Momjian
Date:
Steve Singer wrote:
> 
> When I try running pg_upgrade from beta2 on an AIX server I'm unable to 
> get beyond the command line parsing (no matter what command line 
> arguments I pass in it always complains about the usage).
> 
> 
> When I compile pg_upgrade it complains about:
> 
> option.c: In function 'parseCommandLine':
> option.c:103: warning: comparison is always true due to limited range of 
> data type
> 
> getopt_long  (both our version in ports and the gnu version) is defined 
> to return an int.
> 
> The attach patch allows me to get beyond the options loop under AIX.

Thanks you.  Patch applied.

---------------------------------------------------------------------------


> 
> 
> 
> 
> 
> -- 
> Steve Singer
> Afilias Canada
> Data Services Developer
> 416-673-1142

[ text/x-patch is unsupported, treating like TEXT/PLAIN ]

> diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c
> index 83300a9..a4760a7 100644
> --- a/contrib/pg_upgrade/option.c
> +++ b/contrib/pg_upgrade/option.c
> @@ -46,7 +46,7 @@ parseCommandLine(migratorContext *ctx, int argc, char *argv[])
>          {"verbose", no_argument, NULL, 'v'},
>          {NULL, 0, NULL, 0}
>      };
> -    char        option;            /* Command line option */
> +    int        option;            /* Command line option */
>      int            optindex = 0;    /* used by getopt_long */
>      int            user_id;
>      

> 
> -- 
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + None of us is going to be here forever. +