From: Rob Browning Date: Sun, 8 Oct 2017 14:54:39 +0000 (-0500) Subject: Support remote listings: bup ls -r ... X-Git-Tag: 0.30~141 X-Git-Url: https://arthur.barton.de/gitweb/?a=commitdiff_plain;h=e55fed0f6a965a1c625f5282e164f82bb888c78b;p=bup.git Support remote listings: bup ls -r ... Signed-off-by: Rob Browning --- diff --git a/Makefile b/Makefile index 5c6ef89..6647569 100644 --- a/Makefile +++ b/Makefile @@ -165,7 +165,8 @@ cmdline_tests := \ t/test-fsck.sh \ t/test-index-clear.sh \ t/test-index-check-device.sh \ - t/test-ls.sh \ + t/test-ls \ + t/test-ls-remote \ t/test-tz.sh \ t/test-meta.sh \ t/test-on.sh \ diff --git a/README.md b/README.md index dd54550..e5d0f73 100644 --- a/README.md +++ b/README.md @@ -251,6 +251,10 @@ Using bup bup index /etc bup save -r SERVER: -n local-etc /etc + - See what saves are available in ~/.bup on SERVER: + + bup ls -r SERVER: + - Restore the remote backup to ./dest: bup restore -r SERVER: -C ./dest local-etc/latest/etc diff --git a/lib/bup/ls.py b/lib/bup/ls.py index b59f43f..8968d1f 100644 --- a/lib/bup/ls.py +++ b/lib/bup/ls.py @@ -6,7 +6,7 @@ from stat import S_ISDIR, S_ISLNK import copy, locale, os.path, stat, sys, xstat from bup import metadata, options, vfs2 as vfs -from bup.repo import LocalRepo +from bup.repo import LocalRepo, RemoteRepo from helpers import columnate, istty1, last, log def item_hash(item, tree_for_commit): @@ -51,8 +51,9 @@ def item_info(item, name, optspec = """ -%sls [-a] [path...] +%sls [-r host:path] [-l] [-d] [-F] [-a] [-A] [-s] [-n] [path...] -- +r,remote= remote repository path s,hash show hash for each file commit-hash show commit hash instead of tree for commits (implies -s) a,all show hidden files @@ -106,7 +107,7 @@ def do_ls(args, default='.', onabort=None, spec_prefix=''): numeric_ids = opt.numeric_ids, human_readable = opt.human_readable) - repo = LocalRepo() + repo = RemoteRepo(opt.remote) if opt.remote else LocalRepo() ret = 0 pending = [] for path in (extra or [default]): diff --git a/t/test-ls b/t/test-ls new file mode 100755 index 0000000..7fb05cf --- /dev/null +++ b/t/test-ls @@ -0,0 +1,293 @@ +#!/usr/bin/env bash +. ./wvtest-bup.sh || exit $? +. t/lib.sh || exit $? + +set -o pipefail + +top="$(WVPASS pwd)" || exit $? +tmpdir="$(WVPASS wvmktempdir)" || exit $? + +export BUP_DIR="$tmpdir/bup" +export GIT_DIR="$tmpdir/bup" + +if test "$BUP_TEST_REMOTE_REPO"; then + ls_cmd_desc='ls -r' +else + ls_cmd_desc='ls' +fi + +bup() { "$top/bup" "$@"; } + +bup-ls() { + if test "$BUP_TEST_REMOTE_REPO"; then + "$top/bup" ls -r "$BUP_DIR" "$@" + else + "$top/bup" ls "$@" + fi +} + + +export TZ=UTC + +WVPASS bup init +WVPASS cd "$tmpdir" + +WVPASS mkdir src +WVPASS touch src/.dotfile src/executable +WVPASS mkfifo src/fifo +WVPASS "$top"/t/mksock src/socket +WVPASS bup random 1k > src/file +WVPASS chmod u+x src/executable +WVPASS chmod -R u=rwX,g-rwx,o-rwx . +WVPASS touch -t 200910032348 src/.dotfile src/* +(WVPASS cd src; WVPASS ln -s file symlink) || exit $? +(WVPASS cd src; WVPASS ln -s not-there bad-symlink) || exit $? +WVPASS touch -t 200910032348 src +WVPASS touch -t 200910032348 . +WVPASS bup index src +WVPASS bup save -n src -d 242312160 --strip src +WVPASS bup tag some-tag src + +uid="$(WVPASS id -u)" || exit $? +gid="$(WVPASS bup-python -c 'import os; print os.stat("src").st_gid')" || exit $? +user="$(WVPASS id -un)" || exit $? +group="$(WVPASS bup-python -c 'import grp, os; +print grp.getgrgid(os.stat("src").st_gid)[0]')" || exit $? +src_commit_hash=$(git log --format=%H -n1 src) +src_tree_hash=$(git log --format=%T -n1 src) + + +WVSTART "$ls_cmd_desc (short)" + +(export BUP_FORCE_TTY=1; WVPASSEQ "$(WVPASS bup-ls | tr -d ' ')" src) + +WVPASSEQ "$(WVPASS bup-ls /)" "src" + +WVPASSEQ "$(WVPASS bup-ls -A /)" ".tag +src" + +WVPASSEQ "$(WVPASS bup-ls -AF /)" ".tag/ +src/" + +WVPASSEQ "$(WVPASS bup-ls -a /)" ". +.. +.tag +src" + +WVPASSEQ "$(WVPASS bup-ls -aF /)" "./ +../ +.tag/ +src/" + +WVPASSEQ "$(WVPASS bup-ls /.tag)" "some-tag" + +WVPASSEQ "$(WVPASS bup-ls /src)" \ +"1977-09-05-125600 +latest" + +WVPASSEQ "$(WVPASS bup-ls src/latest)" "bad-symlink +executable +fifo +file +socket +symlink" + +WVPASSEQ "$(WVPASS bup-ls -A src/latest)" ".dotfile +bad-symlink +executable +fifo +file +socket +symlink" + +WVPASSEQ "$(WVPASS bup-ls -a src/latest)" ". +.. +.dotfile +bad-symlink +executable +fifo +file +socket +symlink" + +WVPASSEQ "$(WVPASS bup-ls -F src/latest)" "bad-symlink@ +executable* +fifo| +file +socket= +symlink@" + +WVPASSEQ "$(WVPASS bup-ls --file-type src/latest)" "bad-symlink@ +executable +fifo| +file +socket= +symlink@" + +WVPASSEQ "$(WVPASS bup-ls -d src/latest)" "src/latest" + + +WVSTART "$ls_cmd_desc (long)" + +WVPASSEQ "$(WVPASS bup-ls -l / | tr -s ' ' ' ')" \ +"drwx------ $user/$group 0 2009-10-03 23:48 src" + +WVPASSEQ "$(WVPASS bup-ls -lA / | tr -s ' ' ' ')" \ +"drwxr-xr-x 0/0 0 1970-01-01 00:00 .tag +drwx------ $user/$group 0 2009-10-03 23:48 src" + +WVPASSEQ "$(WVPASS bup-ls -lAF / | tr -s ' ' ' ')" \ +"drwxr-xr-x 0/0 0 1970-01-01 00:00 .tag/ +drwx------ $user/$group 0 2009-10-03 23:48 src/" + +WVPASSEQ "$(WVPASS bup-ls -la / | tr -s ' ' ' ')" \ +"drwxr-xr-x 0/0 0 1970-01-01 00:00 . +drwxr-xr-x 0/0 0 1970-01-01 00:00 .. +drwxr-xr-x 0/0 0 1970-01-01 00:00 .tag +drwx------ $user/$group 0 2009-10-03 23:48 src" + +WVPASSEQ "$(WVPASS bup-ls -laF / | tr -s ' ' ' ')" \ +"drwxr-xr-x 0/0 0 1970-01-01 00:00 ./ +drwxr-xr-x 0/0 0 1970-01-01 00:00 ../ +drwxr-xr-x 0/0 0 1970-01-01 00:00 .tag/ +drwx------ $user/$group 0 2009-10-03 23:48 src/" + +socket_mode="$(WVPASS ls -l src/socket | cut -b -10)" || exit $? + + +bad_symlink_mode="$(WVPASS ls -l src/bad-symlink | cut -b -10)" || exit $? + +bad_symlink_bup_info="$(WVPASS bup-ls -l src/latest | grep bad-symlink)" \ + || exit $? +bad_symlink_date="$(WVPASS echo "$bad_symlink_bup_info" \ + | WVPASS perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $2')" \ + || exit $? + +test "$bad_symlink_date" || exit 1 + +if test "$(uname -s)" != NetBSD; then + bad_symlink_size="$(WVPASS bup-python -c "import os +print os.lstat('src/bad-symlink').st_size")" || exit $? +else + # NetBSD appears to return varying sizes, so for now, just ignore it. + bad_symlink_size="$(WVPASS echo "$bad_symlink_bup_info" \ + | WVPASS perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $1')" \ + || exit $? +fi + + +symlink_mode="$(WVPASS ls -l src/symlink | cut -b -10)" || exit $? + +symlink_bup_info="$(WVPASS bup-ls -l src/latest | grep -E '[^-]symlink')" \ + || exit $? +symlink_date="$(WVPASS echo "$symlink_bup_info" \ + | WVPASS perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $2')" \ + || exit $? + +test "$symlink_date" || exit 1 + +if test "$(uname -s)" != NetBSD; then + symlink_size="$(WVPASS bup-python -c "import os +print os.lstat('src/symlink').st_size")" || exit $? +else + # NetBSD appears to return varying sizes, so for now, just ignore it. + symlink_size="$(WVPASS echo "$symlink_bup_info" \ + | WVPASS perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $1')" \ + || exit $? +fi + +WVPASSEQ "$(bup-ls -l src/latest | tr -s ' ' ' ')" \ +"$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date bad-symlink -> not-there +-rwx------ $user/$group 0 2009-10-03 23:48 executable +prw------- $user/$group 0 2009-10-03 23:48 fifo +-rw------- $user/$group 1024 2009-10-03 23:48 file +$socket_mode $user/$group 0 2009-10-03 23:48 socket +$symlink_mode $user/$group $symlink_size $symlink_date symlink -> file" + +WVPASSEQ "$(bup-ls -la src/latest | tr -s ' ' ' ')" \ +"drwx------ $user/$group 0 2009-10-03 23:48 . +drwx------ $user/$group 0 2009-10-03 23:48 .. +-rw------- $user/$group 0 2009-10-03 23:48 .dotfile +$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date bad-symlink -> not-there +-rwx------ $user/$group 0 2009-10-03 23:48 executable +prw------- $user/$group 0 2009-10-03 23:48 fifo +-rw------- $user/$group 1024 2009-10-03 23:48 file +$socket_mode $user/$group 0 2009-10-03 23:48 socket +$symlink_mode $user/$group $symlink_size $symlink_date symlink -> file" + +WVPASSEQ "$(bup-ls -lA src/latest | tr -s ' ' ' ')" \ +"-rw------- $user/$group 0 2009-10-03 23:48 .dotfile +$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date bad-symlink -> not-there +-rwx------ $user/$group 0 2009-10-03 23:48 executable +prw------- $user/$group 0 2009-10-03 23:48 fifo +-rw------- $user/$group 1024 2009-10-03 23:48 file +$socket_mode $user/$group 0 2009-10-03 23:48 socket +$symlink_mode $user/$group $symlink_size $symlink_date symlink -> file" + +WVPASSEQ "$(bup-ls -lF src/latest | tr -s ' ' ' ')" \ +"$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date bad-symlink@ -> not-there +-rwx------ $user/$group 0 2009-10-03 23:48 executable* +prw------- $user/$group 0 2009-10-03 23:48 fifo| +-rw------- $user/$group 1024 2009-10-03 23:48 file +$socket_mode $user/$group 0 2009-10-03 23:48 socket= +$symlink_mode $user/$group $symlink_size $symlink_date symlink@ -> file" + +WVPASSEQ "$(bup-ls -l --file-type src/latest | tr -s ' ' ' ')" \ +"$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date bad-symlink@ -> not-there +-rwx------ $user/$group 0 2009-10-03 23:48 executable +prw------- $user/$group 0 2009-10-03 23:48 fifo| +-rw------- $user/$group 1024 2009-10-03 23:48 file +$socket_mode $user/$group 0 2009-10-03 23:48 socket= +$symlink_mode $user/$group $symlink_size $symlink_date symlink@ -> file" + +WVPASSEQ "$(bup-ls -ln src/latest | tr -s ' ' ' ')" \ +"$bad_symlink_mode $uid/$gid $bad_symlink_size $bad_symlink_date bad-symlink -> not-there +-rwx------ $uid/$gid 0 2009-10-03 23:48 executable +prw------- $uid/$gid 0 2009-10-03 23:48 fifo +-rw------- $uid/$gid 1024 2009-10-03 23:48 file +$socket_mode $uid/$gid 0 2009-10-03 23:48 socket +$symlink_mode $uid/$gid $symlink_size $symlink_date symlink -> file" + +WVPASSEQ "$(bup-ls -ld "src/latest" | tr -s ' ' ' ')" \ +"drwx------ $user/$group 0 2009-10-03 23:48 src/latest" + + +WVSTART "$ls_cmd_desc (backup set - long)" +WVPASSEQ "$(bup-ls -l --numeric-ids src | cut -d' ' -f 1-2)" \ +"drwx------ $uid/$gid +drwx------ $uid/$gid" + +WVPASSEQ "$(bup-ls -ds "src/latest" | tr -s ' ' ' ')" \ +"$src_tree_hash src/latest" + +WVPASSEQ "$(bup-ls -ds --commit-hash "src/latest" | tr -s ' ' ' ')" \ +"$src_commit_hash src/latest" + + +WVSTART "$ls_cmd_desc (dates TZ != UTC)" +export TZ=America/Chicago +bad_symlink_date_central="$(bup-ls -l src/latest | grep bad-symlink)" +bad_symlink_date_central="$(echo "$bad_symlink_date_central" \ + | perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $2')" +symlink_date_central="$(bup-ls -l src/latest | grep -E '[^-]symlink')" +symlink_date_central="$(echo "$symlink_date_central" \ + | perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $2')" +WVPASSEQ "$(bup-ls -ln src/latest | tr -s ' ' ' ')" \ +"$bad_symlink_mode $uid/$gid $bad_symlink_size $bad_symlink_date_central bad-symlink -> not-there +-rwx------ $uid/$gid 0 2009-10-03 18:48 executable +prw------- $uid/$gid 0 2009-10-03 18:48 fifo +-rw------- $uid/$gid 1024 2009-10-03 18:48 file +$socket_mode $uid/$gid 0 2009-10-03 18:48 socket +$symlink_mode $uid/$gid $symlink_size $symlink_date_central symlink -> file" +export TZ=UTC + + +WVSTART "$ls_cmd_desc bad-symlink" +WVPASSEQ "$(bup-ls "src/latest/bad-symlink")" "src/latest/bad-symlink" + +WVSTART "$ls_cmd_desc -l bad-symlink" +WVPASSEQ "$(bup-ls -l src/latest/bad-symlink | tr -s ' ' ' ')" \ +"$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date src/latest/bad-symlink -> not-there" + + +WVPASS rm -rf "$tmpdir" diff --git a/t/test-ls-remote b/t/test-ls-remote new file mode 100755 index 0000000..8b34caf --- /dev/null +++ b/t/test-ls-remote @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +BUP_TEST_REMOTE_REPO=t t/test-ls diff --git a/t/test-ls.sh b/t/test-ls.sh deleted file mode 100755 index ef71c19..0000000 --- a/t/test-ls.sh +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env bash -. ./wvtest-bup.sh || exit $? -. t/lib.sh || exit $? - -set -o pipefail - -top="$(WVPASS pwd)" || exit $? -tmpdir="$(WVPASS wvmktempdir)" || exit $? - -export BUP_DIR="$tmpdir/bup" -export GIT_DIR="$tmpdir/bup" - -bup() { "$top/bup" "$@"; } - -export TZ=UTC - -WVPASS bup init -WVPASS cd "$tmpdir" - -WVPASS mkdir src -WVPASS touch src/.dotfile src/executable -WVPASS mkfifo src/fifo -WVPASS "$top"/t/mksock src/socket -WVPASS bup random 1k > src/file -WVPASS chmod u+x src/executable -WVPASS chmod -R u=rwX,g-rwx,o-rwx . -WVPASS touch -t 200910032348 src/.dotfile src/* -(WVPASS cd src; WVPASS ln -s file symlink) || exit $? -(WVPASS cd src; WVPASS ln -s not-there bad-symlink) || exit $? -WVPASS touch -t 200910032348 src -WVPASS touch -t 200910032348 . -WVPASS bup index src -WVPASS bup save -n src -d 242312160 --strip src -WVPASS bup tag some-tag src - -uid="$(WVPASS id -u)" || exit $? -gid="$(WVPASS bup-python -c 'import os; print os.stat("src").st_gid')" || exit $? -user="$(WVPASS id -un)" || exit $? -group="$(WVPASS bup-python -c 'import grp, os; -print grp.getgrgid(os.stat("src").st_gid)[0]')" || exit $? -src_commit_hash=$(git log --format=%H -n1 src) -src_tree_hash=$(git log --format=%T -n1 src) - - -WVSTART "ls (short)" - -(export BUP_FORCE_TTY=1; WVPASSEQ "$(WVPASS bup ls | tr -d ' ')" src) - -WVPASSEQ "$(WVPASS bup ls /)" "src" - -WVPASSEQ "$(WVPASS bup ls -A /)" ".tag -src" - -WVPASSEQ "$(WVPASS bup ls -AF /)" ".tag/ -src/" - -WVPASSEQ "$(WVPASS bup ls -a /)" ". -.. -.tag -src" - -WVPASSEQ "$(WVPASS bup ls -aF /)" "./ -../ -.tag/ -src/" - -WVPASSEQ "$(WVPASS bup ls /.tag)" "some-tag" - -WVPASSEQ "$(WVPASS bup ls /src)" \ -"1977-09-05-125600 -latest" - -WVPASSEQ "$(WVPASS bup ls src/latest)" "bad-symlink -executable -fifo -file -socket -symlink" - -WVPASSEQ "$(WVPASS bup ls -A src/latest)" ".dotfile -bad-symlink -executable -fifo -file -socket -symlink" - -WVPASSEQ "$(WVPASS bup ls -a src/latest)" ". -.. -.dotfile -bad-symlink -executable -fifo -file -socket -symlink" - -WVPASSEQ "$(WVPASS bup ls -F src/latest)" "bad-symlink@ -executable* -fifo| -file -socket= -symlink@" - -WVPASSEQ "$(WVPASS bup ls --file-type src/latest)" "bad-symlink@ -executable -fifo| -file -socket= -symlink@" - -WVPASSEQ "$(WVPASS bup ls -d src/latest)" "src/latest" - - -WVSTART "ls (long)" - -WVPASSEQ "$(WVPASS bup ls -l / | tr -s ' ' ' ')" \ -"drwx------ $user/$group 0 2009-10-03 23:48 src" - -WVPASSEQ "$(WVPASS bup ls -lA / | tr -s ' ' ' ')" \ -"drwxr-xr-x 0/0 0 1970-01-01 00:00 .tag -drwx------ $user/$group 0 2009-10-03 23:48 src" - -WVPASSEQ "$(WVPASS bup ls -lAF / | tr -s ' ' ' ')" \ -"drwxr-xr-x 0/0 0 1970-01-01 00:00 .tag/ -drwx------ $user/$group 0 2009-10-03 23:48 src/" - -WVPASSEQ "$(WVPASS bup ls -la / | tr -s ' ' ' ')" \ -"drwxr-xr-x 0/0 0 1970-01-01 00:00 . -drwxr-xr-x 0/0 0 1970-01-01 00:00 .. -drwxr-xr-x 0/0 0 1970-01-01 00:00 .tag -drwx------ $user/$group 0 2009-10-03 23:48 src" - -WVPASSEQ "$(WVPASS bup ls -laF / | tr -s ' ' ' ')" \ -"drwxr-xr-x 0/0 0 1970-01-01 00:00 ./ -drwxr-xr-x 0/0 0 1970-01-01 00:00 ../ -drwxr-xr-x 0/0 0 1970-01-01 00:00 .tag/ -drwx------ $user/$group 0 2009-10-03 23:48 src/" - -socket_mode="$(WVPASS ls -l src/socket | cut -b -10)" || exit $? - - -bad_symlink_mode="$(WVPASS ls -l src/bad-symlink | cut -b -10)" || exit $? - -bad_symlink_bup_info="$(WVPASS bup ls -l src/latest | grep bad-symlink)" \ - || exit $? -bad_symlink_date="$(WVPASS echo "$bad_symlink_bup_info" \ - | WVPASS perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $2')" \ - || exit $? - -test "$bad_symlink_date" || exit 1 - -if test "$(uname -s)" != NetBSD; then - bad_symlink_size="$(WVPASS bup-python -c "import os -print os.lstat('src/bad-symlink').st_size")" || exit $? -else - # NetBSD appears to return varying sizes, so for now, just ignore it. - bad_symlink_size="$(WVPASS echo "$bad_symlink_bup_info" \ - | WVPASS perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $1')" \ - || exit $? -fi - - -symlink_mode="$(WVPASS ls -l src/symlink | cut -b -10)" || exit $? - -symlink_bup_info="$(WVPASS bup ls -l src/latest | grep -E '[^-]symlink')" \ - || exit $? -symlink_date="$(WVPASS echo "$symlink_bup_info" \ - | WVPASS perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $2')" \ - || exit $? - -test "$symlink_date" || exit 1 - -if test "$(uname -s)" != NetBSD; then - symlink_size="$(WVPASS bup-python -c "import os -print os.lstat('src/symlink').st_size")" || exit $? -else - # NetBSD appears to return varying sizes, so for now, just ignore it. - symlink_size="$(WVPASS echo "$symlink_bup_info" \ - | WVPASS perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $1')" \ - || exit $? -fi - -WVPASSEQ "$(bup ls -l src/latest | tr -s ' ' ' ')" \ -"$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date bad-symlink -> not-there --rwx------ $user/$group 0 2009-10-03 23:48 executable -prw------- $user/$group 0 2009-10-03 23:48 fifo --rw------- $user/$group 1024 2009-10-03 23:48 file -$socket_mode $user/$group 0 2009-10-03 23:48 socket -$symlink_mode $user/$group $symlink_size $symlink_date symlink -> file" - -WVPASSEQ "$(bup ls -la src/latest | tr -s ' ' ' ')" \ -"drwx------ $user/$group 0 2009-10-03 23:48 . -drwx------ $user/$group 0 2009-10-03 23:48 .. --rw------- $user/$group 0 2009-10-03 23:48 .dotfile -$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date bad-symlink -> not-there --rwx------ $user/$group 0 2009-10-03 23:48 executable -prw------- $user/$group 0 2009-10-03 23:48 fifo --rw------- $user/$group 1024 2009-10-03 23:48 file -$socket_mode $user/$group 0 2009-10-03 23:48 socket -$symlink_mode $user/$group $symlink_size $symlink_date symlink -> file" - -WVPASSEQ "$(bup ls -lA src/latest | tr -s ' ' ' ')" \ -"-rw------- $user/$group 0 2009-10-03 23:48 .dotfile -$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date bad-symlink -> not-there --rwx------ $user/$group 0 2009-10-03 23:48 executable -prw------- $user/$group 0 2009-10-03 23:48 fifo --rw------- $user/$group 1024 2009-10-03 23:48 file -$socket_mode $user/$group 0 2009-10-03 23:48 socket -$symlink_mode $user/$group $symlink_size $symlink_date symlink -> file" - -WVPASSEQ "$(bup ls -lF src/latest | tr -s ' ' ' ')" \ -"$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date bad-symlink@ -> not-there --rwx------ $user/$group 0 2009-10-03 23:48 executable* -prw------- $user/$group 0 2009-10-03 23:48 fifo| --rw------- $user/$group 1024 2009-10-03 23:48 file -$socket_mode $user/$group 0 2009-10-03 23:48 socket= -$symlink_mode $user/$group $symlink_size $symlink_date symlink@ -> file" - -WVPASSEQ "$(bup ls -l --file-type src/latest | tr -s ' ' ' ')" \ -"$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date bad-symlink@ -> not-there --rwx------ $user/$group 0 2009-10-03 23:48 executable -prw------- $user/$group 0 2009-10-03 23:48 fifo| --rw------- $user/$group 1024 2009-10-03 23:48 file -$socket_mode $user/$group 0 2009-10-03 23:48 socket= -$symlink_mode $user/$group $symlink_size $symlink_date symlink@ -> file" - -WVPASSEQ "$(bup ls -ln src/latest | tr -s ' ' ' ')" \ -"$bad_symlink_mode $uid/$gid $bad_symlink_size $bad_symlink_date bad-symlink -> not-there --rwx------ $uid/$gid 0 2009-10-03 23:48 executable -prw------- $uid/$gid 0 2009-10-03 23:48 fifo --rw------- $uid/$gid 1024 2009-10-03 23:48 file -$socket_mode $uid/$gid 0 2009-10-03 23:48 socket -$symlink_mode $uid/$gid $symlink_size $symlink_date symlink -> file" - -WVPASSEQ "$(bup ls -ld "src/latest" | tr -s ' ' ' ')" \ -"drwx------ $user/$group 0 2009-10-03 23:48 src/latest" - - -WVSTART "ls (backup set - long)" -WVPASSEQ "$(bup ls -l --numeric-ids src | cut -d' ' -f 1-2)" \ -"drwx------ $uid/$gid -drwx------ $uid/$gid" - -WVPASSEQ "$(bup ls -ds "src/latest" | tr -s ' ' ' ')" \ -"$src_tree_hash src/latest" - -WVPASSEQ "$(bup ls -ds --commit-hash "src/latest" | tr -s ' ' ' ')" \ -"$src_commit_hash src/latest" - - -WVSTART "ls (dates TZ != UTC)" -export TZ=America/Chicago -bad_symlink_date_central="$(bup ls -l src/latest | grep bad-symlink)" -bad_symlink_date_central="$(echo "$bad_symlink_date_central" \ - | perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $2')" -symlink_date_central="$(bup ls -l src/latest | grep -E '[^-]symlink')" -symlink_date_central="$(echo "$symlink_date_central" \ - | perl -ne 'm/.*? (\d+) (\d\d\d\d-\d\d-\d\d \d\d:\d\d)/ and print $2')" -WVPASSEQ "$(bup ls -ln src/latest | tr -s ' ' ' ')" \ -"$bad_symlink_mode $uid/$gid $bad_symlink_size $bad_symlink_date_central bad-symlink -> not-there --rwx------ $uid/$gid 0 2009-10-03 18:48 executable -prw------- $uid/$gid 0 2009-10-03 18:48 fifo --rw------- $uid/$gid 1024 2009-10-03 18:48 file -$socket_mode $uid/$gid 0 2009-10-03 18:48 socket -$symlink_mode $uid/$gid $symlink_size $symlink_date_central symlink -> file" -export TZ=UTC - - -WVSTART "ls bad-symlink" -WVPASSEQ "$(bup ls "src/latest/bad-symlink")" "src/latest/bad-symlink" - -WVSTART "ls -l bad-symlink" -WVPASSEQ "$(bup ls -l src/latest/bad-symlink | tr -s ' ' ' ')" \ -"$bad_symlink_mode $user/$group $bad_symlink_size $bad_symlink_date src/latest/bad-symlink -> not-there" - - -WVPASS rm -rf "$tmpdir"