Package: gdmap Severity: wishlist Tags: upstream Hi,
I have an enormous file: -rw-rw-r-- 4 jrn jrn 14165272364 Jan 7 2011 svn-kde-0-1200000.xz -rw-rw-r-- 4 jrn jrn 14165272364 Jan 7 2011 svn-kde-0:1200000.xz As you can see, it has two filesystem entries because I am scared of deleting one by mistake. They point to the same inode, but gdmap draws them as separate rectangles. I'm not sure what the right way to deal with this sort of thing is. The problem becomes even more complicated when different links to the same file reside in different directories. In any case, it should be documented. How about this patch (untested)? --- data/gdmap.1 | 6 ++++++ src/tree.c | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/data/gdmap.1 b/data/gdmap.1 index 80911729..6740b14b 100644 --- a/data/gdmap.1 +++ b/data/gdmap.1 @@ -9,7 +9,13 @@ gdmap [\fB\-?\fR|\fB--help\fR] .SH DESCRIPTION \fBGdMap\fR is a tool to display disk space using tree maps. + .LP +Each link to a file with +.I n +hard links gets credit for one +.IR n th +of its size. .SH OPTIONS diff --git a/src/tree.c b/src/tree.c index e380a576..bf611f31 100644 --- a/src/tree.c +++ b/src/tree.c @@ -186,6 +186,7 @@ static tree_t* tree_scan_rec(const char* dirname, const char* shortname, int dep { gint64 rsize = buf.st_size; gint64 ssize = buf.st_blocks * 512; + nlink_t linkcount = buf.st_nlink; if (S_ISREG(buf.st_mode) && ssize && ssize < rsize) { @@ -193,17 +194,17 @@ static tree_t* tree_scan_rec(const char* dirname, const char* shortname, int dep if (pref_get_use_reported_size()) { /* g_message("-reported: ("FF")", rsize); */ - return tree_new(shortname, rsize, depth); + return tree_new(shortname, rsize / linkcount, depth); } else { /* g_message("-on disk: ("FF")", ssize); */ - return tree_new(shortname, ssize, depth); + return tree_new(shortname, ssize / linkcount, depth); } } else { - return tree_new(shortname, rsize, depth); + return tree_new(shortname, rsize / linkcount, depth); } } } -- 1.7.10.rc1 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org