aboutsummaryrefslogtreecommitdiff
path: root/src/include/port.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2025-01-29 14:24:36 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2025-01-29 14:24:36 -0500
commit6cddecdfb00b35c1d0256600d76f68c702dedec7 (patch)
tree2e476be7f6f928897009d966592426ac1afd1260 /src/include/port.h
parentf6ff75f79689d2d0c5bb241435d7fc6a63273223 (diff)
downloadpostgresql-6cddecdfb00b35c1d0256600d76f68c702dedec7.tar.gz
postgresql-6cddecdfb00b35c1d0256600d76f68c702dedec7.zip
Avoid breaking SJIS encoding while de-backslashing Windows paths.
When running on Windows, canonicalize_path() converts '\' to '/' to prevent confusing the Windows command processor. It was doing that in a non-encoding-aware fashion; but in SJIS there are valid two-byte characters whose second byte matches '\'. So encoding corruption ensues if such a character is used in the path. We can fairly easily fix this if we know which encoding is in use, but a lot of our utilities don't have much of a clue about that. After some discussion we decided we'd settle for fixing this only in psql, and assuming that its value of client_encoding matches what the user is typing. It seems hopeless to get the server to deal with the problematic characters in database path names, so we'll just declare that case to be unsupported. That means nothing need be done in the server, nor in utility programs whose only contact with file path names is for database paths. But psql frequently deals with client-side file paths, so it'd be good if it didn't mess those up. Bug: #18735 Reported-by: Koichi Suzuki <koichi.suzuki@enterprisedb.com> Author: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Koichi Suzuki <koichi.suzuki@enterprisedb.com> Discussion: https://postgr.es/m/18735-4acdb3998bb9f2b1@postgresql.org Backpatch-through: 13
Diffstat (limited to 'src/include/port.h')
-rw-r--r--src/include/port.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/port.h b/src/include/port.h
index 4e9e5657872..703cad868ba 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -53,6 +53,7 @@ extern char *first_path_var_separator(const char *pathlist);
extern void join_path_components(char *ret_path,
const char *head, const char *tail);
extern void canonicalize_path(char *path);
+extern void canonicalize_path_enc(char *path, int encoding);
extern void make_native_path(char *filename);
extern void cleanup_path(char *path);
extern bool path_contains_parent_reference(const char *path);