diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-02-25 14:27:43 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-02-25 14:27:43 +0000 |
commit | 907faf600f4d95eaae4b5c2fc0e8bc06c3efe48e (patch) | |
tree | 79ca1d60da3f85738f4a1cbc890811c99628dbdd | |
parent | a4a011dd30194eb3f1af728a887199d99da7ec29 (diff) | |
download | summain-907faf600f4d95eaae4b5c2fc0e8bc06c3efe48e.tar.gz |
Do not recurse through a symlink given as root
-rwxr-xr-x | summain | 2 | ||||
-rwxr-xr-x | tests/symlink.script | 10 | ||||
-rw-r--r-- | tests/symlink.stdout | 7 |
3 files changed, 18 insertions, 1 deletions
@@ -122,7 +122,7 @@ class Summain(cliapp.Application): 'choose output format (rfc822, csv, json)') def files(self, root): - if os.path.isdir(root): + if os.path.isdir(root) and not os.path.islink(root): for dirname, dirnames, filenames in os.walk(root): yield dirname dirnames.sort() diff --git a/tests/symlink.script b/tests/symlink.script new file mode 100755 index 0000000..d5dd25e --- /dev/null +++ b/tests/symlink.script @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +mkdir "$DATADIR/dir" +touch "$DATADIR/dir/file" +ln -s dir "$DATADIR/symlink" +./summain --exclude=mtime --exclude=uid --exclude=username \ + --exclude=gid --exclude=group --exclude=mode "$DATADIR/symlink" | +sed 's,^Name: /.*/,Name: ,' diff --git a/tests/symlink.stdout b/tests/symlink.stdout new file mode 100644 index 0000000..8288ba8 --- /dev/null +++ b/tests/symlink.stdout @@ -0,0 +1,7 @@ +Name: symlink +Ino: 1 +Dev: 1 +Nlink: 1 +Size: 3 +Target: dir + |