3 bup_exec="$(dirname "$0")/bup-exec" || exit $?
4 exec "$bup_exec" "$0" ${1+"$@"}
7 from __future__ import absolute_import, print_function
10 from bup.compat import get_argvb
11 from bup.io import byte_stream
14 # Print the full paths of all the files in each hardlink set
15 # underneath one of the paths. Separate sets with a blank line, sort
16 # the paths within each set, and sort the sets by their first path.
19 print("Usage: hardlink-sets <paths ...>", file=sys.stderr)
31 out = byte_stream(sys.stdout)
36 for root, dirs, files in os.walk(p, onerror = on_walk_error):
37 for filename in files:
38 full_path = os.path.join(root, filename)
39 st = os.lstat(full_path)
40 if not stat.S_ISDIR(st.st_mode):
41 node = b'%d:%d' % (st.st_dev, st.st_ino)
42 link_paths = hardlink_set.get(node)
44 link_paths.append(full_path)
46 hardlink_set[node] = [full_path]
49 for node, link_paths in hardlink_set.items():
53 for link_paths in sorted(hardlink_set.values(), key = lambda x : x[0]):
54 if len(link_paths) > 1:
59 for p in sorted(link_paths):