forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8620a7f
committed
Code review for server's handling of "tablespace map" files.
While looking at Robert Foggia's report, I noticed a passel ofother issues in the same area:* The scheme for backslash-quoting newlines in pathnames is justwrong; it will misbehave if the last ordinary character in a pathnameis a backslash. I'm not sure why we're bothering to allow newlinesin tablespace paths, but if we're going to do it we should do itwithout introducing other problems. Hence, backslashes themselveshave to be backslashed too.* The author hadn't read the sscanf man page very carefully, becausethis code would drop any leading whitespace from the path. (I doubtthat a tablespace path with leading whitespace could happen inpractice; but if we're bothering to allow newlines in the path, itsure seems like leading whitespace is little less implausible.) Usingsscanf for the task of finding the first space is overkill anyway.* While I'm not 100% sure what the rationale for escaping both \r and\n is, if the idea is to allow Windows newlines in the file then thiscode failed, because it'd throw an error if it saw \r followed by \n.* There's no cross-check for an incomplete final line in the map file,which would be a likely apparent symptom of the improper-escapingbug.On the generation end, aside from the escaping issue we have:* If needtblspcmapfile is true then do_pg_start_backup will pass backescaped strings in tablespaceinfo->path values, which no caller wantsor is prepared to deal with. I'm not sure if there's a live bug fromthat, but it looks like there might be (given the dubious assumptionthat anyone actually has newlines in their tablespace paths).* It's not being very paranoid about the possibility of random stuffin the pg_tblspc directory. IMO we should ignore anything without anOID-like name.The escaping rule change doesn't seem back-patchable: it'll requiredoubling of backslashes in the tablespace_map file, which is basicallya basebackup format change. The odds of that causing trouble areconsiderably more than the odds of the existing bug causing trouble.The rest of this seems somewhat unlikely to cause problems too,so no back-patch.1 parenta50e4fd commit8620a7f
File tree
5 files changed
+82
-64
lines changed- src
- backend
- access/transam
- replication
- include
- access
- replication
5 files changed
+82
-64
lines changedLines changed: 68 additions & 55 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10702 | 10702 |
| |
10703 | 10703 |
| |
10704 | 10704 |
| |
10705 |
| - | |
10706 |
| - | |
10707 |
| - | |
| 10705 | + | |
| 10706 | + | |
| 10707 | + | |
| 10708 | + | |
| 10709 | + | |
| 10710 | + | |
10708 | 10711 |
| |
10709 | 10712 |
| |
10710 | 10713 |
| |
10711 | 10714 |
| |
10712 | 10715 |
| |
10713 |
| - | |
10714 |
| - | |
10715 |
| - | |
10716 |
| - | |
10717 |
| - | |
10718 | 10716 |
| |
10719 | 10717 |
| |
10720 | 10718 |
| |
| |||
10727 | 10725 |
| |
10728 | 10726 |
| |
10729 | 10727 |
| |
10730 |
| - | |
| 10728 | + | |
10731 | 10729 |
| |
10732 | 10730 |
| |
10733 | 10731 |
| |
| |||
10940 | 10938 |
| |
10941 | 10939 |
| |
10942 | 10940 |
| |
10943 |
| - | |
| 10941 | + | |
| 10942 | + | |
10944 | 10943 |
| |
10945 |
| - | |
| 10944 | + | |
10946 | 10945 |
| |
10947 | 10946 |
| |
10948 | 10947 |
| |
| |||
10955 | 10954 |
| |
10956 | 10955 |
| |
10957 | 10956 |
| |
10958 |
| - | |
10959 |
| - | |
| 10957 | + | |
| 10958 | + | |
10960 | 10959 |
| |
10961 |
| - | |
10962 |
| - | |
| 10960 | + | |
| 10961 | + | |
10963 | 10962 |
| |
10964 | 10963 |
| |
10965 | 10964 |
| |
| |||
10983 | 10982 |
| |
10984 | 10983 |
| |
10985 | 10984 |
| |
10986 |
| - | |
10987 |
| - | |
10988 |
| - | |
10989 |
| - | |
| 10985 | + | |
| 10986 | + | |
10990 | 10987 |
| |
10991 |
| - | |
10992 |
| - | |
10993 |
| - | |
| 10988 | + | |
| 10989 | + | |
10994 | 10990 |
| |
10995 |
| - | |
10996 |
| - | |
10997 |
| - | |
| 10991 | + | |
| 10992 | + | |
| 10993 | + | |
10998 | 10994 |
| |
10999 | 10995 |
| |
11000 | 10996 |
| |
| |||
11009 | 11005 |
| |
11010 | 11006 |
| |
11011 | 11007 |
| |
11012 |
| - | |
| 11008 | + | |
11013 | 11009 |
| |
11014 | 11010 |
| |
11015 | 11011 |
| |
11016 | 11012 |
| |
11017 | 11013 |
| |
11018 | 11014 |
| |
11019 |
| - | |
| 11015 | + | |
| 11016 | + | |
11020 | 11017 |
| |
11021 |
| - | |
| 11018 | + | |
11022 | 11019 |
| |
11023 | 11020 |
| |
11024 | 11021 |
| |
| |||
11034 | 11031 |
| |
11035 | 11032 |
| |
11036 | 11033 |
| |
11037 |
| - | |
| 11034 | + | |
| 11035 | + | |
11038 | 11036 |
| |
11039 |
| - | |
| 11037 | + | |
11040 | 11038 |
| |
11041 | 11039 |
| |
11042 | 11040 |
| |
| |||
11898 | 11896 |
| |
11899 | 11897 |
| |
11900 | 11898 |
| |
11901 |
| - | |
11902 |
| - | |
11903 |
| - | |
| 11899 | + | |
| 11900 | + | |
| 11901 | + | |
11904 | 11902 |
| |
11905 | 11903 |
| |
11906 | 11904 |
| |
11907 | 11905 |
| |
11908 | 11906 |
| |
11909 | 11907 |
| |
11910 |
| - | |
11911 |
| - | |
11912 | 11908 |
| |
11913 | 11909 |
| |
11914 |
| - | |
11915 |
| - | |
| 11910 | + | |
11916 | 11911 |
| |
| 11912 | + | |
11917 | 11913 |
| |
11918 | 11914 |
| |
11919 | 11915 |
| |
| |||
11932 | 11928 |
| |
11933 | 11929 |
| |
11934 | 11930 |
| |
11935 |
| - | |
11936 |
| - | |
11937 |
| - | |
11938 |
| - | |
11939 |
| - | |
| 11931 | + | |
11940 | 11932 |
| |
| 11933 | + | |
| 11934 | + | |
11941 | 11935 |
| |
11942 | 11936 |
| |
11943 |
| - | |
| 11937 | + | |
11944 | 11938 |
| |
| 11939 | + | |
| 11940 | + | |
| 11941 | + | |
| 11942 | + | |
| 11943 | + | |
| 11944 | + | |
| 11945 | + | |
| 11946 | + | |
11945 | 11947 |
| |
11946 |
| - | |
| 11948 | + | |
| 11949 | + | |
| 11950 | + | |
| 11951 | + | |
11947 | 11952 |
| |
11948 | 11953 |
| |
11949 | 11954 |
| |
11950 |
| - | |
11951 |
| - | |
11952 |
| - | |
11953 |
| - | |
11954 |
| - | |
11955 |
| - | |
| 11955 | + | |
11956 | 11956 |
| |
| 11957 | + | |
| 11958 | + | |
| 11959 | + | |
11957 | 11960 |
| |
| 11961 | + | |
| 11962 | + | |
11958 | 11963 |
| |
11959 | 11964 |
| |
11960 |
| - | |
11961 |
| - | |
11962 |
| - | |
11963 |
| - | |
11964 |
| - | |
| 11965 | + | |
| 11966 | + | |
| 11967 | + | |
| 11968 | + | |
| 11969 | + | |
| 11970 | + | |
| 11971 | + | |
| 11972 | + | |
11965 | 11973 |
| |
11966 | 11974 |
| |
| 11975 | + | |
| 11976 | + | |
| 11977 | + | |
| 11978 | + | |
| 11979 | + | |
11967 | 11980 |
| |
11968 | 11981 |
| |
11969 | 11982 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
76 | 76 |
| |
77 | 77 |
| |
78 | 78 |
| |
79 |
| - | |
| 79 | + | |
80 | 80 |
| |
81 | 81 |
| |
82 | 82 |
| |
| |||
94 | 94 |
| |
95 | 95 |
| |
96 | 96 |
| |
97 |
| - | |
| 97 | + | |
98 | 98 |
| |
99 | 99 |
| |
100 | 100 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
299 | 299 |
| |
300 | 300 |
| |
301 | 301 |
| |
302 |
| - | |
| 302 | + | |
303 | 303 |
| |
304 | 304 |
| |
305 | 305 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
384 | 384 |
| |
385 | 385 |
| |
386 | 386 |
| |
387 |
| - | |
388 |
| - | |
| 387 | + | |
389 | 388 |
| |
390 | 389 |
| |
391 | 390 |
| |
|
Lines changed: 10 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 |
| |
24 | 29 |
| |
25 |
| - | |
26 |
| - | |
27 |
| - | |
28 |
| - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 |
| |
30 | 36 |
| |
31 | 37 |
| |
|
0 commit comments
Comments
(0)