invalid data in file backup_label problem on windows

From: "Wang, Shenhao" <wangsh(dot)fnst(at)cn(dot)fujitsu(dot)com>
To: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: invalid data in file backup_label problem on windows
Date: 2021-01-10 12:57:53
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi hackers.

When I using a Non-Exclusive Low-Level Backup on windows, "invalid data in file backup_label" will be shown.

The code are listed below

if (fscanf(lfp, "START WAL LOCATION: %X/%X (file %08X%16s)%c",
&hi, &lo, &tli_from_walseg, startxlogfilename, &ch) != 5 || ch != '\n')
errmsg("invalid data in file \"%s\"", BACKUP_LABEL_FILE)));

When I wrote the backup_label on windows, CRLF will at the end of line, so the ch will be '\r'.

I'm not sure that these two files(tablespace_map and backup_label) should not use CRLF new line style is mentioned in manual[1].
How about setting the text mode when reading these 2 files like patch listed in attachment?

Any thought?


Best Regards,
Shenhao Wang

Attachment Content-Type Size
0001-set-text-mode-when-reading-backup_label-and-tablesap.patch application/octet-stream 1.2 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2021-01-10 14:51:16 Re: Key management with tests
Previous Message Tatsuo Ishii 2021-01-10 11:22:42 Inconsistent "<acronym>" use