From owner-svn-src-stable-11@freebsd.org Mon Jul 17 21:11:22 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAC23DA1088; Mon, 17 Jul 2017 21:11:22 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 872E9722FD; Mon, 17 Jul 2017 21:11:22 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6HLBLoY057578; Mon, 17 Jul 2017 21:11:21 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6HLBLfj057575; Mon, 17 Jul 2017 21:11:21 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707172111.v6HLBLfj057575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 17 Jul 2017 21:11:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321092 - in stable/11/bin/ln: . tests X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/11/bin/ln: . tests X-SVN-Commit-Revision: 321092 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jul 2017 21:11:22 -0000 Author: ngie Date: Mon Jul 17 21:11:21 2017 New Revision: 321092 URL: https://svnweb.freebsd.org/changeset/base/321092 Log: MFC r320172,r320173: r320172: ln(1): fix -F behavior 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' PR: 219943 r320173: 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 with: r320172 PR: 219943 Modified: stable/11/bin/ln/ln.c stable/11/bin/ln/tests/ln_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/ln/ln.c ============================================================================== --- stable/11/bin/ln/ln.c Mon Jul 17 21:10:08 2017 (r321091) +++ stable/11/bin/ln/ln.c Mon Jul 17 21:11:21 2017 (r321092) @@ -245,11 +245,11 @@ linkit(const char *source, const char *target, int isd /* * If the target is a directory (and not a symlink if hflag), - * append the source's name. + * append the source's name, unless Fflag is set. */ - if (isdir || + if (!Fflag && (isdir || (lstat(target, &sb) == 0 && S_ISDIR(sb.st_mode)) || - (!hflag && stat(target, &sb) == 0 && S_ISDIR(sb.st_mode))) { + (!hflag && stat(target, &sb) == 0 && S_ISDIR(sb.st_mode)))) { if (strlcpy(bbuf, source, sizeof(bbuf)) >= sizeof(bbuf) || (p = basename(bbuf)) == NULL || snprintf(path, sizeof(path), "%s/%s", target, p) >= Modified: stable/11/bin/ln/tests/ln_test.sh ============================================================================== --- stable/11/bin/ln/tests/ln_test.sh Mon Jul 17 21:10:08 2017 (r321091) +++ stable/11/bin/ln/tests/ln_test.sh Mon Jul 17 21:11:21 2017 (r321092) @@ -160,10 +160,10 @@ sF_flag_head() sF_flag_body() { - atf_expect_fail "B isn't being unlinked (bug 219943)" atf_check mkdir A B atf_check ln -sF A B atf_check -o inline:'Symbolic Link\n' stat -f %SHT B + atf_check -o inline:'A\n' readlink B } atf_test_case sf_flag