GNU bug report logs - #63245
Potential regression: cp --preserve=mode or --preserve=all fails to copy files from subdirectory

Previous Next

Package: coreutils;

Reported by: Schlomo Schapiro <schlomo <at> schapiro.org>

Date: Wed, 3 May 2023 12:49:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Schlomo Schapiro <schlomo <at> schapiro.org>
Subject: bug#63245: closed (Re: bug#63245: Potential regression: cp
 --preserve=mode or --preserve=all fails to copy files from subdirectory)
Date: Thu, 04 May 2023 22:30:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#63245: Potential regression: cp --preserve=mode or --preserve=all fails to copy files from subdirectory

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 63245 <at> debbugs.gnu.org.

-- 
63245: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63245
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Pádraig Brady <P <at> draigBrady.com>
To: Schlomo Schapiro <schlomo <at> schapiro.org>
Cc: 63245-done <at> debbugs.gnu.org, Kamil Dudka <kdudka <at> redhat.com>,
 Michael Stone <mstone <at> debian.org>
Subject: Re: bug#63245: Potential regression: cp --preserve=mode or
 --preserve=all fails to copy files from subdirectory
Date: Thu, 4 May 2023 23:29:16 +0100
On 04/05/2023 12:27, Pádraig Brady wrote:
> On 04/05/2023 07:27, Schlomo Schapiro wrote:
>> Hi Pádraig,
>>
>> thank you, that will not yet fix the problem in the older distros? What
>> about the RPM world with Fedora/RHEL and Archlinux? As far as I can tell
>> all cp version 9.x are affected by this.
> 
> I'll handle the Fedora 37/38 fixes.
> RHEL/Centos and current Archlinux are not affected AFAICS.

Fedora 37 and 38 updates are now pending (cc Kamil):
https://bodhi.fedoraproject.org/updates/FEDORA-2023-65365355b3
https://bodhi.fedoraproject.org/updates/FEDORA-2023-4beb422aac

The Fedora patches should also apply to the debian bookworm package,
so I've opened bugs accordingly at:

https://bugs.debian.org/1035530
https://bugs.debian.org/1035531

Schlomo, the second one is the one you're particularly interested in.

Marking this bug as completed upstream.

cheers,
Pádraig

[Message part 3 (message/rfc822, inline)]
From: Schlomo Schapiro <schlomo <at> schapiro.org>
To: bug-coreutils <at> gnu.org
Subject: Potential regression: cp --preserve=mode or --preserve=all fails to
 copy files from subdirectory
Date: Wed, 3 May 2023 11:27:01 +0200
[Message part 4 (text/plain, inline)]
Hello,

I'm a maintainer of the Relax-and-Recover (https://relax-and-recover.org/)
Open Source project and think that I might have found a major regression in
cp, starting somewhere with version 9.

Please see https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/2017414
and https://github.com/rear/rear/issues/2972 for how I found out about this.

Problem:

We use a cp call like the following to copy various files and directory
into a destination path with preserving the structure:

cp --verbose -t DESTINATION -L --preserve=all --parents SOURCE...

Over the last 10+ years that worked well on all Linux distros (ReaR is
build for and tested on nearly all distros), but I recently found out that
on Ubuntu 23.04 this fails like this:

# rm -Rf /tmp/f && mkdir /tmp/f && cp --verbose -t /tmp/f -L --preserve=all
--parents /etc/apt/sources.list && echo yes ; ls -lR
/tmp/f/etc/apt/sources.list
/etc/apt/sources.list
/etc -> /tmp/f/etc
/etc/apt -> /tmp/f/etc/apt
'/etc/apt/sources.list' -> '/tmp/f/etc/apt/sources.list'
cp: ‘etc/apt’: No such file or directory
-rw-r--r-- 1 root root 2437 Apr 23 09:53 /etc/apt/sources.list
-rw-r--r-- 1 root root 2437 Apr 23 09:53 /tmp/f/etc/apt/sources.list
#

Ubuntu 23.04 uses cp (GNU coreutils) 9.1

On Ubuntu 22.04 there is cp (GNU coreutils) 8.32 and the same example works
as expected:

# rm -Rf /tmp/f && mkdir /tmp/f && cp --verbose -t /tmp/f -L --preserve=all
--parents /etc/apt/sources.list && echo yes ; ls -lR
/tmp/f/etc/apt/sources.list /etc/apt/sources.list
/etc -> /tmp/f/etc
/etc/apt -> /tmp/f/etc/apt
'/etc/apt/sources.list' -> '/tmp/f/etc/apt/sources.list'
yes
-rw-r--r-- 1 root root 263 Mär 26 15:20 /etc/apt/sources.list
-rw-r--r-- 1 root root 263 Mär 26 15:20 /tmp/f/etc/apt/sources.list
#

BTW, I checked also on many other distros that ReaR supports and all
distros with cp version 9.1 fail in the same way.

Can you please have a look and advise how to proceed? We at the ReaR
project can of course change our code to use tar for example, but I won't
be surprised if other users will also meet this changed behaviour and maybe
it is indeed a bug.

Kind regards,
Schlomo Schapiro
[Message part 5 (text/html, inline)]

This bug report was last modified 2 years and 73 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.