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:
parent
87570bbc10
commit
ed69d797b5
2 changed files with 7 additions and 15 deletions
|
@ -184,7 +184,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
Arg::with_name(OPT_RELATIVE)
|
Arg::with_name(OPT_RELATIVE)
|
||||||
.short("r")
|
.short("r")
|
||||||
.long(OPT_RELATIVE)
|
.long(OPT_RELATIVE)
|
||||||
.help("create symbolic links relative to link location"),
|
.help("create symbolic links relative to link location")
|
||||||
|
.requires(OPT_SYMBOLIC),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(OPT_VERBOSE)
|
Arg::with_name(OPT_VERBOSE)
|
||||||
|
|
|
@ -428,20 +428,6 @@ fn test_symlink_relative() {
|
||||||
assert_eq!(at.resolve_link(link), file_a);
|
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]
|
#[test]
|
||||||
fn test_symlink_relative_path() {
|
fn test_symlink_relative_path() {
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
@ -571,3 +557,8 @@ fn test_symlink_no_deref_file() {
|
||||||
assert!(at.is_symlink(link));
|
assert!(at.is_symlink(link));
|
||||||
assert_eq!(at.resolve_link(link), file1);
|
assert_eq!(at.resolve_link(link), file1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_relative_requires_symbolic() {
|
||||||
|
new_ucmd!().args(&["-r", "foo", "bar"]).fails();
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue