-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mtree "content based" outputs are surprising when reading tar file from standard in? #786
Comments
I would welcome a pull request that fixed the mtree writer to correctly emit checksums in such cases. I don't think it would be particularly hard to do. It is not possible to generate multiple outputs simultaneously with |
@kientzle -- w.r.t. writing a program that generates multiple outputs, you were right that starting from I'm missing (and I think that I noted that, in spite of specifying them in options (and after checking that I was generally able to specify mtree options) that my mtree output never had I wasn't sure why there wasn't any Then I checked and I don't believe it's in the one that If I tar up a small directory using the system's tar command (OS X 10.10.5, either If I do the same experiment with minitar and (or my program) it does not seem to have the names.
I think that there must be a bit of secret sauce that I'm missing, but walking libarchive's Can you toss me a hint? |
I can make diff --git a/examples/minitar/minitar.c b/examples/minitar/minitar.c
index 81e5e11..e554f77 100644
--- a/examples/minitar/minitar.c
+++ b/examples/minitar/minitar.c
@@ -267,6 +267,7 @@ create(const char *filename, int compress, const char **argv)
errmsg("\n");
exit(1);
}
+ archive_read_disk_set_standard_lookup(disk);
for (;;) {
int needcr = 0; Is that sensible or have I just plastered over the problem? |
This might be a more reasonable change. There doesn't seem to be any point to the earlier call to ...set_standard_lookup and my addition should be ifdef'ed to follow the existing pattern. diff --git a/examples/minitar/minitar.c b/examples/minitar/minitar.c
index 81e5e11..755773a 100644
--- a/examples/minitar/minitar.c
+++ b/examples/minitar/minitar.c
@@ -254,9 +254,6 @@ create(const char *filename, int compress, const char **argv)
archive_write_open_filename(a, filename);
disk = archive_read_disk_new();
-#ifndef NO_LOOKUP
- archive_read_disk_set_standard_lookup(disk);
-#endif
while (*argv != NULL) {
struct archive *disk = archive_read_disk_new();
int r;
@@ -267,6 +264,9 @@ create(const char *filename, int compress, const char **argv)
errmsg("\n");
exit(1);
}
+#ifndef NO_LOOKUP
+ archive_read_disk_set_standard_lookup(disk);
+#endif
for (;;) {
int needcr = 0; |
Yes, you do need to set the uname and gname fields in the archive_entry object if you want uname and gname in the output archive. Because uname and gname lookups can be expensive and sometimes need to be handled via unusual mechanisms, the archive_read_disk engine does not do any uname or gname lookup by default. The libarchive library does provide an optional "standard" uname and gname lookup machinery that uses common POSIX functions and works well for common applications. I'd appreciate a Pull Request with your suggested minitar change. A one-line comment explaining that this enables automatic uname and gname lookups would be nice as well. |
I filed PR #791 that addresses this. |
When I output an mtree file, fields that depend on the actual contents of the file don't to the right thing:
The resulting sha1digest is the result you'd get for an empty file:
The actual bytes are in the tar file, is there some way to use them to produce the mtree output? Would it be a hard feature to add (and/or a welcome pull request?)?
My goal is to have an mtree file that accurately represents the contents of a tar file. My current scheme is to generate an mtree file, generate a tar file, unpack the tar file, generate a new mtree file from the original input specification and diff the new and old files. Alternatively, I can unpack the archive and use the
mtree
command, but I'm working on CentOS and I'm unsure about ongoing support for mtree-port.A related question: is there any way to generate multiple outputs (e.g.
mtree
andtar
) simultaneously?The text was updated successfully, but these errors were encountered: