Closed GoogleCodeExporter closed 9 years ago
Are you sure about the HAVE_STRUCT_STAT_ST_BIRTHTIME fragment? It looks like the
second call to utimensat is redundant?
Please keep patches specific to the issue at hand.
Original comment by joerg.sonnenberger@googlemail.com
on 25 Mar 2010 at 7:28
I have deleted from the patch given above the warning message that did not
belong to this issue and I have
attached the new patch here.
Regarding the HAVE_STRUCT_STAT_ST_BIRTHTIME case, I have just copied the code
from the
HAVE_UTIMES case, replacing utimes with utimensat.
I have no idea what this birthtime means and why on such systems utimes is
called twice. Whoever wrote
that code should know the reason.
I assume that this birthtime applies to some file systems that maintain a file
creation time, and that there
exists some operating system that uses this non-standard means to set it.
Whoever wrote that code should
have commented it better.
Anyway, the HAVE_STRUCT_STAT_ST_BIRTHTIME case is not used on Linux, so I
cannot test it. Like I said in
my first post, I do not know if there exists any OS where both
HAVE_STRUCT_STAT_ST_BIRTHTIME and
HAVE_UTIMENSAT are true, so that part of the code might be never used.
Original comment by a.bocani...@computer.org
on 25 Mar 2010 at 8:16
Attachments:
Tim, you did the original change in r212. Please double check the intention of
the
original fragment and apply the patch.
Original comment by joerg.sonnenberger@googlemail.com
on 25 Mar 2010 at 8:41
joerg.sonnenberger wrote:
> Are you sure about the HAVE_STRUCT_STAT_ST_BIRTHTIME fragment?
> It looks like the second call to utimensat is redundant?
According to FreeBSD's utimes(2) manpage:
"For file systems that support file birth (creation) times (such as UFS2), the
birth time will be set to the value of the second element if the second element
is older than the currently set birth time. To set both a birth time and a
modification time, two calls are required; the first to set the birth time and
the second to set the (presumably newer) modification time. ..."
I do not know if this behavior has been reproduced in utimensat, if this system
call was introduced in newer
versions of FreeBSD, because I am still a happy user of "FreeBSD 4.11-STABLE"
(six years of uptime without
a minute of downtime) :-)
Original comment by a.bocani...@computer.org
on 25 Mar 2010 at 9:40
OK, please add a proper comment about that then.
Original comment by joerg.sonnenberger@googlemail.com
on 25 Mar 2010 at 9:56
I have looked at the man pages on the FreeBSD site and utimensat appears
neither in FreeBSD 8 nor in
FreeBSD 9.
Therefore the lines belonging to the HAVE_STRUCT_STAT_ST_BIRTHTIME case will
never be compiled yet.
When the FreeBSD developers will introduce utimensat, it will be logical to
make it behave exactly like
utimes does now. In that case the code from the patch will be correct.
The alternative is that suggested in the FreeBSD utimes(2) man page: "Ideally a
new system call
will be added that allows the setting of all three times at once."
If this will happen (not very likely), the existing code will have to be
modified to use the new system call.
I have modified the patch by adding a comment containing these facts and I have
attached it here.
Original comment by a.bocani...@computer.org
on 25 Mar 2010 at 10:29
Attachments:
Since the version 5.0, NetBSD has adopted the birthtime feature from FreeBSD,
so this is the second
operating system for which HAVE_STRUCT_STAT_ST_BIRTHTIME is true. OpenBSD &
DragonFlyBSD do not
appear to have adopted the birthday feature.
However, like FreeBSD, NetBSD does not have utimensat and it is unlikely that
they will introduce this
feature before FreeBSD or in an incompatible way.
Therefore, I do not think that is necessary to modify the comment posted above
to also mention the fact that
what is said about FreeBSD is also true for the recent versions of NetBSD.
Original comment by a.bocani...@computer.org
on 25 Mar 2010 at 11:20
OK, I was lazy.
I have modified the patch by extending the comment.
Now the comment really contains all the known facts.
I have attached the new patch.
Original comment by a.bocani...@computer.org
on 26 Mar 2010 at 9:17
Attachments:
I believe that in your web home page, where you list "The libarchive library
features:", you should add a
bullet and mention the fact that, when using the 2001 PAX format, libarchive is
able to store all the
information pertaining to a file, including extended attributes, ACLs and full
timestamps, even when they
have nanosecond resolution.
In my opinion, the ability of making an exact copy of any archived file is even
more important then the other
features that you list there.
GNU tar from the standard distribution lacks this feature. There are patched
versions of GNU tar, e.g.
RedHat, that might be better, but I did not test them and I doubt that they
preserve the full timestamps.
The cpio and pax programs that are available in most distributions are old
programs that do not preserve
extended attributes or timestamps.
star, when given a lot of non-default options, preserves extended attributes &
ACLs, but truncates the
timestamps.
Therefore, bsdtar is the only program that I have found and that is able to
make exact copies of files from
UNIX file systems and you should advertise better this fact.
While the various "dump" programs are able to make exact copies, they are not
suited for most applications
because it is much more likely to need to restore the files on a different hard
disk than the original one.
Original comment by a.bocani...@computer.org
on 26 Mar 2010 at 10:22
Re: timestamp patch
Please try the attached patch. This takes your idea a step further by
refactoring
some of the existing time setting functions. In particular, there is now only
one
place that calls utimensat, only one place that knows about the BSD birthtime
convention, etc. It's a considerably more intrusive patch but I think the
result is
a bit cleaner. Let me know if this works properly for you.
Re: "when using the 2001 PAX format, libarchive is able to store all the
information
pertaining to a file"
Unfortunately, this is not yet universally true, though with the ongoing help
and
support of folks like yourself, we are getting closer. ;-) Probably the most
important omission at the moment is support for NFS4/NTFS ACLs.
Original comment by kientzle@gmail.com
on 4 Apr 2010 at 5:36
Attachments:
I have tried the "dir_tstamp3.patch" and it seems to be all right. Actually I
was also of the same opinion with
you when I saw the duplicated code for setting times that it should be unified
in a single set_time function,
but, because I was not familiar with your code, I preferred in my initial patch
to make minimal changes to
your sources.
However, if you have already cleaned up most of the code, you should finish it
and take the prototype of the
set_time function, including the opening "{", outside the conditional
compilation branches. Likewise, the
closing "}" of the set_time function should be taken outside the conditional
compilation branches.
As it is now, when the function prototype is repeated a large number of times,
it is confusing and it also it
presents an opportunity of errors, if someone would modify by mistake only one
of the copies of the
function prototype.
Best regards !
Original comment by a.bocani...@computer.org
on 11 Apr 2010 at 6:29
Committed to libarchive/trunk as r2231.
Thank you very much for your help working through this problem. I'm quite
pleased
with the final result.
Original comment by kientzle@gmail.com
on 11 Apr 2010 at 7:15
Original issue reported on code.google.com by
a.bocani...@computer.org
on 25 Mar 2010 at 7:21Attachments: