Commit graph

11 commits

Author SHA1 Message Date
Dag-Erling Smørgrav bee7cf9e97 ln: Improve link(1) variant of ln(1).
* Give link(1) its own usage message.
* Use getprogname(3) instead of rolling our own.
* Verify that the target file does not already exist.
* Add tests specific to link(1).

MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44635
2024-04-04 16:14:50 +02:00
Dag-Erling Smørgrav 2ae8d34666 ln: Add a test case for ln -sfF.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude, asomers
Differential Revision:	https://reviews.freebsd.org/D44513
2024-03-27 11:03:56 +01:00
Dag-Erling Smørgrav e0afcbc856 ln: Clean up and simplify tests.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44512
2024-03-27 11:03:52 +01:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Bryan Drewery 3806950135 DIRDEPS_BUILD: Connect new directories.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:04:07 +00:00
Enji Cooper 00bc472686 Don't expect :sF_flag to fail anymore
While here, also add a check to verify that the link target
is updated in the testcase

MFC after:	1 month
MFC with:	r320172
PR:		219943
Differential Revision:	D11167
Submitted by:	shivansh
Sponsored by:	Google (GSoC 2017)
2017-06-20 20:50:54 +00:00
Enji Cooper 0773ff183a Style fixes: clean up leading whitespace (8 single column spaces -> \t)
MFC after:	1 month
MFC with:	r319714, r319854, r319855, r319856
2017-06-12 16:53:42 +00:00
Enji Cooper ed66391a6e Add a testcase for ln -sF
The testcase fails today, so mark it with atf_expect_fail: in
particular, the target (B) isn't being unlinked and the documentation
doesn't suggest special handling for directories. Thus, there's either
a doc or an implementation bug in ln(1) that needs to be resolved.

MFC after:	1 month
MFC with:	r319714, r319854, r319855
PR:		219943
Reviewed by:	ngie
Submitted by:	shivansh
Differential Revision:	D11159 (part of a larger diff)
Sponsored by:	Google, Inc (GSoC 2017)
2017-06-12 16:38:37 +00:00
Enji Cooper 07b984360c Use readlink(1)/stat(1) to query symlinks instead of file(1)
file(1) can be compiled out of the system via MK_FILE == no, and the
output isn't guaranteed to be stable. It's better to use stat(1)/readlink(1)
instead to query symlink/file paths.

MFC after:	1 month
MFC with:	r319714, r319854
Reported by:	ngie
Submitted by:	shivansh
Differential Revision:	D11159 (part of a larger diff)
Sponsored by:	Google, Inc (GSoC 2017)
2017-06-12 16:31:32 +00:00
Alan Somers e61b0afc1c bin/ln: Set umask appropriately before creating files for testing
These changes were missed in D11084

Submitted by:	shivansh
Reviewed by:	asomers
MFC after:	1 month
X-MFC-With:	319714
Sponsored by:	Google, Inc (GSoC 2017)
Differential Revision:	https://reviews.freebsd.org/D11158
2017-06-12 14:54:59 +00:00
Alan Somers 670f178299 Add tests for ln(1)
* Verify that when creating a hard link to a symbolic link, '-L' option
  creates a hard link to the target of the symbolic link
* Verify that when creating a hard link to a symbolic link, '-P' option
  creates a hard link to the symbolic link itself
* Verify that if the target file already exists, '-f' option unlinks it so
  that link may occur
* Verify that if the target file or directory is a symbolic link, '-shf'
  option prevents following the link
* Verify that if the target file or directory is a symbolic link, '-snf'
  option prevents following the link
* Verify that '-s' option creates a symbolic link
* Verify that '-w' option produces a warning if the source of a symbolic
  link does not currently exist

Submitted by:	shivansh
Reviewed by:	asomers, ngie
MFC after:	1 month
Sponsored by:	Google, Inc (GSoC 2017)
Differential Revision:	https://reviews.freebsd.org/D11084
2017-06-08 19:09:55 +00:00