Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc5c8212

Browse files
committed
pg_combinebackup: Error message improvements
Make the wordings of some file-related error messages more like thoseused in other files.
1 parentaea7988 commitc5c8212

File tree

6 files changed

+32
-34
lines changed

6 files changed

+32
-34
lines changed

‎src/bin/pg_combinebackup/backup_label.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ write_backup_label(char *output_directory, StringInfo buf,
159159
if (wb<0)
160160
pg_fatal("could not write file \"%s\": %m",output_filename);
161161
else
162-
pg_fatal("could not write file \"%s\": wroteonly%d of %d bytes",
162+
pg_fatal("could not write file \"%s\": wrote %d of %d",
163163
output_filename, (int)wb, (int) (e-s));
164164
}
165165
if (pg_checksum_update(&checksum_ctx, (uint8*)s,e-s)<0)
@@ -171,7 +171,7 @@ write_backup_label(char *output_directory, StringInfo buf,
171171
}
172172

173173
if (close(output_fd)!=0)
174-
pg_fatal("could not close \"%s\": %m",output_filename);
174+
pg_fatal("could not closefile\"%s\": %m",output_filename);
175175

176176
checksum_length=pg_checksum_final(&checksum_ctx,checksum_payload);
177177

‎src/bin/pg_combinebackup/copy_file.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ copy_file(const char *src, const char *dst,
5959
intfd;
6060

6161
if ((fd=open(src,O_RDONLY |PG_BINARY,0))<0)
62-
pg_fatal("could not open \"%s\": %m",src);
62+
pg_fatal("could not openfile\"%s\": %m",src);
6363
if (close(fd)<0)
64-
pg_fatal("could not close \"%s\": %m",src);
64+
pg_fatal("could not closefile\"%s\": %m",src);
6565
}
6666

6767
#ifdefWIN32
@@ -179,10 +179,10 @@ copy_file_blocks(const char *src, const char *dst,
179179
if ((wb=write(dest_fd,buffer,rb))!=rb)
180180
{
181181
if (wb<0)
182-
pg_fatal("could not write file \"%s\": %m",dst);
182+
pg_fatal("could not writetofile \"%s\": %m",dst);
183183
else
184-
pg_fatal("could not write file \"%s\": wroteonly%d of %d bytes at offset %u",
185-
dst, (int)wb, (int)rb,offset);
184+
pg_fatal("could not writetofile \"%s\", offset %u: wrote %d of %d",
185+
dst,offset,(int)wb, (int)rb);
186186
}
187187

188188
if (pg_checksum_update(checksum_ctx,buffer,rb)<0)
@@ -192,7 +192,7 @@ copy_file_blocks(const char *src, const char *dst,
192192
}
193193

194194
if (rb<0)
195-
pg_fatal("could not read file \"%s\": %m",dst);
195+
pg_fatal("could not readfromfile \"%s\": %m",dst);
196196

197197
pg_free(buffer);
198198
close(src_fd);
@@ -287,7 +287,7 @@ copy_file_copyfile(const char *src, const char *dst,
287287
if (CopyFile(src,dst, true)==0)
288288
{
289289
_dosmaperr(GetLastError());
290-
pg_fatal("could not copy \"%s\" to \"%s\": %m",src,dst);
290+
pg_fatal("could not copyfile\"%s\" to \"%s\": %m",src,dst);
291291
}
292292

293293
/* if needed, calculate checksum of the file */

‎src/bin/pg_combinebackup/load_manifest.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ load_backup_manifest(char *backup_directory)
122122
{
123123
if (errno==ENOENT)
124124
{
125-
pg_log_warning("\"%s\" does not exist",pathname);
125+
pg_log_warning("file\"%s\" does not exist",pathname);
126126
returnNULL;
127127
}
128128
pg_fatal("could not open file \"%s\": %m",pathname);

‎src/bin/pg_combinebackup/pg_combinebackup.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ check_backup_label_files(int n_backups, char **backup_dirs)
523523

524524
/* Close the file. */
525525
if (close(fd)!=0)
526-
pg_fatal("could not close \"%s\": %m",pathbuf);
526+
pg_fatal("could not closefile\"%s\": %m",pathbuf);
527527

528528
/* Parse the file contents. */
529529
parse_backup_label(pathbuf,buf,&start_tli,&start_lsn,
@@ -661,7 +661,7 @@ check_input_dir_permissions(char *dir)
661661
structstatst;
662662

663663
if (stat(dir,&st)!=0)
664-
pg_fatal("could not stat \"%s\": %m",dir);
664+
pg_fatal("could not statfile\"%s\": %m",dir);
665665

666666
SetDataDirectoryCreatePerm(st.st_mode);
667667
}
@@ -1159,7 +1159,7 @@ read_pg_version_file(char *directory)
11591159

11601160
/* Close the file. */
11611161
if (close(fd)!=0)
1162-
pg_fatal("could not close \"%s\": %m",filename);
1162+
pg_fatal("could not closefile\"%s\": %m",filename);
11631163

11641164
/* Convert to integer. */
11651165
errno=0;
@@ -1178,7 +1178,7 @@ read_pg_version_file(char *directory)
11781178
}
11791179

11801180
/* Debugging output. */
1181-
pg_log_debug("read server version %d from \"%s\"",version,filename);
1181+
pg_log_debug("read server version %d fromfile\"%s\"",version,filename);
11821182

11831183
/* Release memory and return result. */
11841184
pfree(buf.data);
@@ -1296,10 +1296,10 @@ scan_for_existing_tablespaces(char *pathname, cb_options *opt)
12961296
pg_fatal("could not read symbolic link \"%s\": %m",
12971297
tblspcdir);
12981298
if (link_length >=sizeof(link_target))
1299-
pg_fatal("symbolic link \"%s\" is too long",tblspcdir);
1299+
pg_fatal("target ofsymbolic link \"%s\" is too long",tblspcdir);
13001300
link_target[link_length]='\0';
13011301
if (!is_absolute_path(link_target))
1302-
pg_fatal("symbolic link \"%s\" is relative",tblspcdir);
1302+
pg_fatal("target ofsymbolic link \"%s\" is relative",tblspcdir);
13031303

13041304
/* Canonicalize the link target. */
13051305
canonicalize_path(link_target);
@@ -1339,7 +1339,7 @@ scan_for_existing_tablespaces(char *pathname, cb_options *opt)
13391339
/* Tablespaces should not share a directory. */
13401340
for (otherts=tslist;otherts!=NULL;otherts=otherts->next)
13411341
if (strcmp(ts->new_dir,otherts->new_dir)==0)
1342-
pg_fatal("tablespaces with OIDs %u and %u both point at \"%s\"",
1342+
pg_fatal("tablespaces with OIDs %u and %u both point atdirectory\"%s\"",
13431343
otherts->oid,oid,ts->new_dir);
13441344

13451345
/* Add this tablespace to the list. */
@@ -1367,7 +1367,7 @@ slurp_file(int fd, char *filename, StringInfo buf, int maxlen)
13671367

13681368
/* Check file size, and complain if it's too large. */
13691369
if (fstat(fd,&st)!=0)
1370-
pg_fatal("could not stat \"%s\": %m",filename);
1370+
pg_fatal("could not statfile\"%s\": %m",filename);
13711371
if (st.st_size>maxlen)
13721372
pg_fatal("file \"%s\" is too large",filename);
13731373

@@ -1386,7 +1386,7 @@ slurp_file(int fd, char *filename, StringInfo buf, int maxlen)
13861386
if (rb<0)
13871387
pg_fatal("could not read file \"%s\": %m",filename);
13881388
else
1389-
pg_fatal("could not read file \"%s\": readonly%zd of %lld bytes",
1389+
pg_fatal("could not read file \"%s\": read %zd of %lld",
13901390
filename,rb, (long longint)st.st_size);
13911391
}
13921392

‎src/bin/pg_combinebackup/reconstruct.c‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ reconstruct_from_incremental_file(char *input_filename,
196196

197197
/* We need to know the length of the file. */
198198
if (fstat(s->fd,&sb)<0)
199-
pg_fatal("could not stat \"%s\": %m",s->filename);
199+
pg_fatal("could not statfile\"%s\": %m",s->filename);
200200

201201
/*
202202
* Since we found a full file, source all blocks from it that
@@ -297,8 +297,7 @@ reconstruct_from_incremental_file(char *input_filename,
297297
* The directory is out of sync with the backup_manifest, so emit
298298
* a warning.
299299
*/
300-
/*- translator: the first %s is a backup manifest file, the second is a file absent therein */
301-
pg_log_warning("\"%s\" contains no entry for \"%s\"",
300+
pg_log_warning("manifest file \"%s\" contains no entry for file \"%s\"",
302301
path,
303302
manifest_path);
304303
pfree(path);
@@ -354,7 +353,7 @@ reconstruct_from_incremental_file(char *input_filename,
354353
if (s==NULL)
355354
continue;
356355
if (close(s->fd)!=0)
357-
pg_fatal("could not close \"%s\": %m",s->filename);
356+
pg_fatal("could not closefile\"%s\": %m",s->filename);
358357
if (s->relative_block_numbers!=NULL)
359358
pfree(s->relative_block_numbers);
360359
pg_free(s->filename);
@@ -406,7 +405,7 @@ debug_reconstruction(int n_source, rfile **sources, bool dry_run)
406405
structstatsb;
407406

408407
if (fstat(s->fd,&sb)<0)
409-
pg_fatal("could not stat \"%s\": %m",s->filename);
408+
pg_fatal("could not statfile\"%s\": %m",s->filename);
410409
if (sb.st_size<s->highest_offset_read)
411410
pg_fatal("file \"%s\" is too short: expected %llu, found %llu",
412411
s->filename,
@@ -527,7 +526,7 @@ read_bytes(rfile *rf, void *buffer, unsigned length)
527526
if (rb<0)
528527
pg_fatal("could not read file \"%s\": %m",rf->filename);
529528
else
530-
pg_fatal("could not read file \"%s\": readonly%d of %u bytes",
529+
pg_fatal("could not read file \"%s\": read %d of %u",
531530
rf->filename,rb,length);
532531
}
533532
}
@@ -725,7 +724,7 @@ write_reconstructed_file(char *input_filename,
725724

726725
/* Close the output file. */
727726
if (wfd >=0&&close(wfd)!=0)
728-
pg_fatal("could not close \"%s\": %m",output_filename);
727+
pg_fatal("could not closefile\"%s\": %m",output_filename);
729728
}
730729

731730
/*
@@ -746,7 +745,7 @@ write_block(int fd, char *output_filename,
746745
if (wb<0)
747746
pg_fatal("could not write file \"%s\": %m",output_filename);
748747
else
749-
pg_fatal("could not write file \"%s\": wroteonly%d of %d bytes",
748+
pg_fatal("could not write file \"%s\": wrote %d of %d",
750749
output_filename,wb,BLCKSZ);
751750
}
752751

@@ -769,10 +768,9 @@ read_block(rfile *s, off_t off, uint8 *buffer)
769768
if (rb!=BLCKSZ)
770769
{
771770
if (rb<0)
772-
pg_fatal("could not read file \"%s\": %m",s->filename);
771+
pg_fatal("could not readfromfile \"%s\": %m",s->filename);
773772
else
774-
pg_fatal("could not read file \"%s\": read only %d of %d bytes at offset %llu",
775-
s->filename,rb,BLCKSZ,
776-
(unsigned long long)off);
773+
pg_fatal("could not read from file \"%s\", offset %llu: read %d of %d",
774+
s->filename, (unsigned long long)off,rb,BLCKSZ);
777775
}
778776
}

‎src/bin/pg_combinebackup/write_manifest.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ finalize_manifest(manifest_writer *mwriter,
184184

185185
/* Close the file. */
186186
if (close(mwriter->fd)!=0)
187-
pg_fatal("could not close \"%s\": %m",mwriter->pathname);
187+
pg_fatal("could not closefile\"%s\": %m",mwriter->pathname);
188188
mwriter->fd=-1;
189189
}
190190

@@ -257,9 +257,9 @@ flush_manifest(manifest_writer *mwriter)
257257
if (wb!=mwriter->buf.len)
258258
{
259259
if (wb<0)
260-
pg_fatal("could not write \"%s\": %m",mwriter->pathname);
260+
pg_fatal("could not writefile\"%s\": %m",mwriter->pathname);
261261
else
262-
pg_fatal("could not write file \"%s\": wroteonly%d of %d bytes",
262+
pg_fatal("could not write file \"%s\": wrote %d of %d",
263263
mwriter->pathname, (int)wb,mwriter->buf.len);
264264
}
265265

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp