~alpine/devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[alpine-devel] [PATCH] lbu: 'lbu status' shows files whose permissions have changed

Details
Message ID
<1392802862-15287-1-git-send-email-alexinbeijing@gmail.com>
Sender timestamp
1392802862
DKIM signature
missing
Download raw message
Patch: +16 -3
'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
---
Reply to thread Export thread (mbox)