On Mon, Sep 3, 2012 at 12:44:09PM -0400, Andrew Dunstan wrote: > The attached very small patch allows pg_upgrade's "make check" to > succeed on REL9_2_STABLE on my Mingw system. > > However, I consider the issue I mentioned earlier regarding use of > forward slashes in the argument to rmdir to be a significant > blocker, so I'm going to go and fix that and then pull this all > together. > > cheers > > andrew
> diff --git a/contrib/pg_upgrade/exec.c b/contrib/pg_upgrade/exec.c > index 6f993df..57ca1df 100644 > --- a/contrib/pg_upgrade/exec.c > +++ b/contrib/pg_upgrade/exec.c > @@ -91,10 +91,12 @@ exec_prog(bool throw_error, bool is_priv, const char > *log_file, > else > retval = 0; > > +#ifndef WIN32 > if ((log = fopen_priv(log_file, "a+")) == NULL) > pg_log(PG_FATAL, "cannot write to log file %s\n", log_file); > fprintf(log, "\n\n"); > fclose(log); > +#endif > > return retval; > } OK, I worked with Andrew on this issue, and have applied the attached patch which explains what is happening in this case. Andrew's #ifndef WIN32 was the correct fix. I consider this issue closed. -- Bruce Momjian <br...@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. +
diff --git a/contrib/pg_upgrade/exec.c b/contrib/pg_upgrade/exec.c new file mode 100644 index ac46a9b..99f5006 *** a/contrib/pg_upgrade/exec.c --- b/contrib/pg_upgrade/exec.c *************** exec_prog(const char *log_file, const ch *** 63,70 **** if (written >= MAXCMDLEN) pg_log(PG_FATAL, "command too long\n"); ! if ((log = fopen_priv(log_file, "a+")) == NULL) pg_log(PG_FATAL, "cannot write to log file %s\n", log_file); pg_log(PG_VERBOSE, "%s\n", cmd); fprintf(log, "command: %s\n", cmd); --- 63,73 ---- if (written >= MAXCMDLEN) pg_log(PG_FATAL, "command too long\n"); ! if ((log = fopen_priv(log_file, "a")) == NULL) pg_log(PG_FATAL, "cannot write to log file %s\n", log_file); + #ifdef WIN32 + fprintf(log, "\n\n"); + #endif pg_log(PG_VERBOSE, "%s\n", cmd); fprintf(log, "command: %s\n", cmd); *************** exec_prog(const char *log_file, const ch *** 97,106 **** #ifndef WIN32 /* ! * Can't do this on Windows, postmaster will still hold the log file ! * open if the command was "pg_ctl start". */ ! if ((log = fopen_priv(log_file, "a+")) == NULL) pg_log(PG_FATAL, "cannot write to log file %s\n", log_file); fprintf(log, "\n\n"); fclose(log); --- 100,112 ---- #ifndef WIN32 /* ! * We can't do this on Windows because it will keep the "pg_ctl start" ! * output filename open until the server stops, so we do the \n\n above ! * on that platform. We use a unique filename for "pg_ctl start" that is ! * never reused while the server is running, so it works fine. We could ! * log these commands to a third file, but that just adds complexity. */ ! if ((log = fopen_priv(log_file, "a")) == NULL) pg_log(PG_FATAL, "cannot write to log file %s\n", log_file); fprintf(log, "\n\n"); fclose(log); diff --git a/contrib/pg_upgrade/pg_upgrade.h b/contrib/pg_upgrade/pg_upgrade.h new file mode 100644 index 195b927..3058343 *** a/contrib/pg_upgrade/pg_upgrade.h --- b/contrib/pg_upgrade/pg_upgrade.h *************** extern char *output_files[]; *** 63,69 **** #define SERVER_STOP_LOG_FILE SERVER_LOG_FILE #else #define SERVER_START_LOG_FILE "pg_upgrade_server_start.log" ! /* pg_ctl stop doesn't keep the log file open, so reuse UTILITY_LOG_FILE */ #define SERVER_STOP_LOG_FILE UTILITY_LOG_FILE #endif --- 63,73 ---- #define SERVER_STOP_LOG_FILE SERVER_LOG_FILE #else #define SERVER_START_LOG_FILE "pg_upgrade_server_start.log" ! /* ! * "pg_ctl start" keeps SERVER_START_LOG_FILE and SERVER_LOG_FILE open ! * while the server is running, so we use UTILITY_LOG_FILE for "pg_ctl ! * stop". ! */ #define SERVER_STOP_LOG_FILE UTILITY_LOG_FILE #endif
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers