[Bug 651965] New: inconsistent behavior of cpio -m flag with directories
https://bugzilla.novell.com/show_bug.cgi?id=651965 https://bugzilla.novell.com/show_bug.cgi?id=651965#c0 Summary: inconsistent behavior of cpio -m flag with directories Classification: openSUSE Product: openSUSE 11.3 Version: Final Platform: PC OS/Version: openSUSE 11.3 Status: NEW Severity: Normal Priority: P5 - None Component: Other AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: archie@dellroad.org QAContact: qa@suse.de Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 cpio has an -m flag (or --preserve-modification-time). This flag supposedly does not apply to directories (the man page says "Retain previous file modification times when creating files"). There are two issues, one is a bug and the other is a feature request. Feature request: make this flag also apply to directories. It doesn't make sense that it applies to files only. If need be, this can be acomplished with a new flag for backward compatibility (but see next discussion...). Bug: Actually, the behavior of "-m" with respect to directories is inconsistent. It does in fact apply to directories, but only EMPTY directories. It seems obvious to me that what happened is that this flag was originally intended to apply to directories, but the person who implemented it forgot to apply the directory timestamp change in recursion post-order instead of pre-order... this would explain why empty directories actually do get changed. There is an old an unhelpful thread related to this here: http://www.mail-archive.com/bug-coreutils@gnu.org/msg00841.html In any case, I am requesting that what appears to clearly be original intended behavior actually be implemented, i.e., make the -m flag apply to directories in all cases. The current behavior is doubly-inconsistent: first, it makes no sense to apply modification time changes to files but not directories (the '-m' is commonly used when you want to exactly reproduce the prior state, and currently cpio cannot do that because of this bug), and secondly, even this less helpful current behavior is not implemented correctly anyway because of the empty directory inconsistency. Reproducible: Always Steps to Reproduce: #!/bin/sh rm -rf foo foo2 mkdir -p foo/{dir1,dir2} touch foo/dir1/bar ls -l --full-time foo ( cd foo && find . -print0 | cpio -o0 --quiet -H crc ) > ../foo.cpio sleep 3 mkdir foo2 ( cd foo2 && cpio -imd --quiet ) < ../foo.cpio ls -l --full-time foo2 Actual Results: $ sh bug.sh total 8 drwxrwxr-x 2 archie users 4096 2010-11-07 21:56:12.000000000 -0600 dir1 drwxrwxr-x 2 archie users 4096 2010-11-07 21:56:12.000000000 -0600 dir2 total 8 drwxrwxr-x 2 archie users 4096 2010-11-07 21:56:15.000000000 -0600 dir1 drwxrwxr-x 2 archie users 4096 2010-11-07 21:56:12.000000000 -0600 dir2 Expected Results: $ sh bug.sh total 8 drwxrwxr-x 2 archie users 4096 2010-11-07 21:56:12.000000000 -0600 dir1 drwxrwxr-x 2 archie users 4096 2010-11-07 21:56:12.000000000 -0600 dir2 total 8 drwxrwxr-x 2 archie users 4096 2010-11-07 21:56:12.000000000 -0600 dir1 drwxrwxr-x 2 archie users 4096 2010-11-07 21:56:12.000000000 -0600 dir2 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=651965
https://bugzilla.novell.com/show_bug.cgi?id=651965#c1
--- Comment #1 from Archie Cobbs
https://bugzilla.novell.com/show_bug.cgi?id=651965
https://bugzilla.novell.com/show_bug.cgi?id=651965#c
wei wang
https://bugzilla.novell.com/show_bug.cgi?id=651965
https://bugzilla.novell.com/show_bug.cgi?id=651965#c
Petr Uzel
https://bugzilla.novell.com/show_bug.cgi?id=651965
https://bugzilla.novell.com/show_bug.cgi?id=651965#c2
Petr Uzel
https://bugzilla.novell.com/show_bug.cgi?id=651965
https://bugzilla.novell.com/show_bug.cgi?id=651965#c3
Archie Cobbs
https://bugzilla.novell.com/show_bug.cgi?id=651965
https://bugzilla.novell.com/show_bug.cgi?id=651965#c4
--- Comment #4 from Petr Uzel
Hi Petr,
I also agree this should be handled upstream "at the source". I would prefer you do it because they are more likely to not ignore you than me :-)
OK, I will take care of pushing this upstream. However, the probability of being ignored is the same :) Thanks once more! -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=651965
https://bugzilla.novell.com/show_bug.cgi?id=651965#c5
Petr Uzel
https://bugzilla.novell.com/show_bug.cgi?id=651965
https://bugzilla.novell.com/show_bug.cgi?id=651965#c
Petr Uzel
participants (1)
-
bugzilla_noreply@novell.com