GNU bug report logs - #8850
mkdir inside symlink creates wrong directory with relative parent

Previous Next

Package: coreutils;

Reported by: Oldřich Jedlička <oldium.pro <at> seznam.cz>

Date: Mon, 13 Jun 2011 11:29:02 UTC

Severity: normal

Tags: notabug

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8850 in the body.
You can then email your comments to 8850 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8850; Package coreutils. (Mon, 13 Jun 2011 11:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oldřich Jedlička <oldium.pro <at> seznam.cz>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 13 Jun 2011 11:29:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Oldřich Jedlička <oldium.pro <at> seznam.cz>
To: bug-coreutils <at> gnu.org
Subject: mkdir inside symlink creates wrong directory with relative parent
Date: Mon, 13 Jun 2011 12:50:19 +0200
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.

 mkdir -p x/y
 mkdir -p x/z/a
 ln -s ../z x/y/z

Now go into x/y/z/a and try to create directory like that:

 cd x/y/z/a
 mkdir ../dir_xyz
 mkdir ../../dir_xy
 mkdir ../../../dir_x

I would expet that there would be a directory like this:

 x/dir_x
 x/y/dir_xy
 x/y/z/dir_xyz (x/z/dir_xyz)

But the result is completely different:

 dir_x
 x/dir_xy
 x/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.




Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Mon, 13 Jun 2011 14:56:02 GMT) Full text and rfc822 format available.

Notification sent to Oldřich Jedlička <oldium.pro <at> seznam.cz>:
bug acknowledged by developer. (Mon, 13 Jun 2011 14:56:02 GMT) Full text and rfc822 format available.

Message #10 received at 8850-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Oldřich Jedlička <oldium.pro <at> seznam.cz>
Cc: 8850-done <at> debbugs.gnu.org
Subject: Re: bug#8850: mkdir inside symlink creates wrong directory with
	relative parent
Date: Mon, 13 Jun 2011 16:55:32 +0200
Oldřich Jedlička 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.
>
>  mkdir -p x/y
>  mkdir -p x/z/a
>  ln -s ../z x/y/z
>
> Now go into x/y/z/a and try to create directory like that:
>
>  cd x/y/z/a
>  mkdir ../dir_xyz
>  mkdir ../../dir_xy
>  mkdir ../../../dir_x
>
> I would expet that there would be a directory like this:
>
>  x/dir_x
>  x/y/dir_xy
>  x/y/z/dir_xyz (x/z/dir_xyz)
>
> But the result is completely different:
>
>  dir_x
>  x/dir_xy
>  x/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.




Added tag(s) notabug. Request was from Jim Meyering <jim <at> meyering.net> to control <at> debbugs.gnu.org. (Mon, 13 Jun 2011 14:58:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 12 Jul 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 65 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.