Why would I want symbolic links to be "followed"? How does this effect cd's behavior?

C

CrazedNerd

Guest
There's only a couple options for cd:

Code:
 -L    force symbolic links to be followed: resolve symbolic
            links in DIR after processing instances of `..'
      -P    use the physical directory structure without following
            symbolic links: resolve symbolic links in DIR before
            processing instances of `..'

what does this mean? Why/when does this matter?
 


CD rom's typically hold about 700MB.
DVD's typically hold about 4.7GB.

So let's say I make a filesystem about 4.5GB to copy to DVD.
However somewhere in that filesystem, I have symbolic link to an external directory that is 10GB in size.
If I "follow" that symbolic link. I going to try to put 14.5GB on 4.7GB DVD.
 
CD rom's typically hold about 700MB.
DVD's typically hold about 4.7GB.

So let's say I make a filesystem about 4.5GB to copy to DVD.
However somewhere in that filesystem, I have symbolic link to an external directory that is 10GB in size.
If I "follow" that symbolic link. I going to try to put 14.5GB on 4.7GB DVD.
Er.....no. No, I don't think so.

Your external directory that you've linked to remains at 10GB. What your sym-link does is merely to send you to that directory as though it were in the same location as the sym-link itself.

What makes you think that a burner would suddenly try to 'copy' that 10 GB directory? A burner program doesn't know what a sym-link is. It merely copies the data representing that link.....a very small amount of data, typically measured in bytes.

I've put together Puppy Linux .pet packages for my personal use that consist entirely of sym-links. Those .pet packages measure a few KB in size, at most......and that mostly representing the directory containing everything from which the .pet package has been created. The sym-links are virtually non-existent.....merely 'pointers' to a specific inode in the system.

I suspect you may be thinking of the Windoze 'hard link', which I believe does do more or less what you suggest.

-----------------------------------------------------

@CrazedNerd :- You have to understand that a great many people that write documentation for various computer-related stuff seem incapable of putting themselves in the user's shoes.....of trying to objectively look at what they've written from the point of view of those they're trying to explain things to.

Most people know what they themselves are talking about. But in too many cases, the user almost has to be a mind-reader to follow the author's train of thought. Writing clear, easy-to-follow-and-understand documentation is something of an art form. It's not a skill that's easy to learn.....and many people simply don't possess that skill.


Mike. ;)
 
Last edited:
MikeWalsh wrote:
A burner program doesn't know what a sym-link is.
Your point is well taken, and also the point about the challenge in writing documentation.
In the creation of the image to be burnt though, the sym links are fine.
From the genisoimage man page:
genisoimage is capable of generating the System Use Sharing Protocol records (SUSP) specified by the Rock Ridge Interchange Protocol. This is used to further describe the files in the ISO9660 filesystem to a Unix host, and provides information such as long filenames, UID/GID, POSIX permissions, symbolic links, and block and character device files.... -f Follow symbolic links when generating the filesystem.
 
Last edited:
Er.....no. No, I don't think so.

Your external directory that you've linked to remains at 10GB. What your sym-link does is merely to send you to that directory as though it were in the same location as the sym-link itself.

What makes you think that a burner would suddenly try to 'copy' that 10 GB directory? A burner program doesn't know what a sym-link is. It merely copies the data representing that link.....a very small amount of data, typically measured in bytes.

I've put together Puppy Linux .pet packages for my personal use that consist entirely of sym-links. Those .pet packages measure a few KB in size, at most......and that mostly representing the directory containing everything from which the .pet package has been created. The sym-links are virtually non-existent.....merely 'pointers' to a specific inode in the system.

I suspect you may be thinking of the Windoze 'hard link', which I believe does do more or less what you suggest.

-----------------------------------------------------

@CrazedNerd :- You have to understand that a great many people that write documentation for various computer-related stuff seem incapable of putting themselves in the user's shoes.....of trying to objectively look at what they've written from the point of view of those they're trying to explain things to.

Most people know what they themselves are talking about. But in too many cases, the user almost has to be a mind-reader to follow the author's train of thought. Writing clear, easy-to-follow-and-understand documentation is something of an art form. It's not a skill that's easy to learn.....and many people simply don't possess that skill.


Mike. ;)
Yeah, lots of technical writing is plagued by this, ive been learning bash and a pretty small percentage of writing on the topic is helpful.
 
I didn't think many people used CDs or DVDs these days.
t2627.gif
 
I didn't think many people used CDs or DVDs these days.
t2627.gif
You might be surprised, Bob. It's still just about the most bulletproof way to run any Linux distro securely; a 'Live' session isn't touching the hard-drive, as we all know.....and due to the 'read-only' nature of the ISO 9660 file-system used by optical drives, it cannot be modified or altered in any way, by malware or anything else.

Your own New South Wales police dept, at one time in the past, recommended something like a LiveCD of Puppy Linux to their population as being one of the most secure ways they knew of accessing online banking, for instance...



I know it's going back a few years, but it says something about the way Linux Live sessions work that even government departments endorse it. They probably chose Puppy because it was a 'home-grown' distro.....and I believe our revered 'PuppyMaster' - Barry Kauler - had at one point done a fair bit of security research work for the Australian government, back before Puppy was launched in 2004.


Mike. ;)
 
Last edited:
I think there's some confusion over what this thread is about...i'm talking about the command "cd", change directory, not the optical storage medium.
 
I think there's some confusion over what this thread is about...i'm talking about the command "cd", change directory, not the optical storage medium.
A-ha. Thanks for the clarification. I DID wonder about the sudden mention of optical drive burner programs trying to copy symbolic links..!

Mm. Symbolic links are usually one of two things. Either links originally installed as part of the OS itself.....in which case, you definitely want to allow them to be followed. Or, they can be there as links that you've created yourself.

In all cases, my previous info still stands. Symbolic links are 'pointers' (or shortcuts) to specific inodes in your system, and they act as though the 'linked' item is actually there in your current directory, instead of you having to traipse through the file-system to find it.

Absolute links, on the other hand, always give the full $PATH to the indicated location.

Does that help?


Mike. :)
 
A-ha. Thanks for the clarification. I DID wonder about the sudden mention of optical drive burner programs trying to copy symbolic links..!

Mm. Symbolic links are usually one of two things. Either links originally installed as part of the OS itself.....in which case, you definitely want to allow them to be followed. Or, they can be there as links that you've created yourself.

In all cases, my previous info still stands. Symbolic links are 'pointers' (or shortcuts) to specific inodes in your system, and they act as though the 'linked' item is actually there in your current directory, instead of you having to traipse through the file-system to find it.

Absolute links, on the other hand, always give the full $PATH to the indicated location.

Does that help?


Mike. :)
i know what a symbolic link is, that's not what i'm asking about. I'm wondering why someone wouldn't want to "follow" or resolve symbolic links when changing directories.
 
Everybody's getting a bit off track here.

With the cd builtin, the -P option causes the shell to cd into the target directory pointed to by the symbolic link and displays the physical location of the destination.

e.g.
Imagine you have a symbolic-link in your /home directory called projects.
So the path to the symbolic link will be:
/home/username/projects, or ~/projects.
And this symbolic link points to a directory on another mounted drive/device. e.g.
/media/username/BACKUPDRIVE/projects

If you use cd -P ~/projects to try to enter the directory, the shell will resolve the symbolic link and will move into the target directory. And the prompt will show the physical path to the destination. In other words - where you actually are in the file-system.
So in this imaginary case, the prompt would show our location as:
/media/username/BACKUPDRIVE/projects/

Whereas if you use cd -L ~/projects, or just plain old cd ~/projects, which performs the -L action by default anyway:
Then the shell will resolve the link, enter the target directory, but will display the path as if the projects directory was in your home folder.
So for this example, it would show the current path as:
/home/username/projects/ or ~/projects/.

In relation to the cd builtin, the -P option has nothing to do with not following links, or not entering directories that are symbolic links. It's more to do with if the directory we're cding into is a symbolic link, whether to display the path as the actual physical location of the destination (via -P), or whether to make it appear as if the linked directory is a child of the directory containing the symbolic link (the default -L option).
 
Everybody's getting a bit off track here.

With the cd builtin, the -P option causes the shell to cd into the target directory pointed to by the symbolic link and displays the physical location of the destination.

e.g.
Imagine you have a symbolic-link in your /home directory called projects.
So the path to the symbolic link will be:
/home/username/projects, or ~/projects.
And this symbolic link points to a directory on another mounted drive/device. e.g.
/media/username/BACKUPDRIVE/projects

If you use cd -P ~/projects to try to enter the directory, the shell will resolve the symbolic link and will move into the target directory. And the prompt will show the physical path to the destination. In other words - where you actually are in the file-system.
So in this imaginary case, the prompt would show our location as:
/media/username/BACKUPDRIVE/projects/

Whereas if you use cd -L ~/projects, or just plain old cd ~/projects, which performs the -L action by default anyway:
Then the shell will resolve the link, enter the target directory, but will display the path as if the projects directory was in your home folder.
So for this example, it would show the current path as:
/home/username/projects/ or ~/projects/.

In relation to the cd builtin, the -P option has nothing to do with not following links, or not entering directories that are symbolic links. It's more to do with if the directory we're cding into is a symbolic link, whether to display the path as the actual physical location of the destination (via -P), or whether to make it appear as if the linked directory is a child of the directory containing the symbolic link (the default -L option).
So it's all about how verbose we want it to appear?
 
So it's all about how verbose we want it to appear?
Kinda - it's like "Now we've followed a symbolic link , do you want to see where you actually are in the file-system? Or do you want to pretend that the link is a sub-directory of the directory containing the symbolic link?"

And the default action is to pretend we're in a sub-directory of the directory containing the symbolic link.
 
Kinda - it's like "Now we've followed a symbolic link , do you want to see where you actually are in the file-system? Or do you want to pretend that the link is a sub-directory of the directory containing the symbolic link?"

And the default action is to pretend we're in a sub-directory of the directory containing the symbolic link.
I tried this as a test, looking at the nautilus, bin is a symbolic link. Normally, if you change to bin, it just shows:

Code:
/bin

but if you put "cd -P /bin", then you get this instead:

Code:
/usr/bin
 
@CrazedNerd :-

I think I owe you an apology, like; sorry for dragging your thread off-topic. You can tell I don't use the terminal very much; I'm not a traditional keyboard jockey, who uses it all day long every day, as a matter of course. Fact of the matter is, I avoid it like the plague unless what I need can't be accomplished any other way!

The most use it gets with me is testing sections of scripts, to see if they do what they're supposed to do. I may have used Linux for nearly a decade, but I still like my GUIs too much. 30 some-odd years of Windoze will do that to ya. I get enormous satisfaction out of building GUIs with YAD. I haven't yet mastered gtk-dialog, despite it being built-in to most distros. I just find YAD easier to work with....

Again; apologies.


Mike. ;)
 
@CrazedNerd :-

I think I owe you an apology, like; sorry for dragging your thread off-topic. You can tell I don't use the terminal very much; I'm not a traditional keyboard jockey, who uses it all day long every day, as a matter of course. Fact of the matter is, I avoid it like the plague unless what I need can't be accomplished any other way!

The most use it gets with me is testing sections of scripts, to see if they do what they're supposed to do. I may have used Linux for nearly a decade, but I still like my GUIs too much. 30 some-odd years of Windoze will do that to ya. I get enormous satisfaction out of building GUIs with YAD. I haven't yet mastered gtk-dialog, despite it being built-in to most distros. I just find YAD easier to work with....

Again; apologies.


Mike. ;)
You dont need to apologize, but i appreciate your attempt to understand. I think your GUI finess with puppy linux is rather impressive.
 
You dont need to apologize, but i appreciate your attempt to understand. I think your GUI finess with puppy linux is rather impressive.
Heh. I don't know as it's THAT good, but graphic design has been a passion of mine, dating all the way back to my GCSE A-level days at school.....more years ago than I care to remember. The assembly of a 'portfolio' was an integral part of the Art A-level examination; mine included all sorts of stuff - portraits, posters, flyers, still-life....you were trying to demonstrate your versatility in multiple fields to the examiners.

I'm one of those rare individuals that likes a 'busy' desktop.....something going on, no matter where you look. The only part I source is the actual background, via countless Google & DuckDuckGo searches. The rest, including all the 'docks', is totally home-grown; a new desktop, from start to finish, takes me perhaps 2 hours or so. I don't see it as work; I enjoy it.

But thanks for the compliment, anyway. I shall now quit dragging your thread any further 'off-topic' than I've already done! :D


Mike. ;)
 
You might be surprised, Bob. It's still just about the most bulletproof way to run any Linux distro securely; a 'Live' session isn't touching the hard-drive, as we all know.....and due to the 'read-only' nature of the ISO 9660 file-system used by optical drives, it cannot be modified or altered in any way, by malware or anything else.



Mike. ;)

There are a number of things you can do with the Live session but I wouldn't use it for internet banking as was asked on another Forum because there are no updates...especially security ones.
happy0035.gif
 
@bob466 :-

Well, I think Puppy was suggested partly due to the unique way in which it runs.

Puppy may not regularly update like mainstream distros, but because every session starts in "virgin" form.....due to those read-only system files.....you're only going to collect any "nasties" during the course of that session. You certainly don't look to save it, and by using my Chrome-portable browser (you can run this from a flash drive) - which has its own built-in updater - you're very unlikely to get 'caught'.

Especially considering that you would only be online very briefly, AND that the vast majority of malware is still written for Windows. You'd be extremely unlucky if you DID get snagged by malware.

I'd still recommend it as a good way around the problem. Too many people worry themselves senseless over security updates. I don't go out of my way to try and avoid doing things I'm not 'supposed to', yet in over 8 years of Puppy use I have never once had any kind of security issue. In this respect, I believe Puppy gives you a unique kind of "freedom", not found in other distros.



Mike. ;)
 
Puppy is a great distro to use for banking because.

1. Can run a session without a save file - when finished reboot no evidence is left of your session.
2. Run from a live CD with same - no save file.
3. Run a Browser in chrooted environment meaning an even more secure environment.
 

Members online


Top