From unknown Fri Sep 12 02:09:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8850: mkdir inside symlink creates wrong directory with relative parent Resent-From: =?UTF-8?Q?Old=C5=99ich_?= =?UTF-8?Q?Jedli=C4=8Dka?= Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 13 Jun 2011 11:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8850 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 8850@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.130796453016950 (code B ref -1); Mon, 13 Jun 2011 11:29:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Jun 2011 11:28:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QW5K6-0004PL-2H for submit@debbugs.gnu.org; Mon, 13 Jun 2011 07:28:50 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QW4j0-0003UD-3z for submit@debbugs.gnu.org; Mon, 13 Jun 2011 06:50:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QW4it-0004tT-LB for submit@debbugs.gnu.org; Mon, 13 Jun 2011 06:50:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:35394) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QW4it-0004tO-8z for submit@debbugs.gnu.org; Mon, 13 Jun 2011 06:50:23 -0400 Received: from eggs.gnu.org ([140.186.70.92]:60734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QW4ir-0004l2-HZ for bug-coreutils@gnu.org; Mon, 13 Jun 2011 06:50:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QW4iq-0004ss-7a for bug-coreutils@gnu.org; Mon, 13 Jun 2011 06:50:21 -0400 Received: from mail-vw0-f41.google.com ([209.85.212.41]:55858) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QW4ip-0004se-UU for bug-coreutils@gnu.org; Mon, 13 Jun 2011 06:50:20 -0400 Received: by vws4 with SMTP id 4so4592583vws.0 for ; Mon, 13 Jun 2011 03:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:sender:date:x-google-sender-auth :message-id:subject:from:to:content-type:content-transfer-encoding; bh=8Pyr7oFBVf26znAHbXOebYZck8IgeM/s/MJFK9bUpKg=; b=JqoW0w7UtV6hTJtqvR0qjegffLXf6dLByXeJsZI6Kqd7r0yhMZwEGkqFtVg7RYzeEx yS2j7Uk5P6WVcjGhlhVLvvC/o/0sjKjqPK9xhZh0uYdt18phwGBC27mp9ei7AlA0wwll yMwmJVIVKTl35AKL8ktiJlzI7233ngd1+IW8I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; b=NplnxmO8tSv36bMCeMbDZ+Yyy2ZWfgbJ4FujBpMV5pY+bz1AREp1x/Wg47yT0K/2jU pmOJe8G4x//sooqR9UM15y+tZIC5On2DBxPBN6wKdsdDe+tDXhgGWRLB6A3UDgjTn5M1 gIOSWhygtB9yxCKQuuTKKy+hRYiL6jxWAZmto= MIME-Version: 1.0 Received: by 10.220.20.67 with SMTP id e3mr1941732vcb.132.1307962219216; Mon, 13 Jun 2011 03:50:19 -0700 (PDT) Received: by 10.220.84.65 with HTTP; Mon, 13 Jun 2011 03:50:19 -0700 (PDT) Date: Mon, 13 Jun 2011 12:50:19 +0200 X-Google-Sender-Auth: dhF8NmN4xIbm_GtEbUPK9KbnQ-A Message-ID: From: =?UTF-8?Q?Old=C5=99ich_?= =?UTF-8?Q?Jedli=C4=8Dka?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.8 (----) X-Mailman-Approved-At: Mon, 13 Jun 2011 07:28:49 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.2 (-----) Hi all, I was trying to search for any description helping me understand in what I see, but actually I didn't find any, so I'm here. I discovered it by using automake-1.11, because it uses relative paths a lot. So my simplified testcase is as follows: Have a directory structure x/y and x/z/a. Have a symbolic link from x/y/z that points to x/z. =C2=A0mkdir -p x/y =C2=A0mkdir -p x/z/a =C2=A0ln -s ../z x/y/z Now go into x/y/z/a and try to create directory like that: =C2=A0cd x/y/z/a =C2=A0mkdir ../dir_xyz =C2=A0mkdir ../../dir_xy =C2=A0mkdir ../../../dir_x I would expet that there would be a directory like this: =C2=A0x/dir_x =C2=A0x/y/dir_xy =C2=A0x/y/z/dir_xyz (x/z/dir_xyz) But the result is completely different: =C2=A0dir_x =C2=A0x/dir_xy =C2=A0x/y/z/dir_xyz (x/z/dir_xyz) So when you want to create a directory in the parent structure from within the symbolic link, you will fail in doing so, because the symbolic link would be resolved during walking through parents, so you can get to completely different tree while creating your directory. It looks like a bug, because it is nowhere documented to behave like that (and the behaviour is strange by itself). Verified on Debian 4.0/RedHat 5.4 with coreutils 5.97 and on Gentoo with coreutils 8.12. Regards, Oldrich. From unknown Fri Sep 12 02:09:40 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: =?UTF-8?Q?Old=C5=99ich_?= =?UTF-8?Q?Jedli=C4=8Dka?= Subject: bug#8850: closed (Re: bug#8850: mkdir inside symlink creates wrong directory with relative parent) Message-ID: References: <8762o9g4rf.fsf@rho.meyering.net> X-Gnu-PR-Message: they-closed 8850 X-Gnu-PR-Package: coreutils Reply-To: 8850@debbugs.gnu.org Date: Mon, 13 Jun 2011 14:56:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1307976962-9241-1" This is a multi-part message in MIME format... ------------=_1307976962-9241-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #8850: mkdir inside symlink creates wrong directory with relative parent which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 8850@debbugs.gnu.org. --=20 8850: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8850 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1307976962-9241-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 8850-done) by debbugs.gnu.org; 13 Jun 2011 14:55:41 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QW8YH-0002OS-7g for submit@debbugs.gnu.org; Mon, 13 Jun 2011 10:55:41 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QW8YE-0002OF-AL for 8850-done@debbugs.gnu.org; Mon, 13 Jun 2011 10:55:39 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 829E76019A; Mon, 13 Jun 2011 16:55:32 +0200 (CEST) From: Jim Meyering To: =?utf-8?Q?Old=C5=99ich_Jedli=C4=8Dka?= Subject: Re: bug#8850: mkdir inside symlink creates wrong directory with relative parent In-Reply-To: (=?utf-8?Q?=22Old=C5=99ich=09Jedli=C4=8Dka=22's?= message of "Mon, 13 Jun 2011 12:50:19 +0200") References: Date: Mon, 13 Jun 2011 16:55:32 +0200 Message-ID: <8762o9g4rf.fsf@rho.meyering.net> Lines: 44 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: 8850-done Cc: 8850-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.0 (------) Old=C5=99ich Jedli=C4=8Dka wrote: > I was trying to search for any description helping me understand in > what I see, but actually I didn't find any, so I'm here. I discovered > it by using automake-1.11, because it uses relative paths a lot. So my > simplified testcase is as follows: > > Have a directory structure x/y and x/z/a. Have a symbolic link from > x/y/z that points to x/z. > > =C2=A0mkdir -p x/y > =C2=A0mkdir -p x/z/a > =C2=A0ln -s ../z x/y/z > > Now go into x/y/z/a and try to create directory like that: > > =C2=A0cd x/y/z/a > =C2=A0mkdir ../dir_xyz > =C2=A0mkdir ../../dir_xy > =C2=A0mkdir ../../../dir_x > > I would expet that there would be a directory like this: > > =C2=A0x/dir_x > =C2=A0x/y/dir_xy > =C2=A0x/y/z/dir_xyz (x/z/dir_xyz) > > But the result is completely different: > > =C2=A0dir_x > =C2=A0x/dir_xy > =C2=A0x/y/z/dir_xyz (x/z/dir_xyz) > > So when you want to create a directory in the parent structure from > within the symbolic link, you will fail in doing so, because the > symbolic link would be resolved during walking through parents, so you > can get to completely different tree while creating your directory. It > looks like a bug, because it is nowhere documented to behave like that > (and the behaviour is strange by itself). > > Verified on Debian 4.0/RedHat 5.4 with coreutils 5.97 and on Gentoo > with coreutils 8.12. Loic explained that this is not a bug. (Thanks, Loic.) I'm marking this issue as closed. ------------=_1307976962-9241-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 13 Jun 2011 11:28:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QW5K6-0004PL-2H for submit@debbugs.gnu.org; Mon, 13 Jun 2011 07:28:50 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QW4j0-0003UD-3z for submit@debbugs.gnu.org; Mon, 13 Jun 2011 06:50:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QW4it-0004tT-LB for submit@debbugs.gnu.org; Mon, 13 Jun 2011 06:50:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:35394) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QW4it-0004tO-8z for submit@debbugs.gnu.org; Mon, 13 Jun 2011 06:50:23 -0400 Received: from eggs.gnu.org ([140.186.70.92]:60734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QW4ir-0004l2-HZ for bug-coreutils@gnu.org; Mon, 13 Jun 2011 06:50:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QW4iq-0004ss-7a for bug-coreutils@gnu.org; Mon, 13 Jun 2011 06:50:21 -0400 Received: from mail-vw0-f41.google.com ([209.85.212.41]:55858) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QW4ip-0004se-UU for bug-coreutils@gnu.org; Mon, 13 Jun 2011 06:50:20 -0400 Received: by vws4 with SMTP id 4so4592583vws.0 for ; Mon, 13 Jun 2011 03:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:sender:date:x-google-sender-auth :message-id:subject:from:to:content-type:content-transfer-encoding; bh=8Pyr7oFBVf26znAHbXOebYZck8IgeM/s/MJFK9bUpKg=; b=JqoW0w7UtV6hTJtqvR0qjegffLXf6dLByXeJsZI6Kqd7r0yhMZwEGkqFtVg7RYzeEx yS2j7Uk5P6WVcjGhlhVLvvC/o/0sjKjqPK9xhZh0uYdt18phwGBC27mp9ei7AlA0wwll yMwmJVIVKTl35AKL8ktiJlzI7233ngd1+IW8I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; b=NplnxmO8tSv36bMCeMbDZ+Yyy2ZWfgbJ4FujBpMV5pY+bz1AREp1x/Wg47yT0K/2jU pmOJe8G4x//sooqR9UM15y+tZIC5On2DBxPBN6wKdsdDe+tDXhgGWRLB6A3UDgjTn5M1 gIOSWhygtB9yxCKQuuTKKy+hRYiL6jxWAZmto= MIME-Version: 1.0 Received: by 10.220.20.67 with SMTP id e3mr1941732vcb.132.1307962219216; Mon, 13 Jun 2011 03:50:19 -0700 (PDT) Received: by 10.220.84.65 with HTTP; Mon, 13 Jun 2011 03:50:19 -0700 (PDT) Date: Mon, 13 Jun 2011 12:50:19 +0200 X-Google-Sender-Auth: dhF8NmN4xIbm_GtEbUPK9KbnQ-A Message-ID: Subject: mkdir inside symlink creates wrong directory with relative parent From: =?UTF-8?B?T2xkxZlpY2ggSmVkbGnEjWth?= To: bug-coreutils@gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 13 Jun 2011 07:28:49 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.2 (-----) Hi all, I was trying to search for any description helping me understand in what I see, but actually I didn't find any, so I'm here. I discovered it by using automake-1.11, because it uses relative paths a lot. So my simplified testcase is as follows: Have a directory structure x/y and x/z/a. Have a symbolic link from x/y/z that points to x/z. =C2=A0mkdir -p x/y =C2=A0mkdir -p x/z/a =C2=A0ln -s ../z x/y/z Now go into x/y/z/a and try to create directory like that: =C2=A0cd x/y/z/a =C2=A0mkdir ../dir_xyz =C2=A0mkdir ../../dir_xy =C2=A0mkdir ../../../dir_x I would expet that there would be a directory like this: =C2=A0x/dir_x =C2=A0x/y/dir_xy =C2=A0x/y/z/dir_xyz (x/z/dir_xyz) But the result is completely different: =C2=A0dir_x =C2=A0x/dir_xy =C2=A0x/y/z/dir_xyz (x/z/dir_xyz) So when you want to create a directory in the parent structure from within the symbolic link, you will fail in doing so, because the symbolic link would be resolved during walking through parents, so you can get to completely different tree while creating your directory. It looks like a bug, because it is nowhere documented to behave like that (and the behaviour is strange by itself). Verified on Debian 4.0/RedHat 5.4 with coreutils 5.97 and on Gentoo with coreutils 8.12. Regards, Oldrich. ------------=_1307976962-9241-1-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 13 10:57:02 2011 Received: (at control) by debbugs.gnu.org; 13 Jun 2011 14:57:02 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QW8ZZ-0002Qh-Po for submit@debbugs.gnu.org; Mon, 13 Jun 2011 10:57:02 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QW8ZY-0002QS-Nd for control@debbugs.gnu.org; Mon, 13 Jun 2011 10:57:01 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 4CF4B602F7; Mon, 13 Jun 2011 16:56:55 +0200 (CEST) From: Jim Meyering To: control@debbugs.gnu.org Subject: notabug Date: Mon, 13 Jun 2011 16:56:55 +0200 Message-ID: <87zklleq4o.fsf@rho.meyering.net> Lines: 2 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.0 (------) tags 8850 + notabug thanks