3 # https://sourceware.org/bugzilla/show_bug.cgi?id=26034
4 export "BUP_ARGV_0"="$0"
7 export "BUP_ARGV_${arg_i}"="$arg"
11 bup_python="$(dirname "$0")/../lib/cmd/bup-python" || exit $?
12 exec "$bup_python" "$0"
16 from __future__ import absolute_import, print_function
19 from bup import compat
20 from bup.io import byte_stream
23 # Print the full paths of all the files in each hardlink set
24 # underneath one of the paths. Separate sets with a blank line, sort
25 # the paths within each set, and sort the sets by their first path.
28 print("Usage: hardlink-sets <paths ...>", file=sys.stderr)
30 if len(compat.argv) < 2:
38 out = byte_stream(sys.stdout)
42 for p in compat.argvb[1:]:
43 for root, dirs, files in os.walk(p, onerror = on_walk_error):
44 for filename in files:
45 full_path = os.path.join(root, filename)
46 st = os.lstat(full_path)
47 if not stat.S_ISDIR(st.st_mode):
48 node = b'%d:%d' % (st.st_dev, st.st_ino)
49 link_paths = hardlink_set.get(node)
51 link_paths.append(full_path)
53 hardlink_set[node] = [full_path]
56 for node, link_paths in hardlink_set.items():
60 for link_paths in sorted(hardlink_set.values(), key = lambda x : x[0]):
61 if len(link_paths) > 1:
66 for p in sorted(link_paths):