rename and chmod (was: cp -p)

2008-02-08 Thread Pietro Cerutti
Ok, my view is getting clearer ;-)


my problem in understanding the semantics of mv, cp -p and the rename(2)
function seems to be related to the terminology used in chmod(1) man page.

This is the explanation of setuid (the same holds for setgid):

Directories with this bit set will force all files and subdirectories
created in them to be owned by the directory owner and not by the uid of
the creating process, if the underlying file system supports this feature

Now, from a logical point of view, why moving a file into a directory
doesn't fall into the created into them case?


-- 
Pietro Cerutti

PGP Public Key:
http://gahr.ch/pgp



signature.asc
Description: OpenPGP digital signature


rename and chmod (was: cp -p)

2008-02-08 Thread Wouter Oosterveld
  Now, from a logical point of view, why moving a file into a directory
  doesn't fall into the created into them case?
 
  Because (if on the same filesystem) you don't create a new file. You
  just link the file in the destination dir and unlink the file from the
  source dir.

 Exactly. But from a /*logical*/ point of view, shouldn't this case be
 treated /*as if*/ the file was created inside the target directory?

No. This has nothing to do with logics but with your premisses, the
implementation of mv and standards (IEEE Std 1003.2 (``POSIX.2'')).

It just behaves different than you would expect, but that is no logical error.

  Regards,
 
  Wouter


 --
 Pietro Cerutti

 PGP Public Key:
 http://gahr.ch/pgp





--
[
  [EMAIL PROTECTED] is binnenkort niet meer,
[EMAIL PROTECTED] is mijn nieuwe email-adres.
]


-- 
[
  [EMAIL PROTECTED] is binnenkort niet meer,
[EMAIL PROTECTED] is mijn nieuwe email-adres.
]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: rename and chmod (was: cp -p)

2008-02-08 Thread Wouter Oosterveld
Now, from a logical point of view, why moving a file into a directory
doesn't fall into the created into them case?

Because (if on the same filesystem) you don't create a new file. You
just link the file in the destination dir and unlink the file from the
source dir.

Regards,

Wouter

2008/2/8, Pietro Cerutti [EMAIL PROTECTED]:
 Ok, my view is getting clearer ;-)


 my problem in understanding the semantics of mv, cp -p and the rename(2)
 function seems to be related to the terminology used in chmod(1) man page.

 This is the explanation of setuid (the same holds for setgid):

 Directories with this bit set will force all files and subdirectories
 created in them to be owned by the directory owner and not by the uid of
 the creating process, if the underlying file system supports this feature

 Now, from a logical point of view, why moving a file into a directory
 doesn't fall into the created into them case?


 --
 Pietro Cerutti

 PGP Public Key:
 http://gahr.ch/pgp





-- 
[
  [EMAIL PROTECTED] is binnenkort niet meer,
[EMAIL PROTECTED] is mijn nieuwe email-adres.
]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: rename and chmod (was: cp -p)

2008-02-08 Thread Pietro Cerutti
Wouter Oosterveld wrote:
 Now, from a logical point of view, why moving a file into a directory
 doesn't fall into the created into them case?
 
 Because (if on the same filesystem) you don't create a new file. You
 just link the file in the destination dir and unlink the file from the
 source dir.

Exactly. But from a /*logical*/ point of view, shouldn't this case be
treated /*as if*/ the file was created inside the target directory?

 
 Regards,
 
 Wouter


-- 
Pietro Cerutti

PGP Public Key:
http://gahr.ch/pgp



signature.asc
Description: OpenPGP digital signature


Re: rename and chmod (was: cp -p)

2008-02-08 Thread Jerry McAllister
On Fri, Feb 08, 2008 at 12:30:57PM +0100, Pietro Cerutti wrote:

 Wouter Oosterveld wrote:
  Now, from a logical point of view, why moving a file into a directory
  doesn't fall into the created into them case?
  
  Because (if on the same filesystem) you don't create a new file. You
  just link the file in the destination dir and unlink the file from the
  source dir.
 
 Exactly. But from a /*logical*/ point of view, shouldn't this case be
 treated /*as if*/ the file was created inside the target directory?

Not if you use mv.   If you use cp, then it could.

By definition, mv only moves the pointer/link or whatever it is called
and doesn't change anything else.

jerry

 
  
  Regards,
  
  Wouter
 
 
 -- 
 Pietro Cerutti
 
 PGP Public Key:
 http://gahr.ch/pgp
 


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]