X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 87ECCDC0C58 for ; Fri, 22 Aug 2014 21:49:20 +0000 (UTC) Received: by mail-lb0-f173.google.com with SMTP id u10so10043780lbd.4 for ; Fri, 22 Aug 2014 14:49:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=damutVRi5P8oBa/ufcviNJSKq8xu40rHPw5tHyDp4PQ=; b=MNv3pD20yxPmK4xCVH/VLTKrWWslJD6M71xue05ZL0Qyh0DWGstSb/e4xIUs0yoRDO Ub3egZq4Bz3+y44qNItrxUK++G2mFV7odPwarzqMt5OSg+XYgkg71v4oU8Y0V3j5heXj 1jKnWPt/904A60+R70Q6UcY9RQI4StiQbYdGwKG94pThZTHGXXKhNhx/sWOYsyFQujQ0 Wr9ZYPjXLa81nwus8nv/aj/TivyBZTv+rsY6pQ7f8SmJ7Z6WPDjbHkekb49e9AiBbgBD MjFxYMFIIemuvyuq0bzmAeH3nuEDDIWGbuxkBlc6b6g/hpGC0C6ggX9KTry8sv6Y/SoI RyMw== X-Received: by 10.152.229.133 with SMTP id sq5mr6760821lac.67.1408744156263; Fri, 22 Aug 2014 14:49:16 -0700 (PDT) Received: from vostro ([83.145.235.199]) by mx.google.com with ESMTPSA id si1sm48866360lbb.43.2014.08.22.14.49.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Aug 2014 14:49:16 -0700 (PDT) Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= Date: Sat, 23 Aug 2014 00:49:05 +0300 From: Timo Teras To: Der Tiger Cc: Jeff Pohlmeyer , Alpine Subject: Re: [alpine-devel] Re: Busybox diff / grep oddities Message-ID: <20140823004905.03159b08@vostro> In-Reply-To: <53F75FF0.6050305@arcor.de> References: <53F75FF0.6050305@arcor.de> X-Mailer: Claws Mail 3.10.1 (GTK+ 2.24.23; x86_64-alpine-linux-musl) X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 22 Aug 2014 17:21:20 +0200 Der Tiger wrote: > Hi Jeff, > > Recursive diff succeeds without trying? > > busybox diff -rq /bin /etc > > echo $? > Actually, it does what it's supposed to do with BusyBox 1.21.1 on > Alpine 2.7.9. > > | $ diff -rq /bin /etc|| > || Only in /etc: TZ|| > || Only in /bin: addgroup|| > || Only in /bin: adduser|| > || Only in /etc: adjtime|| > || Only in /etc: alpine-release|| > || Only in /bin: ash|| > || [...]|| > || $ echo $?|| > || 1|| Not sure about this... but. > > This should be a match? > > echo "abbc" | busybox grep 'ab\+c' > A very peculiar behaviour, indeed. Though, syntax and match are > correct, because: > > "In basic regular expressions the metacharacters ?, +, {, |, (, > and ) lose their special meaning; instead use the backslashed > versions \?, \+, \{, \|, \(, and \)." > > > For more information see: http://unixhelp.ed.ac.uk/CGI/man-cgi?grep > > I've verified the behaviour with GNU grep 2.18, as well. Your example > is equivalent to: > > | echo "abbc" | grep 'abb*c'|| > | Alpine 3.0+ use musl implementation of regular expressions in busybox. musl is strictly POSIX confirming, and \+ in BRE is not POSIX specified. Some implementations support it, notable GNU. But that is implementation specific extension and not portable or standard compliant. The posix compliant way is: $ echo "abbc" | busybox grep "ab\{1,\}c" abbc See, eg. http://www.regular-expressions.info/posix.html /Timo --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---