tahoe-lafs / zfec

zfec -- an efficient, portable erasure coding tool
Other
374 stars 44 forks source link

-d switch doesn't work without -p #2

Open iammer opened 7 years ago

iammer commented 7 years ago

If I run: zfec -d dest_path /path/to/some-file the output files are created in /path/to/ instead of dest_path. However if I run: zfec -d dest_path -p some_prefix /path/to/some_file it works correctly.

Is the path to the source file included as the prefix by default? Is this expected behavior?

warner commented 6 years ago

Testing this now (in 1.5.0), zfec -d dest_path subdir/README.rst fails because the command doesn't create the -d directory automatically (it throws an exception that reads No such file or directory: 'dest_path/README.rst.0_8.fec'). Creating the directory first, it still fails because it tries to use the whole source path as a prefix (No such file or directory: 'dest_path/subdir/README.rst.0_8.fec'). I'm guessing that the behavior you saw was because your dest_path overlapped with some part of your /path/to/some-file.

I think a better behavior would be to use just the basename of the supplied file as the default prefix. So mkdir dest_path; zfec -d dest_path subdir/README.rst should create dest_path/README.rst.0_8.fec / etc.

I'll add a patch with that change.. I'm going to assume that it'll fix this issue, but if not, please feel free to re-open. THanks!

warner commented 6 years ago

Ah, although, zfec subdir/README.rst should probably create the *.fec files in subdir/, not in the current directory. So if we omit -d, we should use the full path of the input file as the prefix, but if we provide -d, we should use its basename.