From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13802 invoked from network); 13 Jan 2021 13:29:03 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 13 Jan 2021 13:29:03 -0000 Received: (qmail 15638 invoked by uid 550); 13 Jan 2021 13:29:00 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 15608 invoked from network); 13 Jan 2021 13:29:00 -0000 From: Natanael Copa To: musl@lists.openwall.com Cc: Natanael Copa Date: Wed, 13 Jan 2021 14:28:35 +0100 Message-Id: <20210113132835.22685-1-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: [musl] [PATCH] make realpath replace leading // with a single / On some systems a leading double slash may have special meaning, so POSIX[1] says that "If a pathname begins with two successive characters, the first component following the leading characters may be interpreted in an implementation-defined manner" While current musl implementation is technically correct, most other systems' (at least GNU libc, freebsd, openbsd, netbsd macOS) implementations will replace a leading // with a single /. Make musl do the same to avoid surprises. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.= html#tag_04_13 --- src/misc/realpath.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/misc/realpath.c b/src/misc/realpath.c index db8b74dc..414b4741 100644 --- a/src/misc/realpath.c +++ b/src/misc/realpath.c @@ -46,9 +46,6 @@ restart: q=3D0; output[q++] =3D '/'; p++; - /* Initial // is special. */ - if (stack[p] =3D=3D '/' && stack[p+1] !=3D '/') - output[q++] =3D '/'; continue; } =20 --=20 2.30.0