[alpine-devel] [PATCH] lbu: 'lbu status' shows files whose permissions have changed
Export this patch
'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
---