Re: Filenames with hyphens & cp/chown

From: M Khomo (mkhomo_at_ostecs.com)
Date: 05/04/04


Date: Tue, 04 May 2004 14:15:01 -0500

Uwe Dippel wrote:
> On Mon, 03 May 2004 18:59:39 -0500, M Khomo wrote:
>
>
>>Apparently 'cp -p' invokes 'chown'. When the file list to 'cp -p' has a
>>file with embedded hyphens in its name, 'chown' complains: 'cp: chown:
>>./Figs 1-3.pdf: Invalid argument'.
>
>
> Sorry, a bit stupid, I'm not clear what you want to do.
> Here I didn't get further than
>
> # ls -l 1-3.pdf
> -rw-r--r-- 1 udippel udippel 24 May 4 22:15 1-3.pdf
> # cp -p 1-3.pdf /home/wira/
> # ls -l /home/wira/
> total 199820
> -rw-r--r-- 1 wira wira 768 Nov 6 19:07 .cshrc
> -rw-r--r-- 1 wira wira 317 Nov 6 19:07 .login
> -rw-r--r-- 1 wira wira 11 Jan 4 11:02 .mailboxlist
> -rw-r--r-- 1 wira wira 105 Nov 6 19:07 .mailrc
> -rw-r--r-- 1 wira wira 199 Nov 6 19:07 .profile
> -rw------- 1 wira wira 126 Nov 6 19:07 .rhosts
> -rw-r--r-- 1 udippel udippel 24 May 4 22:15 1-3.pdf
> -rw------- 1 wira wira 5601 Mar 11 18:14 Sent

Hmmm,
   Maybe the embedded space also is involved. Perhaps it was a genuine
permissions problem and the hyphen was circumstantial/coincidental. I
was copying a PC file with embedded spaces and hyphens from an ffs
partition to an msdos partition. Its name was actually 'Figs 1-3.pdf'.
Perhaps the destination mount had genuine permission problems I'll check
and report back. Again, I was on obsd3.4.

OK Here goes:

I can replicate what you demonstrate:
> prompt> cp -p *.pdf /tmp
> prompt> ls /tmp/*.pdf
> Figs 1-5.pdf
> tmprules-1.dat
> prompt> rm /tmp/*.pdf
> prompt> su
> Password:
> host# ls *.pdf
> Figs 1-5.pdf
> host# chgrp wheel *.pdf
> host# exit
> host# exit
> prompt> cp -p *.pdf /tmp
> prompt> ls -l /tmp/*.pdf
> total 144
> -rw-r--r-- 1 mkhomo wheel 70815 May 3 18:34 Figs 1-5.pdf
> prompt> rm /tmp/*.pdf

NB: slightly different issue is why the file took up 'wheel' group to
which mkhomo is member. It was created by a mozilla download.

Then I can replicate what I reported:
> prompt> su
> Password:
> host# mount
> /dev/wd0a on / type ffs (local)
> /dev/wd0g on /home type ffs (local, nodev, nosuid)
> /dev/wd0e on /usr type ffs (local, nodev)
> /dev/wd0f on /usr/local type ffs (local, nodev)
> /dev/wd0d on /var type ffs (local, nodev, nosuid)
> host# mount /dev/wd0k /mnt
> host# ls /mnt/tmp
> ls: /mnt/tmp: No such file or directory
> host# mkdir /mnt/tmp
> host# cp -p *.pdf /mnt/tmp
> cp: chown: /mnt/tmp/Figs 1-5.pdf: Invalid argument
> host# ls /mnt/tmp
> Figs 1-5.pdf
> host# ls -l /mnt/tmp
> total 72
> -rwxr-xr-x 1 root wheel 70815 May 4 13:46 Figs 1-5.pdf
> host#

As before, the copy does happen, but 'chown' (2), almost seems to be
parsing the file name like multiple args with optargs. Could be a
semantically misleading error message since your scenario indicates
chown(2) does handle the filename and permission preservation properly.
Whatever permission problems in the transformation from unix perms to
msdos perms should have triggered an error.

NB2: The msdos mount gives the mounted fs root/wheel, maybe the nearest
thing to the NT Administrator permissions??



Relevant Pages

  • Re: [SLE] Has NFS Changed in 9.1?
    ... Anders Johansson wrote: ... when you use the host name when you mount. ... eternal power and divine nature -- have been clearly seen, ...
    (SuSE)
  • Re: disksuite and dual attached multipak?
    ... >> failure on the primary host. ... In the event of a failure, I want to be able to mount the ... set up your metadevices in metasets, and make sure that both hosts have access ...
    (comp.unix.solaris)
  • Re: NFS export subdirs on different file systems?
    ... What I want is that when I mount /net/store from another machine, ... So I can't just make fstab entries on the client side to ... I can access the exported filesystems as ... Kind of like the "host" type amd filesystem, but only for a specific branch. ...
    (freebsd-questions)
  • NFS wont work (RH9, simple LAN)
    ... to host a couple directories for a RH9 workstation install (hostname ... Jan 31 22:40:24 Desktop netfs: Mounting NFS filesystems: failed ... A mount from the shell on Desktop times out. ... A mount from the shell times out. ...
    (comp.os.linux.misc)