mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andries Brouwer <aebr@win.tue.nl>
To: Andreas Schwab <schwab@suse.de>
Cc: Martin Rode <martin.rode@zeroscale.com>,
	Dave Kleikamp <shaggy@austin.ibm.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: cp fails in this symlink case, kernel 2.4.25, reiserfs + ext2
Date: Sat, 10 Apr 2004 21:52:56 +0200	[thread overview]
Message-ID: <20040410195256.GA1909@wsdw14.win.tue.nl> (raw)
In-Reply-To: <je1xmy3jr5.fsf@sykes.suse.de>

On Thu, Apr 08, 2004 at 11:24:14AM +0200, Andreas Schwab wrote:

> >> > 5) cp fails
> >> > apu:/home/martin/tmp/bug# (cd alpha/beta; cp ../latest/myfile .)
> >> > cp: cannot stat `../latest/myfile': No such file or directory
> >> 
> >> When you cd to alpha/beta, your current directory is really
> >> .../tmp/bug/beta.  Your shell may remember that you got there through
> >> the symlink in alpha, but cp will follow .., which is really bug.
> >
> > Bug in "cp", "bash" or in the kernel fs-layer? 
> 
> Neither.

POSIX is seriously broken here. It is terrible to have a system
where "cd .." does not go to the directory that is listed by "ls ..".

Thus, one should always set -o physical.

(We should have had a command "cd.." to go back to where we came from,
distinct from "cd ..".)

But also bash is broken and violates POSIX:
% pwd
/foo
% mkdir abc
% cd abc
% pwd
/foo/abc
% mv ../abc ../qqq
% /bin/pwd
/foo/qqq
% pwd
/foo/abc
% pwd -L
/foo/abc
% pwd -P
%

We see two bugs: "pwd -P" gives no output at all, and "pwd"
gives the wrong output.

POSIX says:
       -L     If the PWD environment variable contains  an  abso-
              lute  pathname  of  the current directory that does
              not contain the filenames dot or dot-dot, pwd shall
              write  this pathname to standard output. Otherwise,
              the -L option shall behave as the -P option.

So, in the situation where PWD contains /foo/abc but that is
not an absolute pathname of the current directory, the output
must be /foo/qqq and not $PWD.

Andries

  reply	other threads:[~2004-04-10 19:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-07 17:35 Martin Rode
2004-04-07 19:16 ` Dave Kleikamp
2004-04-08  7:56   ` Martin Rode
2004-04-08  9:24     ` Andreas Schwab
2004-04-10 19:52       ` Andries Brouwer [this message]
2004-04-08 21:17     ` Michael Driscoll

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040410195256.GA1909@wsdw14.win.tue.nl \
    --to=aebr@win.tue.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.rode@zeroscale.com \
    --cc=schwab@suse.de \
    --cc=shaggy@austin.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®