From owner-freebsd-hackers@FreeBSD.ORG Mon May 17 19:11:13 2010 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEDB7106566C for ; Mon, 17 May 2010 19:11:13 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5638A8FC1B for ; Mon, 17 May 2010 19:11:13 +0000 (UTC) Received: by wyf19 with SMTP id 19so471362wyf.13 for ; Mon, 17 May 2010 12:11:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:openpgp:content-type; bh=Hp6qhHhFcb/xBygwW3vfDvSB5dZrkqY+hXcmUJ82mHs=; b=FU/G2m2T+sOF66UfYPf2APcdbXf4eW3SzKtrR/sqt+c4lqku6DyVuVJr46WhaFHufu t5rjF5qTN9EQ7QZQtIFG/8I6GUUsVh6BmN9nh6eeurLSv2ggXZWgq7r9nf780pVAhVWz 37ExJ82XlLMUeOHxpDkOWl1jZ5NOfPlLVeKDU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:openpgp:content-type; b=oUZY1UJBZi/OYuQLe86x8xokbou5D2wS/SnPyoiIms79qPqH5BcD8pLuFulzjWBP86 edp62Bh4IrHPUrfZl4KyWvzp+LZfCSoWy4r6eBW6KUtHOTCiQXFJ0NCb+s7T+q4Bkuef 55OjG1rf9kZDI1PY5u7A+EP08+JrbsKGCRliE= Received: by 10.216.88.21 with SMTP id z21mr534703wee.144.1274123472465; Mon, 17 May 2010 12:11:12 -0700 (PDT) Received: from centel.dataix.local (adsl-99-35-14-184.dsl.klmzmi.sbcglobal.net [99.35.14.184]) by mx.google.com with ESMTPS id e82sm1978168wej.16.2010.05.17.12.11.09 (version=SSLv3 cipher=RC4-MD5); Mon, 17 May 2010 12:11:10 -0700 (PDT) Sender: "J. Hellenthal" Message-ID: <4BF194CB.5060807@dataix.net> Date: Mon, 17 May 2010 15:11:07 -0400 From: jhell User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.9) Gecko/20100515 Thunderbird/3.0.4 MIME-Version: 1.0 To: Eitan Adler References: In-Reply-To: X-Enigmail-Version: 1.0.1 OpenPGP: id=89D8547E Content-Type: multipart/mixed; boundary="------------090009070704060703050008" X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: hackers@freebsd.org Subject: Re: adding "check option to md5(1) [was: md5(1) and cal(1) on -questions] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 May 2010 19:11:14 -0000 This is a multi-part message in MIME format. --------------090009070704060703050008 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 05/12/2010 04:01, Eitan Adler wrote: >> D> 2. Why doesn't md5(1) have a "check" option? Seems to me requiring a >> D> manual inspection is error-prone at best, and makes scripting >> D> unecessarily complicated. > > Would something like the attached patch be good? > It adds a -c option for a string to check against. It prints > "[failed]" if the string does not match the files md5 unless in -q > mode. > It also returns 2 to indicate md5 match failure for use in scripts. > I have reviewed this patch for functionality and my final conclusion is commit it. Though I would like to see the same functionality that the GNU GPL'd version of md5 has with the '-c' option and being able to check every sum that is listed in a file against a file on disk(c), this version brings the availability to doing the checking right from md5 and utils from a script. I have also edited the manual page portion of the patch to include the '[-c string]' option in the SYNOPSIS section of the man pages. This newly generated patch was generated from the root of the source tree. # cd /path/to/src # patch