Adjust pg_upgrade FATAL error messages to have consistent newlines.
authorBruce Momjian
Sat, 7 May 2011 01:47:12 +0000 (21:47 -0400)
committerBruce Momjian
Sat, 7 May 2011 01:47:42 +0000 (21:47 -0400)
Also adjust some error message capitalization for consistency.

contrib/pg_upgrade/check.c
contrib/pg_upgrade/exec.c
contrib/pg_upgrade/file.c
contrib/pg_upgrade/option.c
contrib/pg_upgrade/pg_upgrade.c
contrib/pg_upgrade/server.c
contrib/pg_upgrade/util.c
contrib/pg_upgrade/version.c
contrib/pg_upgrade/version_old_8_3.c

index a9436ce5b2f237730dfc4b9410104d98cfa85512..35b178e8286e7d0cf4c07fe50f159e45a06bce14 100644 (file)
@@ -253,7 +253,7 @@ check_cluster_compatibility(bool live_check)
 
    if ((lib_test = fopen(libfile, "r")) == NULL)
        pg_log(PG_FATAL,
-              "\npg_upgrade_support%s must be created and installed in %s\n", DLSUFFIX, libfile);
+              "pg_upgrade_support%s must be created and installed in %s\n", DLSUFFIX, libfile);
    else
        fclose(lib_test);
 
index 59a76bc8aec075b72b0848c361ef4e2c2fe7fe50..71e84394e67a3561721f2cf0cdb32211a8e60574 100644 (file)
@@ -46,7 +46,7 @@ exec_prog(bool throw_error, const char *fmt,...)
    if (result != 0)
    {
        pg_log(throw_error ? PG_FATAL : PG_INFO,
-              "\nThere were problems executing %s\n", cmd);
+              "There were problems executing %s\n", cmd);
        return 1;
    }
 
@@ -71,7 +71,7 @@ is_server_running(const char *datadir)
    if ((fd = open(path, O_RDONLY, 0)) < 0)
    {
        if (errno != ENOENT)
-           pg_log(PG_FATAL, "\ncould not open file \"%s\" for reading\n",
+           pg_log(PG_FATAL, "could not open file \"%s\" for reading\n",
                   path);
 
        return false;
@@ -139,10 +139,10 @@ check_data_dir(const char *pg_data)
                 requiredSubdirs[subdirnum]);
 
        if (stat(subDirName, &statBuf) != 0)
-           report_status(PG_FATAL, "check for %s failed:  %s",
+           report_status(PG_FATAL, "check for %s failed:  %s\n",
                          requiredSubdirs[subdirnum], getErrorText(errno));
        else if (!S_ISDIR(statBuf.st_mode))
-           report_status(PG_FATAL, "%s is not a directory",
+           report_status(PG_FATAL, "%s is not a directory\n",
                          requiredSubdirs[subdirnum]);
    }
 }
index 0552541c2447e7f043e9aa54acecf4289b291bfe..a7e40090e2f3fef5cb51187f163d0eb9a727abcc 100644 (file)
@@ -287,7 +287,7 @@ pg_scandir_internal(const char *dirname,
    size_t      entrysize;
 
    if ((dirdesc = opendir(dirname)) == NULL)
-       pg_log(PG_FATAL, "Could not open directory \"%s\": %m\n", dirname);
+       pg_log(PG_FATAL, "could not open directory \"%s\": %m\n", dirname);
 
    *namelist = NULL;
 
index 483857046faf9529befe65f0fe683ec5a6726557..f1091ba5bf341d9810bafdd1535f9e64451c956b 100644 (file)
@@ -180,10 +180,10 @@ parseCommandLine(int argc, char *argv[])
         */
        /* truncate */
        if ((log_opts.fd = fopen(log_opts.filename, "w")) == NULL)
-           pg_log(PG_FATAL, "Cannot write to log file %s\n", log_opts.filename);
+           pg_log(PG_FATAL, "cannot write to log file %s\n", log_opts.filename);
        fclose(log_opts.fd);
        if ((log_opts.fd = fopen(log_opts.filename, "a")) == NULL)
-           pg_log(PG_FATAL, "Cannot write to log file %s\n", log_opts.filename);
+           pg_log(PG_FATAL, "cannot write to log file %s\n", log_opts.filename);
    }
    else
        log_opts.filename = strdup(DEVNULL);
@@ -193,7 +193,7 @@ parseCommandLine(int argc, char *argv[])
    {
        log_opts.debug_fd = fopen(DEVTTY, "w");
        if (!log_opts.debug_fd)
-           pg_log(PG_FATAL, "Cannot write to terminal\n");
+           pg_log(PG_FATAL, "cannot write to terminal\n");
    }
 
    /* Get values from env if not already set */
index 9f7a5387655db5b30b00f4117597b43a1232d58a..857e82901bf53f336f82e7f0bbb36328adb2b54e 100644 (file)
@@ -302,7 +302,7 @@ copy_clog_xlog_xid(void)
    snprintf(old_clog_path, sizeof(old_clog_path), "%s/pg_clog", old_cluster.pgdata);
    snprintf(new_clog_path, sizeof(new_clog_path), "%s/pg_clog", new_cluster.pgdata);
    if (!rmtree(new_clog_path, true))
-       pg_log(PG_FATAL, "Unable to delete directory %s\n", new_clog_path);
+       pg_log(PG_FATAL, "unable to delete directory %s\n", new_clog_path);
    check_ok();
 
    prep_status("Copying old commit clogs to new server");
index 935ce32a611425f91d6a5f1fe477afd1ccaf445a..9a550756e56acffd115465a2febf35525ef44123 100644 (file)
@@ -192,7 +192,7 @@ start_postmaster(ClusterInfo *cluster)
        if (conn)
            PQfinish(conn);
        pg_log(PG_FATAL, "unable to connect to %s postmaster started with the command: %s\n"
-              "Perhaps pg_hba.conf was not set to \"trust\".",
+              "Perhaps pg_hba.conf was not set to \"trust\".\n",
               CLUSTER_NAME(cluster), cmd);
    }
    PQfinish(conn);
index 9a6691ce75f94f0cd353f4e331ac12ab2661febf..9b0bf0f82a7380dc7188bf5d5b198dccd06c5c28 100644 (file)
@@ -46,7 +46,7 @@ report_status(eLogType type, const char *fmt,...)
  *     if(( message = flarbFiles(fileCount)) == NULL)
  *       report_status(PG_REPORT, "ok" );
  *     else
- *       pg_log(PG_FATAL, "failed - %s", message );
+ *       pg_log(PG_FATAL, "failed - %s\n", message );
  */
 void
 prep_status(const char *fmt,...)
@@ -97,8 +97,7 @@ pg_log(eLogType type, char *fmt,...)
            break;
 
        case PG_FATAL:
-           printf("%s", "\n");
-           printf("%s", _(message));
+           printf("\n%s", _(message));
            printf("Failure, exiting\n");
            exit(1);
            break;
index 8ba7e98d922990e8af59c6249a22c5bd74926d47..958bcbb80fe151ad8eee46533190f754a154bc53 100644 (file)
@@ -49,7 +49,7 @@ new_9_0_populate_pg_largeobject_metadata(ClusterInfo *cluster, bool check_mode)
            if (!check_mode)
            {
                if (script == NULL && (script = fopen(output_path, "w")) == NULL)
-                   pg_log(PG_FATAL, "Could not create necessary file:  %s\n", output_path);
+                   pg_log(PG_FATAL, "could not create necessary file:  %s\n", output_path);
                fprintf(script, "\\connect %s\n",
                        quote_identifier(active_db->db_name));
                fprintf(script,
index 0a60eec926b54764c76dbc68be64cb7d2908c25c..1a31f8d68350914eb7d779ea13b2dcbe537ef830 100644 (file)
@@ -70,7 +70,7 @@ old_8_3_check_for_name_data_type_usage(ClusterInfo *cluster)
        {
            found = true;
            if (script == NULL && (script = fopen(output_path, "w")) == NULL)
-               pg_log(PG_FATAL, "Could not create necessary file:  %s\n", output_path);
+               pg_log(PG_FATAL, "could not create necessary file:  %s\n", output_path);
            if (!db_used)
            {
                fprintf(script, "Database:  %s\n", active_db->db_name);
@@ -160,7 +160,7 @@ old_8_3_check_for_tsquery_usage(ClusterInfo *cluster)
        {
            found = true;
            if (script == NULL && (script = fopen(output_path, "w")) == NULL)
-               pg_log(PG_FATAL, "Could not create necessary file:  %s\n", output_path);
+               pg_log(PG_FATAL, "could not create necessary file:  %s\n", output_path);
            if (!db_used)
            {
                fprintf(script, "Database:  %s\n", active_db->db_name);
@@ -278,7 +278,7 @@ old_8_3_rebuild_tsvector_tables(ClusterInfo *cluster, bool check_mode)
            if (!check_mode)
            {
                if (script == NULL && (script = fopen(output_path, "w")) == NULL)
-                   pg_log(PG_FATAL, "Could not create necessary file:  %s\n", output_path);
+                   pg_log(PG_FATAL, "could not create necessary file:  %s\n", output_path);
                if (!db_used)
                {
                    fprintf(script, "\\connect %s\n\n",
@@ -398,7 +398,7 @@ old_8_3_invalidate_hash_gin_indexes(ClusterInfo *cluster, bool check_mode)
            if (!check_mode)
            {
                if (script == NULL && (script = fopen(output_path, "w")) == NULL)
-                   pg_log(PG_FATAL, "Could not create necessary file:  %s\n", output_path);
+                   pg_log(PG_FATAL, "could not create necessary file:  %s\n", output_path);
                if (!db_used)
                {
                    fprintf(script, "\\connect %s\n",
@@ -523,7 +523,7 @@ old_8_3_invalidate_bpchar_pattern_ops_indexes(ClusterInfo *cluster,
            if (!check_mode)
            {
                if (script == NULL && (script = fopen(output_path, "w")) == NULL)
-                   pg_log(PG_FATAL, "Could not create necessary file:  %s\n", output_path);
+                   pg_log(PG_FATAL, "could not create necessary file:  %s\n", output_path);
                if (!db_used)
                {
                    fprintf(script, "\\connect %s\n",
@@ -648,7 +648,7 @@ old_8_3_create_sequence_script(ClusterInfo *cluster)
            found = true;
 
            if (script == NULL && (script = fopen(output_path, "w")) == NULL)
-               pg_log(PG_FATAL, "Could not create necessary file:  %s\n", output_path);
+               pg_log(PG_FATAL, "could not create necessary file:  %s\n", output_path);
            if (!db_used)
            {
                fprintf(script, "\\connect %s\n\n",