X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id B303ADC00CC for ; Wed, 19 Feb 2014 09:41:12 +0000 (UTC) Received: by mail-ee0-f48.google.com with SMTP id t10so89377eei.7 for ; Wed, 19 Feb 2014 01:41:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=5cV8MK+/fMgDvxrPDIoEIYGLv4DzcfJEcilpDL3fOto=; b=ieSJVQs5/wA/lWlx3PcGvZ1FrmpYTqWwtYnOiYuCcVwE+/61lI/VdloN2kzMi38dxX QcO9rEnbDf4WvnrT3cQElZhYYMsX1w5/zp0kr95CKywdRg3C5rALJSx/BEAV+ZhftHCO JOxcJLfar0YjH7bhkANR77l6WJ0W1IY2al+KmLs+ytKn1W7izbEMIeP5YEll+ALo1yUS Sk/ufIMik5MIqf6XwSJdDk+T11616ZtKuVBIVhQ2pctv0pajTspxRVA5mQXDn3RYtvRl eT9Siqm39RNeCZTnbRN8sahYJW5J+M8t72M34PqkJJ0u+/dI3JrDWpNcIhfw+xhpUmYF 2gBA== X-Received: by 10.14.204.137 with SMTP id h9mr291050eeo.98.1392802868849; Wed, 19 Feb 2014 01:41:08 -0800 (PST) Received: from alex-ThinkPad-L530.resnet.local ([41.191.119.138]) by mx.google.com with ESMTPSA id y47sm81048297eel.14.2014.02.19.01.41.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Feb 2014 01:41:08 -0800 (PST) From: Alex Dowad To: alpine-devel@lists.alpinelinux.org Cc: Alex Dowad Subject: [alpine-devel] [PATCH] lbu: 'lbu status' shows files whose permissions have changed Date: Wed, 19 Feb 2014 11:41:02 +0200 Message-Id: <1392802862-15287-1-git-send-email-alexinbeijing@gmail.com> X-Mailer: git-send-email 1.7.10.4 X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: 'lbu status' didn't list files whose permissions have been changed. However, 'lbu commit' *does* save those changes, which is slightly non-intuitive. It could be confusing for someone trying to determine what changes will be saved by 'lbu commit'. To avoid impacting the performance of 'lbu status', only built-in shellscript file test operators are used. This means that only changes in permissions for *the current user* will be detected. This deficiency could be remedied by using 'stat' to check file permissions, but that slows 'lbu status' down noticeably (about 220ms on my installation of Alpine). --- lbu.in | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lbu.in b/lbu.in index a0e68ed..ad64cfd 100644 --- a/lbu.in +++ b/lbu.in @@ -648,9 +648,22 @@ cmd_status() { local b="$tmp/b/$f" if [ ! -e "$a" ] && [ ! -L "$a" ]; then echo "A $f" - elif [ -f "$a" ] && [ -f "$b" ] && [ "$b" -nt "$a" ] \ - && ! cmp -s "$a" "$b"; then - echo "U $f" + elif [ -f "$a" ] && [ -f "$b" ]; then + if [ "$b" -nt "$a" ] && ! cmp -s "$a" "$b"; then + echo "U $f" + elif [ -r "$a" ] && [ ! -r "$b" ]; then + echo "U $f" + elif [ ! -r "$a" ] && [ -r "$b" ]; then + echo "U $f" + elif [ -w "$a" ] && [ ! -w "$b" ]; then + echo "U $f" + elif [ ! -w "$a" ] && [ -w "$b" ]; then + echo "U $f" + elif [ -x "$a" ] && [ ! -x "$b" ]; then + echo "U $f" + elif [ ! -x "$a" ] && [ -x "$b" ]; then + echo "U $f" + fi fi done } -- 1.7.10.4 --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---