Ticket #3278 (new defect)

Opened 5 years ago

Last modified 5 years ago

Info panel should follow symlinks

Reported by: mcermak Owned by:
Priority: minor Milestone: Future Releases
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

When an info panel is shown, the file system statistics are not correct after passing through a symlink. When one goes through a symlink (to a directory) crossing to a different file system, the statistics in the info panel won't change, still showing the original file system data.
Let's have a file system /home and file system /export/data. In /home/mcermak, there is a symlink my_work to /export/data/my_work. When a user goes from /home/mcermak through my_work symlink to /etc/data/my_work, the statistics in the info panel won't change and will keep showing data for /home.
One can easily get different information for /home/mcermak/my_work and /export/data/my_work even though those point a same directory.

# mc -V
GNU Midnight Commander 4.8.13
Built with GLib 2.28.6
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm
With support for X11 events
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, fish
Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;

This is because the statistics obtaining function my_statfs() in filemanager/mountlist.c is passed the current path which is /home/mcermak/my_work and searches through the mount point table using string matching.
To get the correct data, the path needs to be resolved to an absolute path (without dots or symlinks). On Solaris, realpath() library function can do the resolution.

Attachments

infopanel-follow-symlinks.patch (1.6 KB) - added by mcermak 5 years ago.

Change History

Changed 5 years ago by mcermak

comment:1 in reply to: ↑ description ; follow-up: ↓ 2 Changed 5 years ago by andrew_b

Replying to mcermak:

Info panel should follow symlinks

I'm not sure about that. Info panel shows statistics about filesystem where file (symlink) is located in, not about filesystem where file (symlink) points to. We shouldn't confuse user. Or, alternatively, some option to restore the previous behavior should be provided.

comment:2 in reply to: ↑ 1 Changed 5 years ago by mcermak

Replying to andrew_b:

Replying to mcermak:

Info panel should follow symlinks

I'm not sure about that. Info panel shows statistics about filesystem where file (symlink) is located in, not about filesystem where file (symlink) points to. We shouldn't confuse user. Or, alternatively, some option to restore the previous behavior should be provided.

It's not in the situation when the symlink is highlighed in the list. Yes, in that case, the statistics should show the /home file system (following the example above).
When a user presses Enter (and accesses the symlink), then the path changes to /home/mcermak/my_work, the list shows content of /export/data/my_work and the infopanel shows statistics of /home file system. This is what does not seem right to me.
What is the capacity and usage of /home/mcermak/my_work? It's not the one of /home.

Note: See TracTickets for help on using tickets.