with "path" argument being absolute path of a named pipe,
and "name" argument being valid relative path,
tar returns an error which doesn't seem to make any sense.
Reproduction
Checked on Linux, probably could be reproduced in a similar way on other Unix systems.
Setup
cargo new append_path_pipe_error
cd append_path_pipe_error
cargo add tar
mkfifo pipe
touch file
main.rs:
fn main() {
let mut tar = tar::Builder::new(vec![]);
let base_path = std::env::current_dir().unwrap();
let mut append = move |name| {
tar.append_path_with_name(base_path.join(name), name)
.expect(name);
};
append("file"); // works
append("pipe"); // breaks
}
cargo run
Expected
Either one of two:
Code returns an error saying something about named pipes (or file types in general, like it does when archiving named pipes on non-Unix).
Code completes successfully.
Actual
Code returns the following error:
Custom { kind: Other, error: "paths in archives must be relative when setting path for " }
...which doesn't show the problematic path (it's empty when the error is generated) and names the problem that, from consumer's point of view, shouldn't arise at all (the in-archive path is relative, after all).
Possible reason
A little code-digging led me to this block, which calls append_special using only the source path, but ignoring the target one (i.e. name). I'm not sure whether this reasoning is correct and what could break if we simply replace path with name (hence an issue and not PR), but will be happy to help in testing if this is indeed the problem.
Summary
When:
append_path_with_name
,tar
returns an error which doesn't seem to make any sense.Reproduction
Checked on Linux, probably could be reproduced in a similar way on other Unix systems.
Setup
main.rs:
Expected
Either one of two:
Actual
Code returns the following error:
...which doesn't show the problematic path (it's empty when the error is generated) and names the problem that, from consumer's point of view, shouldn't arise at all (the in-archive path is relative, after all).
Possible reason
A little code-digging led me to this block, which calls
append_special
using only the source path, but ignoring the target one (i.e.name
). I'm not sure whether this reasoning is correct and what could break if we simply replacepath
withname
(hence an issue and not PR), but will be happy to help in testing if this is indeed the problem.