"Derek R. Price" <[EMAIL PROTECTED]> writes:
> Autoconf folks, the comment on 'mv' in the Portable Shell section of the new
> manual might not be appropriate:
>
> `mv'
> The only portable options are `-f' and `-i'.
>
> Moving individual files between file systems is portable (it was
> in V6), but it is not always atomic: when doing `mv new existing',
> there's a critical section where neither the old nor the new
> version of `existing' actually exists.
>
> Moving directories across mount points is not portable, use `cp'
> and `rm'.
>
> Since it's not uncommon to have a build dir in /tmp, this fails on
> BSD with an NFS mounted home due to /tmp's default group ownership
> of wheel (root) and the default setgid behavior of its directories.
> Well, it copies the file but outputs error messages since root group
> ownership can't be set via NFS. cp;rm should probably be the
> recommended approach if the relative positioning of the files is unknown.
[snip]
> Not owned, but the /tmp directory is using BSD's setgid mode, so the
> group owner of the file is root (well, 'wheel' on my BSD, but it is
> gid 0):
>
> > cd
> > touch /tmp/myfile
> > mv /tmp/myfile .
> mv: ./myfile: set owner/group (was: 506/0): Operation not permitted
> > df -k /tmp .
> Filesystem 1K-blocks Used Avail Capacity Mounted on
> /dev/ad0s1a 168639 34584 120564 22% /
> empress:/home 18271560 10569496 6773912 61% /home
> > ls -ld /tmp
> drwxrwxrwt 6 root wheel 512 Jan 19 15:29 /tmp
^
There's no 'setgid' bit on the /tmp directory. Does BSD still exhibit
'setgid' behaviour? I don't thing the sticky tag changes 'setgid'
behaviour of a directory.
* What are the permissions on /tmp/myfile?
* Can you create files in the your home directory?
* Are you in, or did you change with newgrp(1) to, group 'wheel'?
Still, I'm starting to agree with you that cp/rm makes more sense than
mv to move files across mount points, what with the way file ownership
and NFS interact.
- Hari
--
Raja R Harinath ------------------------------ [EMAIL PROTECTED]
"When all else fails, read the instructions." -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing." -- Roy L Ash