pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths 6+ messages / 1 participants [nested] [flat]
* pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths @ 2025-01-29 19:24 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2025-01-29 19:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b17e3970c1ac207566a1a25063dc456d042423b5 Modified Files -------------- src/bin/psql/command.c | 8 ++-- src/bin/psql/copy.c | 2 +- src/include/port.h | 1 + src/port/path.c | 105 ++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 97 insertions(+), 19 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths @ 2025-01-29 19:24 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2025-01-29 19:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/998c4fc7c2c89abad4171f78f9375bd31713b5ca Modified Files -------------- src/bin/psql/command.c | 8 ++-- src/bin/psql/copy.c | 2 +- src/include/port.h | 1 + src/port/path.c | 105 ++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 97 insertions(+), 19 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths @ 2025-01-29 19:24 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2025-01-29 19:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/6cddecdfb00b35c1d0256600d76f68c702dedec7 Modified Files -------------- src/bin/psql/command.c | 8 ++-- src/bin/psql/copy.c | 2 +- src/include/port.h | 1 + src/port/path.c | 105 ++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 97 insertions(+), 19 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths @ 2025-01-29 19:24 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2025-01-29 19:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0b713b94b3b07b01ed9cee7c6257799e8d8c6285 Modified Files -------------- src/bin/psql/command.c | 8 ++-- src/bin/psql/copy.c | 2 +- src/include/port.h | 1 + src/port/path.c | 105 ++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 97 insertions(+), 19 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths @ 2025-01-29 19:24 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2025-01-29 19:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/54f9afea7a7d356c8569014c5cf85a99455508ee Modified Files -------------- src/bin/psql/command.c | 8 ++-- src/bin/psql/copy.c | 2 +- src/include/port.h | 1 + src/port/path.c | 105 ++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 97 insertions(+), 19 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths @ 2025-01-29 19:24 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2025-01-29 19:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/98df8bace8a3d372ac819efd278ef26e056e8bbf Modified Files -------------- src/bin/psql/command.c | 8 ++-- src/bin/psql/copy.c | 2 +- src/include/port.h | 1 + src/port/path.c | 105 ++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 97 insertions(+), 19 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2025-01-29 19:24 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-01-29 19:24 pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths Tom Lane <tgl@sss.pgh.pa.us> 2025-01-29 19:24 pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths Tom Lane <tgl@sss.pgh.pa.us> 2025-01-29 19:24 pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths Tom Lane <tgl@sss.pgh.pa.us> 2025-01-29 19:24 pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths Tom Lane <tgl@sss.pgh.pa.us> 2025-01-29 19:24 pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths Tom Lane <tgl@sss.pgh.pa.us> 2025-01-29 19:24 pgsql: Avoid breaking SJIS encoding while de-backslashing Windows paths Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox