public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Ketil Froyn <ketil@froyn.name>
Cc: "J.A. Magallón" <jamagallon@ono.com>, linux-kernel@vger.kernel.org
Subject: Re: unexpected rename() behaviour
Date: Sat, 29 Mar 2008 13:36:38 +0100	[thread overview]
Message-ID: <jesky9g10p.fsf@sykes.suse.de> (raw)
In-Reply-To: <47EE2072.7000504@froyn.name> (Ketil Froyn's message of "Sat\, 29 Mar 2008 11\:56\:50 +0100")

Ketil Froyn <ketil@froyn.name> writes:

> Is this a corner case undefined by POSIX, for instance, or does POSIX
> explicitly say that this is the correct behaviour?

POSIX explicitly requires that behavior.

> So given the case that it is a requirement that oldpath should be removed
> after the rename(), does all software need to check whether oldpath and
> newpath are existing hard links referring to the same file, and if so,
> call unlink(oldpath) instead? I would guess that lots of existing software
> doesn't.

I don't think there are many programs that encounter that situation.
Probably in most cases the new file was created by the program and
guaranteed to be different from the old file.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

  reply	other threads:[~2008-03-29 12:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-29  0:07 unexpected rename() behaviour Ketil Froyn
2008-03-29  0:16 ` J.A. Magallón
2008-03-29 10:56   ` Ketil Froyn
2008-03-29 12:36     ` Andreas Schwab [this message]
2008-03-29 12:57     ` David Newall

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=jesky9g10p.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=jamagallon@ono.com \
    --cc=ketil@froyn.name \
    --cc=linux-kernel@vger.kernel.org \
    /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