GNU bug report logs - #18499
Possible mv race for hardlinks (rhbz #1141368 )

Previous Next

Package: coreutils;

Reported by: ovasik <at> redhat.com

Date: Thu, 18 Sep 2014 10:54:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


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

From: Boris Ranto <branto <at> redhat.com>
To: Pádraig Brady <P <at> draigbrady.com>
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 18499 <at> debbugs.gnu.org, ovasik <at> redhat.com,
 Miklos Szeredi <miklos <at> szeredi.hu>
Subject: Re: bug#18499: Possible mv race for hardlinks (rhbz #1141368 )
Date: Fri, 21 Nov 2014 09:29:38 +0100
On Fri, 2014-11-21 at 03:30 +0000, Pádraig Brady wrote:
> On 18/11/14 19:28, Boris Ranto wrote:
> > On Tue, 2014-11-18 at 16:46 +0000, Pádraig Brady wrote:
> >> On 18/11/14 16:29, Boris Ranto wrote:
> >>> On Mon, 2014-11-17 at 00:28 +0000, Pádraig Brady wrote:
> >>>> On 16/11/14 16:35, Paul Eggert wrote:
> >>>>> Pádraig Brady wrote:
> >>>>>> If we change this, it's much more likely that people will start complaining
> >>>>>> about their non overlapping mv instances failing.
> >>>>>
> >>>>> I'd far rather deal with those complaints than deal with complaints about 'mv' silently discarding files.  Either the FreeBSD or the Solaris behavior would be a real improvement over what we're doing now.  Neither behavior is as good as having support in the kernel for doing the right thing, but one step at a time.
> >>>>
> >>>> Fair enough. That's 3 votes for changing this.
> >>>> I'll work on a patch to fail in this case.
> >>>>
> >>>> thanks,
> >>>> Pádraig.
> >>>>
> >>>
> >>> I've looked at the code and I was able to identify the part that deals
> >>> with the symlinks. I'm attaching the patch that makes mv fail in this
> >>> case.
> >>
> >> I'm not sure symlinks should be treated differently here.
> >> I.E. it may be best to remove the whole unlink_src logic.
> >> I'll look later.
> >>
> >> thanks,
> >> Pádraig.
> > 
> > You were right, the only other place that used the unlink_src logic was
> > the case handling mv for symlinks that were hard links to the same file
> > (this case was handled separetely from the normal files) -- i.e. the
> > case where you do this:
> > touch a; ln -s a b; ln b c; mv b c
> > 
> > I'm attaching the revised patch that removes the whole unlink_src logic
> > altogether.
> 
> We want to leave the logic in place for cp and install though,
> and I've adjusted your patch accordingly. I've also adjusted
> the tests to pass and augmented the tests to cover one of
> the cases missed in the previous patch.  I'll push this tomorrow.
> 
> thanks,
> Pádraig.

Just a note: cp already presented this behaviour before the patch, i.e. 

cp a b

on hard links to the same file failed with 

cp: ‘a’ and ‘b’ are the same file

On the other hand, install does not present it, it copies over b
creating new inode for b.

-Boris





This bug report was last modified 10 years and 180 days ago.

Previous Next


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