Message288467
When using bash, the `cd` function does not follow symlinks by default, but `cd -P` does. The `os.chdir` function behaves like `cd -P` preventing to be able to change directory to a symlink folder.
Initial setup (make a `/tmp/to/dst` symlink pointing to `/tmp/from/src`):
cd /tmp
mkdir from from/src to
ln -s ../from/src to/dst
Here is an example, when using python's `os.chdir` function:
[fabien@asus ~]$ python
>>> import os
>>> os.chdir('/tmp/to/dst')
>>> os.system('/usr/bin/pwd')
/tmp/from/src
0
>>> os.system('/usr/bin/pwd -P')
/tmp/from/src
0
>>> os.system('/usr/bin/pwd -L')
/tmp/from/src
0
>>> os.getcwd()
'/tmp/from/src'
>>>
And here is an example when the folder is first changed with bash:
[fabien@asus ~]$ cd /tmp/to/dst/
[fabien@asus dst]$ python
>>> import os
>>> os.system('/usr/bin/pwd')
/tmp/from/src
0
>>> os.system('/usr/bin/pwd -P')
/tmp/from/src
0
>>> os.system('/usr/bin/pwd -L')
/tmp/to/dst
0
>>> os.getcwd()
'/tmp/from/src'
>>> |
|
Date |
User |
Action |
Args |
2017-02-23 18:40:29 | StreakyCobra | set | recipients:
+ StreakyCobra |
2017-02-23 18:40:29 | StreakyCobra | set | messageid: <1487875229.83.0.0508905375261.issue29635@psf.upfronthosting.co.za> |
2017-02-23 18:40:29 | StreakyCobra | link | issue29635 messages |
2017-02-23 18:40:29 | StreakyCobra | create | |
|