After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 394577 - Add a function to resolve symlinks
Add a function to resolve symlinks
Status: RESOLVED DUPLICATE of bug 111848
Product: glib
Classification: Platform
Component: general
2.10.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
: 558445 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-01-09 11:02 UTC by Bastien Nocera
Modified: 2012-12-18 17:02 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Bastien Nocera 2007-01-09 11:02:26 UTC
A mix of canonicalize_filename() (as existing in gtkfilesystemunix.c), and a g_file_read_link() loop.
Comment 1 Bastien Nocera 2007-01-09 11:05:03 UTC
On glibc systems, one can use "realpath()" with the second argument being NULL, but it will crash on systems with non-GNU libcs.

See bug 394505 for the original report.

We could call it g_file_resolve_link ()
Comment 2 Matthias Clasen 2008-11-04 02:35:41 UTC
*** Bug 558445 has been marked as a duplicate of this bug. ***
Comment 3 Matthias Clasen 2010-08-26 04:29:05 UTC
gio provides g_file_resolve_relative_path
Comment 4 Bastien Nocera 2010-08-26 12:59:03 UTC
g_file_resolve_relative_path() isn't quite it, as you still need to use g_file_read_link() to read the link destination.

g_file_resolve_link() would read where the link points to, resolve it, check whether it is a link, etc. taking care of link loops as well.
Comment 5 Christian Dywan 2010-09-24 16:13:01 UTC
Did you have a look at bug 111848? The proposed function has an option to resolve symbolic links.
Comment 6 Bastien Nocera 2012-12-18 17:02:10 UTC
It does indeed, and would fix the problem for me.

*** This bug has been marked as a duplicate of bug 111848 ***