From unknown Mon Jun 23 02:26:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33564: Incorrect path canonicalisation Resent-From: Mattias =?UTF-8?Q?Andr=C3=A9e?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Dec 2018 20:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33564 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 33564@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.154369471315221 (code B ref -1); Sat, 01 Dec 2018 20:06:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Dec 2018 20:05:13 +0000 Received: from localhost ([127.0.0.1]:57274 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTBVp-0003xQ-Hs for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:05:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTBVn-0003xA-7c for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:05:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTBVg-0000Me-Ga for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:05:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FROM_EXCESS_BASE64 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41997) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTBVe-0000MQ-P3 for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:05:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTBVd-0007wt-Vl for bug-gnu-emacs@gnu.org; Sat, 01 Dec 2018 15:05:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTBVZ-0000Ld-1V for bug-gnu-emacs@gnu.org; Sat, 01 Dec 2018 15:05:01 -0500 Received: from smtp-4.sys.kth.se ([2001:6b0:1:1300:250:56ff:fea6:2de3]:42706) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTBVY-0000K4-N7 for bug-gnu-emacs@gnu.org; Sat, 01 Dec 2018 15:04:56 -0500 Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id BF9912FF for ; Sat, 1 Dec 2018 21:04:52 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UK5H9s6Kemq8 for ; Sat, 1 Dec 2018 21:04:51 +0100 (CET) X-KTH-Auth: maandree [81.228.219.220] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kth.se; s=default; t=1543694691; bh=YqrLdfsU65i4KJ569m1Psy3XJ6JfgcJKX/wVls+1CJk=; h=Date:From:To:Subject; b=RinctbdVG6XGH74ZiPxcOLPRu4TrHK2UOWutlEZV1L8Egl5OOfdA6OflrlGXfhnLb xxsLUwH67BljpSzjLCa+j5grQlPJJL5LeP4A5o6A7pg+ZwqKtM3ueOxUNjEYC5yzUC nvpfVoPkUT+iXKhZPSrjkbYDY10YqeMkrkckEydo= X-KTH-mail-from: maandree@kth.se X-KTH-rcpt-to: bug-gnu-emacs@gnu.org Received: from localhost.localdomain (81-228-219-220-no43.tbcn.telia.com [81.228.219.220]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id 6AD142CD for ; Sat, 1 Dec 2018 21:04:51 +0100 (CET) Date: Sat, 1 Dec 2018 21:04:50 +0100 From: Mattias =?UTF-8?Q?Andr=C3=A9e?= Message-ID: <20181201210450.47f17692.maandree@kth.se> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Awesomeness: 120 % User-Agent: Claws Mail X-Operating-System: GNU/Linux X-Clacks-Overhead: GNU Terry Pratchett MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.9 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.9 (----) Emacs 26.1 removes ..'s incorrectly from file names. Emacs removes the directory in front the .. rather than getting its parent directory. Example: cd mkdir -p 1/2 cd 1/2 echo 3 > ../../3 ln -s ~ 4 echo 5 > 5 emacs 4/../5 # works, but shouldn't emacs 4/../$USER/3 # does not works, should On Linux, the proper way to get the canonical path for a file with the file descriptor $fd: stat(3) /dev/fd/$fd p := readlink(3) /dev/fd/$fd if (st_nlinks != 0) { stat(3) /dev/fd/$fd if (st_nlinks == 0) { p := readlink(3) /dev/fd/$fd remove " (deleted)" from the end of p } } else { remove " (deleted)" from the end of p } canonical path is p From unknown Mon Jun 23 02:26:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33564: Incorrect path canonicalisation Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Dec 2018 20:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33564 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mattias =?UTF-8?Q?Andr=C3=A9e?= Cc: 33564@debbugs.gnu.org Received: via spool by 33564-submit@debbugs.gnu.org id=B33564.154369605317348 (code B ref 33564); Sat, 01 Dec 2018 20:28:02 +0000 Received: (at 33564) by debbugs.gnu.org; 1 Dec 2018 20:27:33 +0000 Received: from localhost ([127.0.0.1]:57294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTBrR-0004Vk-0i for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:27:33 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:56425) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTBrO-0004Vb-HX for 33564@debbugs.gnu.org; Sat, 01 Dec 2018 15:27:31 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 436jVT4HyHz1qymV; Sat, 1 Dec 2018 21:27:29 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 436jVT3mZQz1qtdq; Sat, 1 Dec 2018 21:27:29 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id AQUK1F0fFCuM; Sat, 1 Dec 2018 21:27:28 +0100 (CET) X-Auth-Info: h8pBr621byJ6NlKtrgZr6TDzncufBbs7XTzRVNAouC+HGuRZXtikDtA6KbcyIX6U Received: from igel.home (ppp-188-174-144-54.dynamic.mnet-online.de [188.174.144.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sat, 1 Dec 2018 21:27:28 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 814C92C1E85; Sat, 1 Dec 2018 21:27:27 +0100 (CET) From: Andreas Schwab References: <20181201210450.47f17692.maandree@kth.se> X-Yow: Oh, I get it!! ``The BEACH goes on,'' huh, SONNY?? Date: Sat, 01 Dec 2018 21:27:27 +0100 In-Reply-To: <20181201210450.47f17692.maandree@kth.se> ("Mattias =?UTF-8?Q?Andr=C3=A9e?="'s message of "Sat, 1 Dec 2018 21:04:50 +0100") Message-ID: <87lg592dsg.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Dez 01 2018, Mattias Andrée wrote: > Emacs 26.1 removes ..'s incorrectly from file names. > Emacs removes the directory in front the .. rather than > getting its parent directory. This is deliberate. Emacs never consults the filesystem when canonicalizing filenames, as documented in expand-file-name. This is consistent with the logical view of the filesystem, and how the shell builtin cd handles it. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From unknown Mon Jun 23 02:26:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33564: Incorrect path canonicalisation Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Dec 2018 20:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33564 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mattias =?UTF-8?Q?Andr=C3=A9e?= Cc: 33564@debbugs.gnu.org Received: via spool by 33564-submit@debbugs.gnu.org id=B33564.154369628517804 (code B ref 33564); Sat, 01 Dec 2018 20:32:01 +0000 Received: (at 33564) by debbugs.gnu.org; 1 Dec 2018 20:31:25 +0000 Received: from localhost ([127.0.0.1]:57302 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTBvA-0004d6-SO for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:31:25 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58269) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTBvA-0004cv-6w for 33564@debbugs.gnu.org; Sat, 01 Dec 2018 15:31:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTBv2-0007l7-1P for 33564@debbugs.gnu.org; Sat, 01 Dec 2018 15:31:19 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTBus-0007aK-Rl; Sat, 01 Dec 2018 15:31:06 -0500 Received: from [176.228.60.248] (port=4989 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gTBur-0003f5-4Y; Sat, 01 Dec 2018 15:31:06 -0500 Date: Sat, 01 Dec 2018 22:30:49 +0200 Message-Id: <83efb1at1i.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <20181201210450.47f17692.maandree@kth.se> (message from Mattias =?UTF-8?Q?Andr=C3=A9e?= on Sat, 1 Dec 2018 21:04:50 +0100) References: <20181201210450.47f17692.maandree@kth.se> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) tags 33564 notabug thanks > Date: Sat, 1 Dec 2018 21:04:50 +0100 > From: Mattias Andrée > > cd > mkdir -p 1/2 > cd 1/2 > echo 3 > ../../3 > ln -s ~ 4 > echo 5 > 5 > emacs 4/../5 # works, but shouldn't > emacs 4/../$USER/3 # does not works, should This is by design: expand-file-name doesn't follow symlinks. It's documented not to do that: see the doc string and the ELisp manual. > On Linux, the proper way to get the canonical path > for a file with the file descriptor $fd: expand-file-name doesn't aim at yielding the canonical file name in that sense. From unknown Mon Jun 23 02:26:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33564: Incorrect path canonicalisation Resent-From: Mattias =?UTF-8?Q?Andr=C3=A9e?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Dec 2018 20:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33564 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug To: Andreas Schwab Cc: 33564@debbugs.gnu.org Received: via spool by 33564-submit@debbugs.gnu.org id=B33564.154369652018208 (code B ref 33564); Sat, 01 Dec 2018 20:36:01 +0000 Received: (at 33564) by debbugs.gnu.org; 1 Dec 2018 20:35:20 +0000 Received: from localhost ([127.0.0.1]:57307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTByy-0004jc-Ff for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:35:20 -0500 Received: from smtp-3.sys.kth.se ([130.237.48.192]:38306) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTByw-0004jT-1R for 33564@debbugs.gnu.org; Sat, 01 Dec 2018 15:35:19 -0500 Received: from smtp-3.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-3.sys.kth.se (Postfix) with ESMTP id AAD351C64; Sat, 1 Dec 2018 21:35:16 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-3.sys.kth.se ([127.0.0.1]) by smtp-3.sys.kth.se (smtp-3.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id nWhsyNNi2UxF; Sat, 1 Dec 2018 21:35:16 +0100 (CET) X-KTH-Auth: maandree [81.228.219.220] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kth.se; s=default; t=1543696516; bh=wxbV9Rr3nyt6uMjEfE3YnA/34nTASCmDFgedPlcvasw=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=FkGgGfX6OC2YAykWhbqg60Nr7Hic08MMw1a98HfMdrogzlxEGrYYl7dEJh7ZG4wi1 sbNAGGEB4ZJ+pnjJOq57dPBKVHsjGB8QgT6DUMVvT02qfgfHzJkYC59NUijjI+qALo vrKZyr6+mjLZB3E8mO8MiHxjOhTMp8S0rLMPzQ5M= X-KTH-mail-from: maandree@kth.se Received: from localhost.localdomain (81-228-219-220-no43.tbcn.telia.com [81.228.219.220]) by smtp-3.sys.kth.se (Postfix) with ESMTPSA id B1832F8C; Sat, 1 Dec 2018 21:35:15 +0100 (CET) Date: Sat, 1 Dec 2018 21:35:14 +0100 From: Mattias =?UTF-8?Q?Andr=C3=A9e?= Message-ID: <20181201213514.5c22626f.maandree@kth.se> In-Reply-To: <87lg592dsg.fsf@igel.home> References: <20181201210450.47f17692.maandree@kth.se> <87lg592dsg.fsf@igel.home> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Awesomeness: 120 % User-Agent: Claws Mail X-Operating-System: GNU/Linux X-Clacks-Overhead: GNU Terry Pratchett MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.2 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.2 (---) On Sat, 1 Dec 2018 21:27:27 +0100 Andreas Schwab wrote: > On Dez 01 2018, Mattias Andr=C3=A9e wrote: >=20 > > Emacs 26.1 removes ..'s incorrectly from file names. > > Emacs removes the directory in front the .. rather than > > getting its parent directory. =20 >=20 > This is deliberate. Emacs never consults the filesystem when > canonicalizing filenames, as documented in expand-file-name. This is > consistent with the logical view of the filesystem, and how the shell > builtin cd handles it. What is the rationale for this? No other program Bash and Emacs behave this way, including the coreutils. It seems odd that the Bash suggest file from the wrong directory so that even the coreutils cannot find them, only Emacs. >=20 > Andreas. >=20 From unknown Mon Jun 23 02:26:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33564: Incorrect path canonicalisation Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Dec 2018 20:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33564 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug To: Mattias =?UTF-8?Q?Andr=C3=A9e?= Cc: 33564@debbugs.gnu.org Received: via spool by 33564-submit@debbugs.gnu.org id=B33564.154369773427581 (code B ref 33564); Sat, 01 Dec 2018 20:56:01 +0000 Received: (at 33564) by debbugs.gnu.org; 1 Dec 2018 20:55:34 +0000 Received: from localhost ([127.0.0.1]:57321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTCIY-0007An-0Q for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:55:34 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:43124) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTCIW-0007Af-Cq for 33564@debbugs.gnu.org; Sat, 01 Dec 2018 15:55:32 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 436k6q4kccz1qxl0; Sat, 1 Dec 2018 21:55:31 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 436k6q4YfGz1qql4; Sat, 1 Dec 2018 21:55:31 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id lYZFnnJHi3_m; Sat, 1 Dec 2018 21:55:30 +0100 (CET) X-Auth-Info: +0oQh1hlL2jdo8iTAfL/qppR2/LfeWTLXeHCjLGQEPNJXgfVuTkUvtl+sdOKVm9b Received: from igel.home (ppp-188-174-144-54.dynamic.mnet-online.de [188.174.144.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sat, 1 Dec 2018 21:55:30 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 4656F2C1E85; Sat, 1 Dec 2018 21:55:29 +0100 (CET) From: Andreas Schwab References: <20181201210450.47f17692.maandree@kth.se> <87lg592dsg.fsf@igel.home> <20181201213514.5c22626f.maandree@kth.se> X-Yow: I guess it was all a DREAM.. or an episode of HAWAII FIVE-O... Date: Sat, 01 Dec 2018 21:55:29 +0100 In-Reply-To: <20181201213514.5c22626f.maandree@kth.se> ("Mattias =?UTF-8?Q?Andr=C3=A9e?="'s message of "Sat, 1 Dec 2018 21:35:14 +0100") Message-ID: <87h8fx2chq.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Dez 01 2018, Mattias Andrée wrote: > On Sat, 1 Dec 2018 21:27:27 +0100 > Andreas Schwab wrote: > >> On Dez 01 2018, Mattias Andrée wrote: >> >> > Emacs 26.1 removes ..'s incorrectly from file names. >> > Emacs removes the directory in front the .. rather than >> > getting its parent directory. >> >> This is deliberate. Emacs never consults the filesystem when >> canonicalizing filenames, as documented in expand-file-name. This is >> consistent with the logical view of the filesystem, and how the shell >> builtin cd handles it. > > What is the rationale for this? Canonicalizing is a pure textual operation. > No other program Bash and Emacs behave this way, including the > coreutils. This is not true, as I explained above. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From unknown Mon Jun 23 02:26:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33564: Incorrect path canonicalisation Resent-From: Mattias =?UTF-8?Q?Andr=C3=A9e?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Dec 2018 21:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33564 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug To: Andreas Schwab Cc: 33564@debbugs.gnu.org Received: via spool by 33564-submit@debbugs.gnu.org id=B33564.154369887629361 (code B ref 33564); Sat, 01 Dec 2018 21:15:02 +0000 Received: (at 33564) by debbugs.gnu.org; 1 Dec 2018 21:14:36 +0000 Received: from localhost ([127.0.0.1]:57326 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTCax-0007dU-M7 for submit@debbugs.gnu.org; Sat, 01 Dec 2018 16:14:35 -0500 Received: from smtp-4.sys.kth.se ([130.237.48.193]:60478) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTCav-0007dM-Oa for 33564@debbugs.gnu.org; Sat, 01 Dec 2018 16:14:34 -0500 Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id B776141E; Sat, 1 Dec 2018 22:14:32 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dxKCn60eZcTG; Sat, 1 Dec 2018 22:14:32 +0100 (CET) X-KTH-Auth: maandree [81.228.219.220] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kth.se; s=default; t=1543698872; bh=5fBp4T4gRxY5q7d0UtuEdZmHyf4PZmCuiUke+rvd7DI=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Wq4cK2Twbj4XLsnWN5C5dRj355O0vhv0S2tKHBAZ8emKOm3RJ0qtGU7/qsHG7wI/g VJgOY7KJzZwLXoaWC1EsyQgETQRdlInL9/ijWYhnfD8m1A1T2tlff/ILAWemWQJ33M 82nApWrzWTk7YjEOGH/MLZVBe26inpTjJiI1etug= X-KTH-mail-from: maandree@kth.se Received: from localhost.localdomain (81-228-219-220-no43.tbcn.telia.com [81.228.219.220]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id C6E082CD; Sat, 1 Dec 2018 22:14:31 +0100 (CET) Date: Sat, 1 Dec 2018 22:14:30 +0100 From: Mattias =?UTF-8?Q?Andr=C3=A9e?= Message-ID: <20181201221430.7aefa4a2.maandree@kth.se> In-Reply-To: <87h8fx2chq.fsf@igel.home> References: <20181201210450.47f17692.maandree@kth.se> <87lg592dsg.fsf@igel.home> <20181201213514.5c22626f.maandree@kth.se> <87h8fx2chq.fsf@igel.home> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Awesomeness: 120 % User-Agent: Claws Mail X-Operating-System: GNU/Linux X-Clacks-Overhead: GNU Terry Pratchett MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.2 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.2 (---) On Sat, 1 Dec 2018 21:55:29 +0100 Andreas Schwab wrote: > On Dez 01 2018, Mattias Andr=C3=A9e wrote: >=20 > > On Sat, 1 Dec 2018 21:27:27 +0100 > > Andreas Schwab wrote: > > =20 > >> On Dez 01 2018, Mattias Andr=C3=A9e wrote: > >> =20 > >> > Emacs 26.1 removes ..'s incorrectly from file names. > >> > Emacs removes the directory in front the .. rather than > >> > getting its parent directory. =20 > >>=20 > >> This is deliberate. Emacs never consults the filesystem when > >> canonicalizing filenames, as documented in expand-file-name. This is > >> consistent with the logical view of the filesystem, and how the shell > >> builtin cd handles it. =20 > > > > What is the rationale for this? =20 >=20 > Canonicalizing is a pure textual operation. Yes, you said, but why should Emacs canonicalise the file names given in the command line in the first place? One would expect that if you examine a file with for example stat or cat, you with be working with that file with you give Emacs the same file name. >=20 > > No other program Bash and Emacs behave this way, including the > > coreutils. =20 >=20 > This is not true, as I explained above. Okay, dash also behaves this way, but ls, cat, and nano, for example don't (and no, you didn't explain, nor should you have, you should have given counter examples, preferably GNU program). I don't know any other program that behaves this way. The same think goes for resolving ~, normal programs use the file names given in the command line as is. >=20 > Andreas. >=20 From unknown Mon Jun 23 02:26:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33564: Incorrect path canonicalisation Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Dec 2018 06:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33564 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug To: Mattias =?UTF-8?Q?Andr=C3=A9e?= Cc: schwab@linux-m68k.org, 33564@debbugs.gnu.org Received: via spool by 33564-submit@debbugs.gnu.org id=B33564.154373207627884 (code B ref 33564); Sun, 02 Dec 2018 06:28:02 +0000 Received: (at 33564) by debbugs.gnu.org; 2 Dec 2018 06:27:56 +0000 Received: from localhost ([127.0.0.1]:57469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTLES-0007Fg-5r for submit@debbugs.gnu.org; Sun, 02 Dec 2018 01:27:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47014) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTLEQ-0007FU-V5 for 33564@debbugs.gnu.org; Sun, 02 Dec 2018 01:27:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTLEI-00073r-Hy for 33564@debbugs.gnu.org; Sun, 02 Dec 2018 01:27:49 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTLEI-00073k-F9; Sun, 02 Dec 2018 01:27:46 -0500 Received: from [176.228.60.248] (port=1889 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gTLEH-0001bC-WE; Sun, 02 Dec 2018 01:27:46 -0500 Date: Sun, 02 Dec 2018 08:27:33 +0200 Message-Id: <83d0qkbfze.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <20181201221430.7aefa4a2.maandree@kth.se> (message from Mattias =?UTF-8?Q?Andr=C3=A9e?= on Sat, 1 Dec 2018 22:14:30 +0100) References: <20181201210450.47f17692.maandree@kth.se> <87lg592dsg.fsf@igel.home> <20181201213514.5c22626f.maandree@kth.se> <87h8fx2chq.fsf@igel.home> <20181201221430.7aefa4a2.maandree@kth.se> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > Date: Sat, 1 Dec 2018 22:14:30 +0100 > From: Mattias Andrée > Cc: 33564@debbugs.gnu.org > > why should Emacs canonicalise the file names given in the command > line in the first place? One reason is so that it could meaningfully compare file names as strings. Another reason is that relative file names change their meaning when you switch buffers, because Emacs behaves in a way that switching buffers conceptually changes your working directory to the directory of that buffer. From unknown Mon Jun 23 02:26:39 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Mattias =?UTF-8?Q?Andr=C3=A9e?= Subject: bug#33564: closed (Re: bug#33564: Incorrect path canonicalisation) Message-ID: References: <20181201210450.47f17692.maandree@kth.se> X-Gnu-PR-Message: they-closed 33564 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: notabug Reply-To: 33564@debbugs.gnu.org Date: Wed, 21 Aug 2019 02:28:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1566354483-12358-1" This is a multi-part message in MIME format... ------------=_1566354483-12358-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #33564: Incorrect path canonicalisation which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 33564@debbugs.gnu.org. --=20 33564: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D33564 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1566354483-12358-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 33564-done) by debbugs.gnu.org; 21 Aug 2019 02:27:10 +0000 Received: from localhost ([127.0.0.1]:34355 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0GL7-0003C1-OJ for submit@debbugs.gnu.org; Tue, 20 Aug 2019 22:27:09 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:45093) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0GL6-0003Bp-Hd for 33564-done@debbugs.gnu.org; Tue, 20 Aug 2019 22:27:08 -0400 Received: by mail-pl1-f194.google.com with SMTP id y8so442168plr.12 for <33564-done@debbugs.gnu.org>; Tue, 20 Aug 2019 19:27:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc :content-transfer-encoding; bh=h0GgfimTVlTddn4qakXYbCCtZM5vy6j2AUMvAAAY32Y=; b=k5dPQLvLmj9lDytmIVRk+Y4AXywzuAolzKnALz5H61GcGvBMEukpNb9FMPGrvguRIp c0VhVLwDOAzZ4fKe3UohWeg5uoVRHfOrBuFkBCkB6OTwduPpX66/uEGb1TOL4PKBMeRn fN6yWTQFJBMNNjyRutwVjevLF4sGyMMpgnCSxwB6z5eFrH2NWLgfFGvoKGqD3ZSxyjw1 4smrGZO2t/1wu6fI7UH1RQzD8WpahoAOjzhpQHLrffwIQ+XXDwaj7rgjA3ip3pABJkjS CiccBXtbamcdlSNBZBIqGRDhr8ccyxm9IDetpwv7glmeJrM33ggIcGxPYpf7zEQCk+ic 475A== X-Gm-Message-State: APjAAAV/V2sHQIGBSVmcL5OzernNioN08ifNWQeVzMaU+SR0/ZCcly+J KDDeXo2w5xe5v4ixV8LiGOC0w5bTcrfev9hOfyQ= X-Google-Smtp-Source: APXvYqz/1jq5ldlLeuIk2IC9VG6mANEl4yUvF/EVj4mfokfNvEzL7t3/sfENX17KuIavNt8MBcbz50M9zN6Db2mC/Eg= X-Received: by 2002:a17:902:d70a:: with SMTP id w10mr29682371ply.251.1566354422876; Tue, 20 Aug 2019 19:27:02 -0700 (PDT) MIME-Version: 1.0 From: Stefan Kangas Date: Wed, 21 Aug 2019 04:26:51 +0200 Message-ID: Subject: Re: bug#33564: Incorrect path canonicalisation To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 33564-done Cc: =?UTF-8?Q?Mattias_Andr=C3=A9e?= , 33564-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Eli Zaretskii writes: > tags 33564 notabug > thanks > >> Date: Sat, 1 Dec 2018 21:04:50 +0100 >> From: Mattias Andr=C3=A9e >> >> cd >> mkdir -p 1/2 >> cd 1/2 >> echo 3 > ../../3 >> ln -s ~ 4 >> echo 5 > 5 >> emacs 4/../5 # works, but shouldn't >> emacs 4/../$USER/3 # does not works, should > > This is by design: expand-file-name doesn't follow symlinks. It's > documented not to do that: see the doc string and the ELisp manual. > >> On Linux, the proper way to get the canonical path >> for a file with the file descriptor $fd: > > expand-file-name doesn't aim at yielding the canonical file name in > that sense. This was tagged notabug in December 2018; I'm now also closing this bug rep= ort. Thanks, Stefan Kangas ------------=_1566354483-12358-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 1 Dec 2018 20:05:13 +0000 Received: from localhost ([127.0.0.1]:57274 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTBVp-0003xQ-Hs for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:05:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTBVn-0003xA-7c for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:05:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTBVg-0000Me-Ga for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:05:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FROM_EXCESS_BASE64 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41997) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTBVe-0000MQ-P3 for submit@debbugs.gnu.org; Sat, 01 Dec 2018 15:05:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTBVd-0007wt-Vl for bug-gnu-emacs@gnu.org; Sat, 01 Dec 2018 15:05:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTBVZ-0000Ld-1V for bug-gnu-emacs@gnu.org; Sat, 01 Dec 2018 15:05:01 -0500 Received: from smtp-4.sys.kth.se ([2001:6b0:1:1300:250:56ff:fea6:2de3]:42706) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTBVY-0000K4-N7 for bug-gnu-emacs@gnu.org; Sat, 01 Dec 2018 15:04:56 -0500 Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id BF9912FF for ; Sat, 1 Dec 2018 21:04:52 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UK5H9s6Kemq8 for ; Sat, 1 Dec 2018 21:04:51 +0100 (CET) X-KTH-Auth: maandree [81.228.219.220] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kth.se; s=default; t=1543694691; bh=YqrLdfsU65i4KJ569m1Psy3XJ6JfgcJKX/wVls+1CJk=; h=Date:From:To:Subject; b=RinctbdVG6XGH74ZiPxcOLPRu4TrHK2UOWutlEZV1L8Egl5OOfdA6OflrlGXfhnLb xxsLUwH67BljpSzjLCa+j5grQlPJJL5LeP4A5o6A7pg+ZwqKtM3ueOxUNjEYC5yzUC nvpfVoPkUT+iXKhZPSrjkbYDY10YqeMkrkckEydo= X-KTH-mail-from: maandree@kth.se X-KTH-rcpt-to: bug-gnu-emacs@gnu.org Received: from localhost.localdomain (81-228-219-220-no43.tbcn.telia.com [81.228.219.220]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id 6AD142CD for ; Sat, 1 Dec 2018 21:04:51 +0100 (CET) Date: Sat, 1 Dec 2018 21:04:50 +0100 From: Mattias =?UTF-8?B?QW5kcsOpZQ==?= To: bug-gnu-emacs@gnu.org Subject: Incorrect path canonicalisation Message-ID: <20181201210450.47f17692.maandree@kth.se> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Awesomeness: 120 % User-Agent: Claws Mail X-Operating-System: GNU/Linux X-Clacks-Overhead: GNU Terry Pratchett MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.9 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.9 (----) Emacs 26.1 removes ..'s incorrectly from file names. Emacs removes the directory in front the .. rather than getting its parent directory. Example: cd mkdir -p 1/2 cd 1/2 echo 3 > ../../3 ln -s ~ 4 echo 5 > 5 emacs 4/../5 # works, but shouldn't emacs 4/../$USER/3 # does not works, should On Linux, the proper way to get the canonical path for a file with the file descriptor $fd: stat(3) /dev/fd/$fd p := readlink(3) /dev/fd/$fd if (st_nlinks != 0) { stat(3) /dev/fd/$fd if (st_nlinks == 0) { p := readlink(3) /dev/fd/$fd remove " (deleted)" from the end of p } } else { remove " (deleted)" from the end of p } canonical path is p ------------=_1566354483-12358-1--