-
Notifications
You must be signed in to change notification settings - Fork 25
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
Default to an archive with same name as the target directory #55
Comments
In case your command does not match the expected syntax, you will get the usage as output.
I chose not to display the help for the individual command because, often, it is very long
I don't normally use lrztar, I'll take a closer look tomorrow |
It would be nice if zpaqfranz played nicely with lrztar, which many other formats do (including zpaq, although zpipe doesn't currently work correctly on the M2 processor making lrztar with standard zpaq currently unusable). zpaqfranz does support stdin and even ordered archiving (for -stdout)
|
I am not really sure
if ./pippero folder does exists => if ./pippero.zpaq does NOT exists => archive ./pippero folder inside ./pippero.zpaq |
Here's what's in my head. I wrote it in Ruby since that's what I know best; treat it as pseudo-code if you prefer. file_or_dir_arg = "pippero"
if File.exist? "#{file_or_dir_arg}.zpaq"
warn("file or folder already exists: use '--force' to overwrite it")
exit 2
else
output_archive = "#{file_or_dir_arg}.zpaq"
end
if File.directory? file_or_dir_arg
recursion = true
end You can always do this in a way that lets people override the default behaviors with flags, like: File.exist?("#{file_or_dir_arg}.zpaq") && ARGV.include?("--force") or some such so that explicit CLI flags always take precedence over the default convention-over-configuration. If you have a lot of these, I'd probably do some of this during argument parsing or build a case statement, but that's an implementation detail. Overall, though, I think it would help with making the application easier to use, but (to be entirely fair) there are plenty of applications that force users to specify both an input and an output file. I also realize (after more time and experimentation with your application) that zpaqfranz is intended more for backups than for a ZPAQ drop-in replacement, so if this doesn't fit your design goals I'll understand. I just tend to think about usability issues, which may not be a priority here. If you can point me to the right sections, I'd also be willing to help fix the typos and update the wiki. I don't program in C++, so I can't help directly with the code, but I'm always happy to help with documentation! |
Every single help is highly appreciated, and my documentation support is modest, to say the least |
Coming back to the question, if I understand right, when you do something like zpaqfranz a pippero this should happen
Do you agree? |
@fcorbelli Almost right. See comments and examples below for a (hopefully) clearer set of examples. With Current Command-Line Signature and No Output-File FlagAssuming this only works when naming a single target file or directory (which it almost has to currently since the target
Deciding Whether to Delay Errors or Abort ImmediatelyWith an Output-File FlagHowever, if there were a flag for naming the zpaq archive and all non-arguments were just files or directories to compress, then you might want to think about whether it makes sense to error immediately before spending a lot of time compressing things if only some of them are missing, or whether (like tar) you want to delay any ENOENT or other errors until after the rest of the archiving is done. For example, if we imagine a # Add pippero1 and pippero2 to foo.zpaq; if pippero1 is missing, report that later
# and compress pippero2 anyway. The user could then call `zpaqfranz a` to add
# the missing/misspelled/incorrect file to foo.zpaq later.
$ zpaqfranz a pippero1 pippero2 -o foo.zpaq # Add pippero1 and pippero2 to foo.zpaq, which "magically" gets the .zpaq extension
# if it's not already present in the string passed to the `-o` output flag. For example,
# in Ruby:
#
# extension = ".zpaq"
# output_file+=extension unless output_file.end_with? extension
#
$ zpaqfranz a pippero1 pippero2 -o foo then you can either error right away if any files are missing and avoid spending time compressing an incomplete archive, or you could delay errors and compress what you can and add any additional files afterwards. Delaying errors prevents a race condition if files/directories are moved, deleted, or renamed after zpaqfranz starts running (which can happen during a large backup, for example, on a read-write filesystem) but that's true now anyway unless zpaqfranz already handles that use case somehow. So, if you're not delaying errors, you could error out at any time. When Streaming to Standard Output, Redirections, or PipesWhat to do when the output is standard output or file redirection is less clear-cut. You have the same choices, but sending incomplete data down a long-running pipe or stream might not make a lot of sense, such as trying to stream zpaq-compressed data from stdout to It's kind of a separate question that isn't directly related to the issue I originally raised, but answering your question made me wonder what the optimal behavior for streams with missing compression targets would be from a user's perspective. I'm not 100% sure what's correct, or how it works today, but the slowness of zpaq makes this a bigger issue for zpaqfranz than it does for lzo or gzip. |
It seems a very rare situation, the purpose of which (saving the indication of the name of the folder to be added) is not essential.
I'm not in favor, because the file naming style is Windows (native), not *nix. So I don't think I will implement such a radical change, the risk of breaking every single script made for zpaq is too high
The (intended) behavior of zpaq and zpaqfranz is to compress everything possible, without being blocked, for example, by a badly indicated folder. This is critical for backup scripts
The above applies. The backup must be completed, in every possible case, even if the files change during the copy.
When you want to verify this type of case (double-check), there is the appropriate v (verify) command which with the -ssd switch (for solid state drives) operates at speeds comparable to the maximum possible for a certain HW
In this real-world example @ more than 10GB/s
With regards to slowness, it is the opposite.When used as a backup, there is simply no comparison (in favor of zpaq) to gzip, lzo, 7z or whatever, by several orders of magnitude in the typical case, which is to update a backup (i.e. add only the changed data) every X time Regarding stdin-stdoutzpaq just doesn't support it, period I had to work a lot to get this result (at the price of a significant reduction in the space saved), retaining zpaq-versioned file with monotonic-ordered-based-archived data Usage is absolutely NOT thought just in a "normal" pipe chain, *nix style Here the main "scenarios" stdin side
The stdoutcomplements for zfs send, to perform zfs receive without having to extract the whole archive, as needed with versioned zpaqs, or direct restoring of mysql's dumps |
@fcorbelli I appreciate your detailed answer above. It seems like zpaqfranz is designed for a different use case than what I had expected, and your answers definitely make sense within that context. I appreciate you taking the time to explain the various reasons. While I'd still like to see automatic extensions, I agree that it's not absolutely essential. It's mostly a user convenience for those of us who might be using it for use cases other than which it was originally designed. So, I'd still love it if you'd implement that piece of it in future, but you can close the issue for now if you like since my questions were resolved in the sense that they're largely out of scope for the intended use cases. |
I am working on a brand-new mode (the fasttxt), I'll embed some changes too
if file "./foo" or folder "./foo" does esists, create or update "./foo.zpaq" with the "./foo" |
Expected Behavior
I intuitively expect that when passed a directory named
foo
that zpaqfranz would create afoo.zpaq
archive using the name of the directory as a default. For example:Actual Behavior
This is likely because it's not obvious what a default output archive should be named, but
zpaqfranz a foo
just prints the usage information. Instead, I have to specify both the directories and files after naming an archive, like so:This is in contrast to tools like lrztar which will do the "sensible thing" and simply create a sensibly-named archive unless one already exists in which case I need to specify the
-f
flag to force an overwrite, or the-o
flag to specify the output file.Side Note
It would be nice if zpaqfranz played nicely with lrztar, which many other formats do (including zpaq, although zpipe doesn't currently work correctly on the M2 processor making lrztar with standard zpaq currently unusable).
The text was updated successfully, but these errors were encountered: