aboutsummaryrefslogtreecommitdiff
path: root/bin/ln
Commit message (Collapse)AuthorAgeFilesLines
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* DIRDEPS_BUILD: Connect new directories.Bryan Drewery2017-10-311-0/+11
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325187
* Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper2017-08-021-0/+1
| | | | | | | | | `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
* Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper2017-08-021-3/+1
| | | | | | | | | | | | | | directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks Notes: svn path=/head/; revision=321912
* Don't expect :sF_flag to fail anymoreEnji Cooper2017-06-201-1/+1
| | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=320173
* ln(1): fix -F behaviorEnji Cooper2017-06-201-3/+3
| | | | | | | | | | | | | | | | | | | | | When '-F' option is used, the target directory needs to be unlinked. Currently, the modified target ("target/source") is being unlinked, and since it doesn't yet exist, the original target isn't removed. This is fixed by skipping the block where target is modified to "target/source" when '-F' option is set. Hence, a symbolic link (with the same name as of the original target) to the source_file is produced. Update the test for ln(1) to reflect fix for option '-F' MFC after: 1 month PR: 219943 Differential Revision: D11167 Submitted by: shivansh Sponsored by: Google (GSoC 2017) Notes: svn path=/head/; revision=320172
* Style fixes: clean up leading whitespace (8 single column spaces -> \t)Enji Cooper2017-06-121-101/+101
| | | | | | | | MFC after: 1 month MFC with: r319714, r319854, r319855, r319856 Notes: svn path=/head/; revision=319858
* ln(1): wordsmith -F option descriptionEnji Cooper2017-06-121-3/+7
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=319857
* Add a testcase for `ln -sF`Enji Cooper2017-06-121-0/+17
| | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=319856
* Use readlink(1)/stat(1) to query symlinks instead of file(1)Enji Cooper2017-06-121-7/+14
| | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=319855
* bin/ln: Set umask appropriately before creating files for testingAlan Somers2017-06-121-0/+3
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=319854
* Add tests for ln(1)Alan Somers2017-06-083-0/+228
| | | | | | | | | | | | | | | | | | | | | | | | | * 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 Notes: svn path=/head/; revision=319714
* Renumber copyright clause 4Warner Losh2017-02-283-3/+3
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Explicitly add unmarked bin/ binaries to the runtime package.Glen Barber2016-02-091-0/+1
| | | | | | | | | | | Note: tcsh(1) has a MK_TCSH=no test, so this should be a separate package, which requires pre-install/post-install scripts, to be added later. Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295439
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-271-11/+12
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * Merge from headSimon J. Gerraty2013-09-051-4/+4
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=255263
| * | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | Sync with HEAD.David E. O'Brien2013-02-081-1/+1
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246555
| * \ \ Sync from headSimon J. Gerraty2012-11-041-1/+65
| |\ \ \ | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=242545
| * | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | | | symlink(7): Mention chflagsat() (can take AT_SYMLINK_NOFOLLOW).Jilles Tjoelker2015-02-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=278848
* | | | | Add futimens and utimensat system calls.Jilles Tjoelker2015-01-231-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The core kernel part is patch file utimes.2008.4.diff from pluknet@FreeBSD.org. I updated the code for API changes, added the manual page and added compatibility code for old kernels. There is also audit and Capsicum support. A new UTIME_* constant might allow setting birthtimes in future. Differential Revision: https://reviews.freebsd.org/D1426 Submitted by: pluknet (partially) Reviewed by: delphij, pluknet, rwatson Relnotes: yes Notes: svn path=/head/; revision=277610
* | | | | symlink(7): Note that stat(1) does not follow symlinks by default.Jilles Tjoelker2014-12-291-9/+8
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=276359
* | | | Add 'static' where able.Eitan Adler2013-06-021-4/+4
| |_|/ |/| | | | | | | | Notes: svn path=/head/; revision=251261
* | | Fix wording nit.Glen Barber2012-12-281-1/+1
| |/ |/| | | | | | | | | | | | | | | PR: 174787 Submitted by: Cody Rank MFC after: 3 days Notes: svn path=/head/; revision=244791
* | Add a couple of examples.Joel Dahl2012-11-021-1/+65
|/ | | | | | | Obtained from: OpenBSD Notes: svn path=/head/; revision=242499
* Put some static keywords in the source code.Ed Schouten2011-10-311-9/+9
| | | | | | | | | For these simple utilities, it doesn't harm to make all global variables static. In fact, this allows the compiler to perform better forms of optimisation and analysis. Notes: svn path=/head/; revision=226961
* bin: Prefer strrchr() to rindex().Jilles Tjoelker2011-03-151-1/+1
| | | | | | | This removes the last index/rindex usage from /bin. Notes: svn path=/head/; revision=219680
* Spelling fixes.Joel Dahl2010-07-311-1/+1
| | | | Notes: svn path=/head/; revision=210702
* symlink(7): Add lpathconf(2) and *at system calls.Jilles Tjoelker2010-04-251-2/+27
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=207189
* symlink(7): The ownership of symlinks is used by the system,Jilles Tjoelker2010-04-251-3/+3
| | | | | | | | | | | | in at least three ways, so do not say it is ignored: * who may delete/rename a symlink in a sticky directory * who may do lchflags(2)/lchown(2)/lchmod(2) * whose inode quota is charged MFC after: 1 week Notes: svn path=/head/; revision=207188
* ln: Allow a trailing slash when creating a link to a directory.Jilles Tjoelker2010-04-211-14/+13
| | | | | | | | | | | | | | | | | | | | | | | In the 'ln source... directory' synopsis, the basename of each source determines the name of the created link. Determine this using basename(3) instead of strrchr(..., '/') which is incorrect if the pathname ends in a slash. The patch is somewhat changed to allow for basename(3) implementations that change the passed pathname, and to fix the -w option's checking also. The code to compare directory entries only applies to hard links, which cannot be created to directories using ln. Example: ln -s /etc/defaults/ /tmp This should create a symlink named defaults. PR: 121568 Submitted by: Ighighi MFC after: 1 week Notes: svn path=/head/; revision=207021
* ln: Refuse deleting a directory entry by hardlinking it to itself.Jilles Tjoelker2010-04-171-2/+59
| | | | | | | | | | | | | | | | | Two pathnames refer to the same directory entry iff the directories match and the final components' names match. Example: (assuming file1 is an existing file) ln -f file1 file1 This now fails while leaving file1 intact. It used to delete file1 and then complain it cannot be linked because it is gone. With -i, this error is detected before the question is asked. MFC after: 2 weeks Notes: svn path=/head/; revision=206773
* Allow creating hard links to symlinks using ln(1).Jilles Tjoelker2009-07-192-22/+41
| | | | | | | | | | | This implements the POSIX.1-2008 -L and -P flags. The default remains to create hard links to the target of symlinks. Approved by: re (kib), ed (mentor) Notes: svn path=/head/; revision=195768
* Clean up a bit of confusing language and improve .Nd.Tom Rhodes2009-01-131-4/+9
| | | | | | | | PR: 47818 Reviewed by: keramida Notes: svn path=/head/; revision=187148
* Unbreak last commit to ln for amd64.Giorgos Keramidas2008-06-071-1/+1
| | | | | | | | | | | Cast string precision to `int'. amd64 systems warn about the field precision being `long int' if we don't, and pathnames are normally short enough to fit in an `int'. Noticed by: pav Notes: svn path=/head/; revision=179636
* Add a -w warning flag to ln(1). When the -w option is enabled,Giorgos Keramidas2008-06-062-7/+47
| | | | | | | | | | | | | | ln(1) checks to see if the source of a symlink, i.e. the file it should point to actually exists. The default is the old ln behavior, that does not check, to avoid surprising people who may be using ln(1) in scripts or other non-interactive places. PR: bin/7265 Submitted by: Joel Ray Holveck, detlev!joelh at mail.camalott.com MFC after: 2 weeks Notes: svn path=/head/; revision=179603
* Express in the usage() and SYNOPSIS that -F depends on -s, andRuslan Ermilov2007-11-172-4/+8
| | | | | | | that -f and -i are exclusive. Notes: svn path=/head/; revision=173702
* Swap "source"/"target" where appropriate, to match documentation.Ruslan Ermilov2007-11-171-38/+38
| | | | Notes: svn path=/head/; revision=173701
* Add '-F' option which allows to delete existing empty directories, whenGleb Smirnoff2006-02-142-8/+50
| | | | | | | | | | creating symbolic links. PR: bin/92149 Submitted by: Eugene Grosbein <eugen grosbein.pp.ru> Notes: svn path=/head/; revision=155667
* Expand *n't contractions.Ruslan Ermilov2005-02-131-1/+1
| | | | Notes: svn path=/head/; revision=141846
* Sync program's usage() with manpage's SYNOPSIS.Ruslan Ermilov2005-02-091-3/+3
| | | | Notes: svn path=/head/; revision=141578
* Add the new standard EXIT STATUS section where appropriate.Ruslan Ermilov2005-01-161-7/+7
| | | | | | | Sort standard sections in the (documented) preferred order. Notes: svn path=/head/; revision=140353
* /*- or .\"- or #- to begin license clauses.Warner Losh2005-01-103-1/+3
| | | | Notes: svn path=/head/; revision=139969