From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 2 04:38:27 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7E31B16A41F for ; Tue, 2 Aug 2005 04:38:27 +0000 (GMT) (envelope-from diz@linuxpowered.com) Received: from terrence.linuxpowered.com (terrence.linuxpowered.com [70.85.29.100]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2A5CD43D48 for ; Tue, 2 Aug 2005 04:38:27 +0000 (GMT) (envelope-from diz@linuxpowered.com) Received: from localhost (localhost.localdomain [127.0.0.1]) by terrence.linuxpowered.com (Postfix) with ESMTP id 4B45F26427B for ; Mon, 1 Aug 2005 23:37:06 -0500 (CDT) Received: from terrence.linuxpowered.com ([127.0.0.1]) by localhost (terrence.linuxpowered.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05179-02 for ; Mon, 1 Aug 2005 23:37:05 -0500 (CDT) Received: from secure.linuxpowered.com (www.vpisystems.com [70.85.29.100]) by terrence.linuxpowered.com (Postfix) with ESMTP id 039B6264053 for ; Mon, 1 Aug 2005 23:37:05 -0500 (CDT) Received: from 68.95.232.238 (SquirrelMail authenticated user diz@linuxpowered.com); by secure.linuxpowered.com with HTTP; Mon, 1 Aug 2005 23:37:05 -0500 (CDT) Message-ID: <51934.68.95.232.238.1122957425.squirrel@68.95.232.238> Date: Mon, 1 Aug 2005 23:37:05 -0500 (CDT) From: diz@linuxpowered.com To: freebsd-hackers@freebsd.org User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: amavisd-new at phpcult.com Subject: [patch] rc.d/tmp (silly mkdir usage) 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: Tue, 02 Aug 2005 04:38:27 -0000 Howdy hackers, I'm sorry for the previous patch, so here is at least one item that really bugs me that isn't obfuscation. In short, I don't see any reason to fork some process to simply "touch" a file (is a filesystem writable) when built-in shell i/o does this: --- /etc/rc.d/tmp.orig Mon Aug 1 23:20:24 2005 +++ /etc/rc.d/tmp Mon Aug 1 23:22:07 2005 @@ -48,8 +48,8 @@ [Nn][Oo]) ;; *) - if (/bin/mkdir -p /tmp/.diskless 2> /dev/null); then - rmdir /tmp/.diskless + if ( > /tmp/.diskless 2> /dev/null); then + rm /tmp/.diskless else if [ -h /tmp ]; then echo "*** /tmp is a symlink to a non-writable area!" I grep'ed the entire rc.d dir, and found that the same technique is used elsewhere in accounting, and cleanvar. So I feel justified this time, although please review, and thanks for the look. While I understand the need to want a fork program to touch, or otherwise create an inode, I feel forking for such an effort is weird and a bit over-engineered. -Jon