GNU bug report logs -
#47151
cp --recursive funky behaviour
Previous Next
Reported by: Tomas <correo <at> tomaszubiri.com>
Date: Mon, 15 Mar 2021 00:59:01 UTC
Severity: normal
Tags: wontfix
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47151 in the body.
You can then email your comments to 47151 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#47151
; Package
coreutils
.
(Mon, 15 Mar 2021 00:59:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tomas <correo <at> tomaszubiri.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Mon, 15 Mar 2021 00:59:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
cd /tmp
mkdir src
touch src/a
cp -r src dest
#damn, I forgot a file
touch src/b
cp -r src dest
ls dest
# a dest
[Message part 2 (text/html, inline)]
[grucp.png (image/png, attachment)]
Added tag(s) wontfix.
Request was from
Paul Eggert <eggert <at> cs.ucla.edu>
to
control <at> debbugs.gnu.org
.
(Mon, 21 Feb 2022 09:55:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Mon, 21 Feb 2022 09:55:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Tomas <correo <at> tomaszubiri.com>
:
bug acknowledged by developer.
(Mon, 21 Feb 2022 09:55:03 GMT)
Full text and
rfc822 format available.
Message #12 received at 47151-done <at> debbugs.gnu.org (full text, mbox):
On 3/14/21 17:47, Tomas wrote:
> cd /tmp
> mkdir src
> touch src/a
> cp -r src dest
>
> #damn, I forgot a file
> touch src/b
> cp -r src dest
> ls dest
> # a dest
cp has behaved that way for ages, and is required to behave that way by
POSIX, so this is not a bug. To sidestep the issue, you can use the -T
option of GNU cp. Closing the bug report.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#47151
; Package
coreutils
.
(Mon, 21 Feb 2022 22:14:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 47151 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello.
Interesting, so cp complies to the posix specifications.
I found this, I am not sure whether it's the right specs.
https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/
"2) f) The files in the directory source_file shall be copied to the directory dest_file, taking the four steps (1 to 4)
listed here with the files as source_files."
Is this the relevant part? It seems to me that this would support copying src/a and src/b (the files in the directory source_file) to dest/a and dest/b (copied to the directory dest_file) rather than to dest/src/a and dest/src/b (which would be copying the directory, not the files in the directory). But maybe I'm missing a part of the spec or am interpreting it differently.
Regards, Tomas.
---- Activado lun, 21 feb 2022 06:55:03 -0300 GNU bug Tracking System <help-debbugs <at> gnu.org> escribió ----
Your bug report
#47151: cp --recursive funky behaviour
which was filed against the coreutils package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 47151 <at> debbugs.gnu.org.
--
47151: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=47151
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
========================= Forwarded message =========================
Subject: Re: bug#47151: cp --recursive funky behaviour
From: "Paul Eggert"<eggert <at> cs.ucla.edu>
Date: Mon, 21 Feb 2022 01:54:02 -0800
To: "Tomas"<correo <at> tomaszubiri.com>
Cc: <47151-done <at> debbugs.gnu.org>
------------------------- Contents -------------------------
On 3/14/21 17:47, Tomas wrote:
> cd /tmp
> mkdir src
> touch src/a
> cp -r src dest
>
> #damn, I forgot a file
> touch src/b
> cp -r src dest
> ls dest
> # a dest
cp has behaved that way for ages, and is required to behave that way by
POSIX, so this is not a bug. To sidestep the issue, you can use the -T
option of GNU cp. Closing the bug report.
====================== End of Forwarded Mail ======================
========================= Forwarded message =========================
Subject: cp --recursive funky behaviour
From: "Tomas"<correo <at> tomaszubiri.com>
Date: Sun, 14 Mar 2021 21:47:05 -0300
To: "bug-coreutils"<bug-coreutils <at> gnu.org>
------------------------- Contents -------------------------
cd /tmp
mkdir src
touch src/a
cp -r src dest
#damn, I forgot a file
touch src/b
cp -r src dest
ls dest
# a dest
====================== End of Forwarded Mail ======================
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#47151
; Package
coreutils
.
(Mon, 21 Feb 2022 22:33:01 GMT)
Full text and
rfc822 format available.
Message #18 received at 47151 <at> debbugs.gnu.org (full text, mbox):
On 2/21/22 10:49, Tomas wrote:
> I found this, I am not sure whether it's the right specs.
>
> https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/
Yes, or more precisely for 'cp':
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html
> "2) f) The files in the directory source_file shall be copied to the directory dest_file, taking the four steps (1 to 4)
> listed here with the files as source_files."
>
> Is this the relevant part? It seems to me that this would support copying src/a and src/b (the files in the directory source_file) to dest/a and dest/b (copied to the directory dest_file) rather than to dest/src/a and dest/src/b (which would be copying the directory, not the files in the directory). But maybe I'm missing a part of the spec or am interpreting it differently.
Yes, I think the part you're missing is below. Your first "cp -r src
dest" uses the 3rd paragraph quoted below; your second "cp -r src dst"
uses the 2nd paragraph.
=====
The third synopsis form is denoted by two or more operands where the -R
option is specified. The cp utility shall copy each file in the file
hierarchy rooted in each source_file to a destination path named as follows:
If target exists and names an existing directory, the name of the
corresponding destination path for each file in the file hierarchy shall
be the concatenation of target, a single <slash> character if target did
not end in a <slash>, and the pathname of the file relative to the
directory containing source_file.
If target does not exist and two operands are specified, the name
of the corresponding destination path for source_file shall be target;
the name of the corresponding destination path for all other files in
the file hierarchy shall be the concatenation of target, a <slash>
character, and the pathname of the file relative to source_file.
=====
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 22 Mar 2022 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 29 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.