1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

ln: reject --relative without --symbolic

This commit is contained in:
Michael Debertol 2021-06-02 21:02:12 +02:00
parent 87570bbc10
commit ed69d797b5
2 changed files with 7 additions and 15 deletions

View file

@ -184,7 +184,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
Arg::with_name(OPT_RELATIVE)
.short("r")
.long(OPT_RELATIVE)
.help("create symbolic links relative to link location"),
.help("create symbolic links relative to link location")
.requires(OPT_SYMBOLIC),
)
.arg(
Arg::with_name(OPT_VERBOSE)

View file

@ -428,20 +428,6 @@ fn test_symlink_relative() {
assert_eq!(at.resolve_link(link), file_a);
}
#[test]
fn test_hardlink_relative() {
let (at, mut ucmd) = at_and_ucmd!();
let file_a = "test_hardlink_relative_a";
let link = "test_hardlink_relative_link";
at.touch(file_a);
// relative hardlink
ucmd.args(&["-r", "-v", file_a, link])
.succeeds()
.stdout_only(format!("'{}' -> '{}'\n", link, file_a));
}
#[test]
fn test_symlink_relative_path() {
let (at, mut ucmd) = at_and_ucmd!();
@ -571,3 +557,8 @@ fn test_symlink_no_deref_file() {
assert!(at.is_symlink(link));
assert_eq!(at.resolve_link(link), file1);
}
#[test]
fn test_relative_requires_symbolic() {
new_ucmd!().args(&["-r", "foo", "bar"]).fails();
}