On 12/03/2013 03:35 PM, Bernhard Voelker wrote:
> On 12/03/2013 03:35 PM, Pádraig Brady wrote:
>> On 11/22/2013 01:52 AM, Pádraig Brady wrote:
>>> On 11/12/2013 07:45 AM, Bernhard Voelker wrote:
>>>> Isn't that what the findmnt(8) command achieves with
>>>> the -S,--source option, i.e. it's not only about dereferencing
>>>> per se but rather telling the tool that we're searching for
>>>> the source of a mount instead of the target?
>>>>
>>>> Therefore, I think making the changes in get_point() is abusing the
>>>> semantics of that function. Instead, get_disk() should be enhanced
>>>> in a similar way as in get_point() via canonicalize_file_name().
>>>
>>> Makes sense.
>>>
>>>> Another question is if such behavior could/should be made the default
>>>> or if a new option has to be introduced.
>>>
>>> I'd make it default to dereference. No new options needed I think.
>>
>> This would be appropriate for the imminent release I think.
>> I'll have a look later if you've no time.
>
> That would have been the next item I planned to work on, but if you're
> in a hurry for the snapshot release, then I'm also fine if you do it.
> So the question is: when would you like to do the release?
OK cool.
I hope to release a snapshot later on this evening,
and will include something like the following
after testing/thinking a bit about it.
thanks,
Pádraig.
diff --git a/src/df.c b/src/df.c
index f6ce79d..175e875 100644
--- a/src/df.c
+++ b/src/df.c
@@ -1056,6 +1056,11 @@ get_disk (char const *disk)
{
struct mount_entry const *me;
struct mount_entry const *best_match = NULL;
+ cchar const *file = disk;
+
+ char *resolved = canonicalize_file_name (disk);
+ if (resolved && resolved[0] == '/')
+ disk = resolved;
for (me = mount_list; me; me = me->me_next)
{
@@ -1063,9 +1068,11 @@ get_disk (char const *disk)
best_match = me;
}
+ free (resolved);
+
if (best_match)
{
- get_dev (best_match->me_devname, best_match->me_mountdir, disk, NULL,
+ get_dev (best_match->me_devname, best_match->me_mountdir, file, NULL,
best_match->me_type, best_match->me_dummy,
best_match->me_remote, NULL, false);
return true;