Fedora Linux Support Community & Resources Center
Old 19th June 2008, 04:49 PM
bnorman Offline
Registered User
Join Date: Jun 2008
Posts: 3
"ls" and "cd" treat ".." differently inside symlinked directories

First, let me say that I'm really enjoying using Fedora 9. Thanks for a great distribution!

Now the problem: I've been using Linux daily for well over a decade, and this is new to me.

My development tree fails miserably now due to what seems like very strange behavior with symlinks. I notice this on both i386 and x86_64 Fedora 9 (just updated this morning, June 19).

When you've reached a directory using a symlink and then use ".." from within that tree, the interpretation of ".." is different depending on the command. See the following example:

[bnorman@localhost level1]$ ls -lR
total 4
drwxrwxr-x 3 bnorman bnorman 4096 2008-06-19 08:37 level2
lrwxrwxrwx 1 bnorman bnorman   13 2008-06-19 08:38 link3 -> level2/level3

total 4
drwxrwxr-x 2 bnorman bnorman 4096 2008-06-19 08:37 level3

total 0
[bnorman@localhost level1]$ cd link3
[bnorman@localhost link3]$ ls ..
[bnorman@localhost link3]$ cd .. ; ls ; cd -
level2  link3
[bnorman@localhost link3]$ ls '..'
[bnorman@localhost link3]$ cd '..' ; ls ; cd -
level2  link3
[bnorman@localhost link3]$
So as an argument to ls, ".." follows the true directory structure. As an argument to "cd", it follows the symbolic path that was used to get to the current directory. gcc unfortunately also follows the true directory structure when parsing include and library paths, as well.

I know this is not a gcc or ls problem per se; what library do they use to parse paths? The problem is the same under bash or tcsh. It is also the same on ext3 or ntfs partitions. Any suggestions?

EDIT: "cd" is a shell builtin, and "ls" is a binary.


Last edited by bnorman; 19th June 2008 at 08:56 PM.
Reply With Quote

differently, directories, inside, symlinked, treat

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW TO MOUNT "C" "D" "E" LOCAL HARDDISK PARTITION ketan_hk Using Fedora 6 6th September 2007 01:10 AM
Metacity and "Xlib: extension "SHAPE" missing on display ":0.0". debu_sagii Using Fedora 0 29th August 2007 05:53 PM
Fglrx driver install - "direct rendering: No", Xlib: extension "XFree86-DRI" missing Squeaks Hardware & Laptops 9 21st October 2006 12:10 PM
Error:visibility arg must be one of "default", "hidden", "protected" or "internal" wangfeng Using Fedora 0 23rd May 2005 04:59 AM
Scroll down to the last line by "end" key in "less" using "Terminal GNOME&q Szpak Using Fedora 0 7th June 2004 02:24 AM

Current GMT-time: 02:13 (Saturday, 23-09-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat