in reply to Re^3: cleaning up absolute path without resolving symlinks
in thread cleaning up absolute path without resolving symlinks
Here's how it fits in.
On your shell.. Imagine you are user 'bubba'..
mkdir /home/bubba/served mkdir /etc/a touch /etc/a/filehere ln -s /etc/a /home/bubba/served/a
Now for perl..
#!/usr/bin/perl -w use Cwd; use strict; for (qw( /home/bubba/served /home/bubba/served/a /home/bubba/served/a/filehere )){ printf "$_ = %s\n",Cwd::abs_path($_); }
You get
bubba#mescaline# perl script.pl /home/bubba/served = /home/bubba/served /home/bubba/served/a = /etc/a /home/bubba/served/a/filehere = /etc/a/filehere
I don't know if people using this in the future will be mounting directly to /home/bubba/served , in fact, I'm pretty sure they will not. Things will be mounted somewhere and likely symlinked to /home/bubba/served. ( I believe hard links don't work accross filesystems.. haha).
What the program needs to verify is that whatever the file is, it is 'within' the hierarchy of /home/bubba/served. This is why resolving symlinks won't cut it.
|
|---|