[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27606: cp: copy directory attributes only
From: |
Lion Yang |
Subject: |
bug#27606: cp: copy directory attributes only |
Date: |
Fri, 07 Jul 2017 11:12:35 +0800 |
Hi,
`--preserve=all` is very useful indeed. To directories, most of the
time of copying attributes, we don't want to let `cp` mess up the files
inside, I mean, I will do it manually. So there will be an
`--attributes-only`.
Go on. Target is a directory, we must treat it as a file. Otherwise it
may think we are going to put the source INTO destination. So there
will be a `--no-target-directory`.
The issue is, copy_internal() does not work:
(src/copy.c)
1857 src_mode = src_sb.st_mode;
1858
1859 if (S_ISDIR (src_mode) && !x->recursive)
1860 {
1861 error (0, 0, ! x->install_mode /* cp */
1862 ? _("-r not specified; omitting directory %s")
1863 : _("omitting directory %s"),
1864 quoteaf (src_name));
1865 return false;
1866 }
This part says: if your source is a directory and you want to do
something with it, you MUST do it recursively.
This is not reasonable in such scenario. I propose to change or remove
this limit to allow copying something of directory itself.
Best regards
Lion Yang
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#27606: cp: copy directory attributes only,
Lion Yang <=