....
 

Guardian Digital Inc. > InfoCenter > Mailing List Archives > Amavis

Amavis Mailing List Archive

From: Martin Orr (amavis@martinorr.name)
Date: Fri Dec 17 2004 - 11:43:28 EST


On Fri, Dec 17, 2004 at 02:25:37PM +0100, Mark Martinec wrote:
> Gary,
>
> > > Strange. Perhaps your Perl is too clever and recognizes the rename
> > > to the same name is a no-op. Try to rename to a different name -
> > > the second argument in the qw list, i.e.
> > > qw(/etc/amavis/amavisd.conf /etc/amavis/amavisd.conf.different)
> >
> > # su amavis -c 'perl -e "warn rename(qw(/etc/amavis/amavisd.conf
> > /etc/amavis/amavisd.conf-2)) ? qq(renamed, nogood\n) : qq(can not,ok\n)"'
> > can not,ok
>
> So it appears this is the answer,

It's not just Perl. I wrote a test C program to simply rename a file to
itself which succeeds even without access to the directory. I then looked
in my kernel sources (2.4.28 from kernel.org) and fs/namei.c contains
        if (old_dentry->d_inode == new_dentry->d_inode)
                return 0;
at the top of the vfs_rename_other function, before permission checks i.e.
it seems that the kernel deliberately allows this.

In fact from the Single Unix Specification
(http://www.opengroup.org/onlinepubs/007908799/xsh/rename.html):
If the old argument and the new argument both refer to, and both link to the
same existing file, rename() returns successfully and performs no other
action.

-- 
Martin Orr
Linux Administrator,
Methodist College Belfast
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/


[ About Guardian Digital ] - [ Press Center ] - [ Contact Us ] - [ System Activation ] - [ Reseller Info ] - [ Online Store ] - [ Site Map ]
Copyright (c) 2000 - 2004 Guardian Digital, Inc. Linux Lockbox and EnGarde are Trademarks of Guardian Digital, Inc.