Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tJS3M-0034Yt-3x for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Dec 2024 06:43:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tJS3I-00ARjE-E9 for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Dec 2024 06:43:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tJS3H-00ARj6-Rc for pgsql-bugs@lists.postgresql.org; Fri, 06 Dec 2024 06:43:01 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tJS3F-001JFi-Pl for pgsql-bugs@lists.postgresql.org; Fri, 06 Dec 2024 06:42:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:Cc:To:Message-Id:Date:Sender :Reply-To:Content-ID:Content-Description; bh=hLltVBaKyOEKoHFlBbcDdcscQt08nkHPFxdn9hRXjSo=; b=hX8DM8P5TPdPwkHOTuEKYdgwo7 tRWSJJKYRSBbRlLo7+UTtfIGJhDzn+Ickai6VPoBVMoq78NXS4XpLt4uHQuZn9bCEfhP2GveRQUMp 520S6mquWuhV5TOXbgvAfUXzmjiaT13e2PGMhcR7oCPWeU2IuqYIvksX2G61sLeC3BzFClxWbxsYt L8BDKcqJVpVPR4L7mzoTIbO2PMTlDjr3G/E5931b6Mskjl7QrMMBa2PsbtnmI9M/dgsffM2tHHQnL rXQgPDSZjozbgOBNFBSOCwIp7Iow9BxDAsPcPyUalAZGtzJssPboC4ZD8ezfgH8bg0gVGu2l9GUou a2uaDWfg==; Received: from 221x241x223x178.ap221.ftth.ucom.ne.jp ([221.241.223.178] helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from ) id 1tJS3A-003str-8g; Fri, 06 Dec 2024 06:42:55 +0000 Date: Fri, 06 Dec 2024 15:42:48 +0900 (JST) Message-Id: <20241206.154248.1191531539866262856.ishii@postgresql.org> To: tgl@sss.pgh.pa.us Cc: koichi.dbms@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18735: Specific multibyte character in psql file path command parameter for Windows From: Tatsuo Ishii In-Reply-To: <2751825.1733464455@sss.pgh.pa.us> References: <20241206.142130.1661155698933375612.ishii@postgresql.org> <2751825.1733464455@sss.pgh.pa.us> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > I don't believe the theory that the fault lies there. If the flex > rules were taking the backslash-embedded-in-a-shift-JIS-character > as a backslash, they would think it is the start of a new backslash > command, with the result being that the filename argument gets > truncated there. That doesn't match the reported symptoms: we > see more of the filename than that echoed back in the error message. > So I think the filename is getting through that part just fine, > and then we're messing it up in canonicalize_path or adjacent > processing. I have looked into canonicalize_path() and found this: #ifdef WIN32 /* * The Windows command processor will accept suitably quoted paths with * forward slashes, but barfs badly with mixed forward and back slashes. */ for (p = path; *p; p++) { if (*p == '\\') *p = '/'; } Here "path" is the filename encoded in Shift-JIS I think. It seems canonicalize_path() unconditionaly replaces a backslash with a slash. For me this seems to break any Shift-JIS KANJI characters that a backslash in the second byte. Best reagards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp