From nobody Mon Jan 24 18:30:03 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 065E81977D87; Mon, 24 Jan 2022 18:30:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JjJSD1yKbz4nWr; Mon, 24 Jan 2022 18:30:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643049004; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aq1a0K8+kFTVMJ/OAy2OhzI/GCkKQ9I+OR6Rz/R8C/M=; b=EUBhGnRkHHZi/rc3UbxbtBhJ6c4GTfgrlusgoV1mviepIPabufxkHCDZRHgWbjit93hw8n bmnpgAqHYaymlQprW0vd608D0NijyqkU7CN3v14dbWJ+Km5JqtsXGbeHQMMDhh9cQrsiCF d/JIjoWJ4kv0jl/8RE+2Ai2wtBvNa1MwzTX56ASV8qVUkcjZBXksG9WgTemw6xv9GxuURj uxJ5cyYC8nCnUAx2jAk939moorRo78hGjztsY+bA+wFg2TW6MqXOnuy2DVAtL9VAg0Z8dU hz58jm0CEkUsBoAd6G2luPKCcXWL9XCaLTkm7mBHyM8p8amn43NMpcZLvSkceg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CFA31AE22; Mon, 24 Jan 2022 18:30:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20OIU3LU070752; Mon, 24 Jan 2022 18:30:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20OIU3FF070749; Mon, 24 Jan 2022 18:30:03 GMT (envelope-from git) Date: Mon, 24 Jan 2022 18:30:03 GMT Message-Id: <202201241830.20OIU3FF070749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wolfram Schneider Subject: git: 829afcb5d301 - main - refactor script List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wosch X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 829afcb5d30140cfb721de820449f61f8054d203 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643049004; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aq1a0K8+kFTVMJ/OAy2OhzI/GCkKQ9I+OR6Rz/R8C/M=; b=JKJROM4ehuj62t389yO7+jz/f3ecevI5RUvEdAYnszgifHATNctLVck0iwZklqelkhT/pr y7Ss/9ABSukr8kpPiEKrXbWwUBfLL+Y5KuhopWABUJDTy70keua9cI6O5YSwOIz4S/OTmp SzvO3UiGIDrOka7KViHYAyk9ikuw5e2aF8xuw8xh4eBEsfKyR7BEtzbPxjGPspVuTzwMS3 1dDx49ti2wWIMd9K9Miu/jod2G32NXBeySp52lfrHwPnzBWMEj7SgMr4SAWR41TYsByFde QRmJ0Qo+iUABGMNKQOVPmOpKQ1JvI0r3QPStL4EKZ7bp2TUBwB4CGyiSewrtow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643049004; a=rsa-sha256; cv=none; b=xyZ0FJlfXdsvNxsg1mYLUKFZ0kcMWDHQzYc8fF+xu1Iur2e6CVKnQZHyQKTiAKnlkOJGtt epp1LM6GdaHNfS4K42YkMla980XIJusbNWg1pUSqgEO+Imq2qfH9UEMJdWml/5hSzwEyGs V09+7s6Jj12qBy7nQxifjwEU3zpmF2ISJHKyCcVJW0hMn8X0IUXKKZfh5EkKxwzpwNJ1gm MczvI4pVeeYJP7w8HTULCZo4C5uKjjke09Oww6rPJGtWkRybnnQVnasGRDVSCtIZwPybF2 VlZuil2hL6XLhAxhlAsWzKqkE94C+HYC5QTBW5Led0LUry35Puzy23wckVTpXg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=829afcb5d30140cfb721de820449f61f8054d203 commit 829afcb5d30140cfb721de820449f61f8054d203 Author: Wolfram Schneider AuthorDate: 2022-01-24 18:23:59 +0000 Commit: Wolfram Schneider CommitDate: 2022-01-24 18:28:30 +0000 refactor script - simpler usage of mktemp(1) - remove unnecessary checks - documentation --- usr.bin/locate/locate/concatdb.sh | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/usr.bin/locate/locate/concatdb.sh b/usr.bin/locate/locate/concatdb.sh index d9832cfbef5a..a1afd3e71109 100644 --- a/usr.bin/locate/locate/concatdb.sh +++ b/usr.bin/locate/locate/concatdb.sh @@ -30,7 +30,7 @@ # # usage: concatdb database1 ... databaseN > newdb # -# Sequence of databases is important. +# Please note: the sequence of databases is important. # # $FreeBSD$ @@ -42,11 +42,7 @@ set -o pipefail : ${LIBEXECDIR:=/usr/libexec}; export LIBEXECDIR PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH - -umask 077 # protect temp files - : ${TMPDIR:=/var/tmp}; export TMPDIR; -test -d "$TMPDIR" || TMPDIR=/var/tmp # utilities to built locate database : ${bigram:=locate.bigram} @@ -54,15 +50,12 @@ test -d "$TMPDIR" || TMPDIR=/var/tmp : ${sort:=sort} : ${locate:=locate} +if [ $# -lt 2 ]; then + echo 'usage: concatdb databases1 ... databaseN > newdb' + exit 1 +fi -case $# in - [01]) echo 'usage: concatdb databases1 ... databaseN > newdb' - exit 1 - ;; -esac - - -bigrams=`mktemp ${TMPDIR=/tmp}/_bigrams.XXXXXXXXXX` || exit 1 +bigrams=$(mktemp -t bigrams) trap 'rm -f $bigrams' 0 1 2 3 5 10 15 for db @@ -75,3 +68,5 @@ for db do $locate -d $db / done | $code $bigrams + +#EOF