bug-cpio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cpio -m does not preserve timestamps for symlinks


From: Carl Edquist
Subject: Re: cpio -m does not preserve timestamps for symlinks
Date: Tue, 4 Feb 2020 13:32:50 -0600 (CST)
User-agent: Alpine 2.21 (DEB 202 2017-01-01)

Hello Pavel,

Patch is also proposed here:
https://www.mail-archive.com/address@hidden/msg00605.html

Thanks for the link; it looks like you've made several attempts to get attention about this issue here and downstream, without any luck :-\

Looks like you and I went about it a little differently, but at the end of the day they both boil down to calls to utimensat with AT_SYMLINK_NOFOLLOW.

I tried to make my patch minimal, changing only the few necessary lines, which I hope is easy for the maintainers to review.

Thanks..!
Carl

On Tue, 4 Feb 2020, Pavel Raiskup wrote:

On Tuesday, February 4, 2020 7:05:21 PM CET Carl Edquist wrote:
Hi all,

It seems that for a cpio archive that contains symlinks, the timestamps
for those symlinks are not getting preserved, even with the '-m' option.

I believe I found the issue -

in copyin.c, copyin_regular_file() and copyin_device() both make calls to
set file times (if '-m' was specified), but copyin_link() does not.

I was able to fix it by adding a call to set_file_times() in copyin_link()
if retain_time_flag is set, just like is done in copyin_device(), and
additionally adding the AT_SYMLINK_NOFOLLOW flag to the utimensat() call
in fdutimens(), which does the right thing for symlinks and does not
change the behavior for non-symlinks.

Here is a patch of what I used to get it working:

        https://github.com/edquist/cpio/commit/c2ccb84d5e.patch

(Patch text also pasted below.)

Would you maintainers consider applying this enhancement/fix?

Thanks..!
Carl

Patch is also proposed here:
https://www.mail-archive.com/address@hidden/msg00605.html

Pavel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]