From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Q7CXZ-00075t-Q6 for mharc-grub-devel@gnu.org; Tue, 05 Apr 2011 16:07:53 -0400 Received: from [140.186.70.92] (port=35873 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7CXX-00075b-DI for grub-devel@gnu.org; Tue, 05 Apr 2011 16:07:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7CXW-0005RJ-Ck for grub-devel@gnu.org; Tue, 05 Apr 2011 16:07:51 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:33222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7CXW-0005Qv-8C for grub-devel@gnu.org; Tue, 05 Apr 2011 16:07:50 -0400 Received: by wyf19 with SMTP id 19so807380wyf.0 for ; Tue, 05 Apr 2011 13:07:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=i2IX8PJBIbEon3Wb3IfsNvxp4eGvtluYBBFLU5jWMaI=; b=gQ5zR4DxdpPFuuMvMapgQG4Zkje971pTiWORKP/Tl6H3zZXbEtQHZcKR5XaB4Xh1s7 ErJIqMQI7+ZaR3tJ8nobz1FkCo7LIu6Tu4FsxdvCqrW64kCXxghSEQzGTvEzgn5LjGJF lreL+51at5fUoly63WKV1Vh8aER6skOelGCB4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=icJ/74lDZXR46Axw+XGV3ut6XAogaYa8SO8yogk/KiHa5SwQTDfIX86Zko0hbCF/qa efRZRSG6WR1zUUaFKV53EnKiTL9i+UGREoCxUv8ueTyNCl8D2i/nkw0dk2/X/Uundkan jbG1keo0RI8UoQhE1ti6l3m2ijhJsPZ/6T7Tg= Received: by 10.227.42.143 with SMTP id s15mr82347wbe.143.1302034069278; Tue, 05 Apr 2011 13:07:49 -0700 (PDT) Received: from [192.168.0.101] (eab95-4-88-175-177-37.fbx.proxad.net [88.175.177.37]) by mx.google.com with ESMTPS id y29sm3781910wbd.38.2011.04.05.13.07.47 (version=SSLv3 cipher=OTHER); Tue, 05 Apr 2011 13:07:48 -0700 (PDT) Message-ID: <4D9B7692.2020309@gmail.com> Date: Tue, 05 Apr 2011 22:07:46 +0200 From: =?UTF-8?B?Tmljb2xhcyBkZSBQZXNsb8O8YW4=?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110303 Icedove/3.0.11 MIME-Version: 1.0 To: Alexander Kurtz References: <1302008107.14852.20.camel@alexander> <4D9B6A7D.4090306@gmail.com> <1302031960.30533.7.camel@localhost> In-Reply-To: <1302031960.30533.7.camel@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.169 Cc: The development of GNU GRUB Subject: Re: [PATCH] add proper variable quoting to grub-mkconfig_lib (Debian bug #612417) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2011 20:07:52 -0000 Le 05/04/2011 21:32, Alexander Kurtz a écrit : > Am Dienstag, den 05.04.2011, 21:16 +0200 schrieb Nicolas de Pesloüan: >> Why do you use construct like "${x}" instead of "$x"? > > Because code isn't written once and then stays untouched forever. It > changes over time and may be used in situations you did not anticipate. > Writing solid code (and in shell scripts that definitely includes > quoting your variables) avoids unnecessary bugs like this one. > > I've just seen too many poorly written shell scripts with hidden > (sometimes even security-relevant) bugs to not do things properly. > > And it looks cleaner ;-) > > Best regards > > Alexander Kurtz As Colin says, the {} construct is mostly useless and at least does not contribute to quoting. On the same kind of things, the construct if test "x$foo" = "x" is pointless. It is a very strange heritage from DOS, where IF x%A = x was a common construct, because DOS (command.com) lack quoting. (Is wasn't possible to write IF "%a" = ""). In shell, "" is an empty string, but a real argument to commands. The following construct is the good one : if test "$foo" = "". The test command will receive three arguments: the value of $foo, the = sign and an empty argument and will return true if $foo happens to be empty. Writing solid code imply - in particular - knowing the exact behaviors of the programming language :-) I agree of course that this is definitely cosmetic, and this doesn't means that your work to remove unquoted variable is not good and necessary. Nicolas.