conda update spyder (or pip, if not using Anaconda)spyder --resetI have a few files which are either symbolic or hard links pointing to other files. Before I updated spyder from ~v.3 to the latest v.4.0.1 (from my anaconda distribution), if I modified and saved the symbolic/hard link, it also modified the other links pointing to the same file accordingly.
However, with v.4.0.1 if I modify a link (symbolic or hard, actually it does not matter), the link is "broken".
As an example, if I have a file test.py and a symbolic link in another directory also called test.py, if I open the sym link, update its content and then save it, it will no longer be a sym link, but instead a new python file called test.py.
The same applies for hard links, where the link no longer exists after the update (typically stat test.py would show 2 links before saving, and 1 after).
From what I have tried, just opening the file without modifying it does not break the link, only when saving the link no longer exists.
Not sure if it's a bug or the normal behaviour, but it definitely changed between ~v.3 and v.4.1.0.
ln -s test.py test2.py)ls -l test2.py (you should see at the end of the line something like test2.py -> test.py)ls -l test2.py (you should only see test2.py at the end of the line)Expected output would be that symbolic or hard links would not be broken, and that modifying one link would modify the content of all the other links pointing to the same file.
atomicwrites >=1.2.0 : 1.3.0 (OK)
chardet >=2.0.0 : 3.0.4 (OK)
cloudpickle >=0.5.0 : 1.3.0 (OK)
diff_match_patch >=20181111 : 20181111 (OK)
intervaltree : None (OK)
IPython >=4.0 : 7.12.0 (OK)
jedi =0.14.1 : 0.14.1 (OK)
keyring : None (OK)
nbconvert >=4.0 : 5.6.1 (OK)
numpydoc >=0.6.0 : 0.9.2 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=0.3 : 5.6.7 (OK)
pygments >=2.0 : 2.5.2 (OK)
pylint >=0.25 : 2.4.4 (OK)
pyls >=0.31.2;<0.32.0 : 0.31.7 (OK)
xdg >=0.26 : 0.26 (OK)
zmq >=17 : 18.1.1 (OK)
qdarkstyle >=2.7 : 2.8 (OK)
qtawesome >=0.5.7 : 0.6.1 (OK)
qtconsole >=4.6.0 : 4.6.0 (OK)
qtpy >=1.5.0 : 1.9.0 (OK)
rtree >=0.8.3 : 0.9.3 (OK)
sphinx >=0.6.6 : 2.4.0 (OK)
spyder_kernels >=1.8.1;<2.0.0: 1.8.1 (OK)
watchdog : None (OK)
cython >=0.21 : 0.29.15 (OK)
matplotlib >=2.0.0 : 3.1.3 (OK)
numpy >=1.7 : 1.18.1 (OK)
pandas >=0.13.1 : 1.0.1 (OK)
scipy >=0.17.0 : 1.4.1 (OK)
sympy >=0.7.3 : 1.5.1 (OK)
@andfoy please take a look at this one
@dalthviz, didn't you look at this before?
@ccordoba12 I'm not sure, I don't remember checking something regarding symlinks, but maybe this is do the use of atomicwrites in some way?
Edit: I was checking and regarding files saving I did a fix but it was to preserve file permission when saving - PR #9550
Edit: I was checking and regarding files saving I did a fix but it was to preserve file permission when saving - PR #9550
Ok, that was it!
@dalthviz, I think the usage of atomicwrites makes no possible to use symlinks, so we should forbid opening symlinks in the editor, even if that's a regression with respect to Spyder 3.
So please investigate first the possibility of working with symlinks and atomicwrites. If that's not possible, please add a warning message saying that it's not possible to open symlinks anymore to guarantee that files are saved correctly to disk.
Note: Probably we need to resolve symlinks when saving. We can use something like: os.readlink, os.path.realpath or pathlib.Path.resolve
I updated spyder to 4.1.2. This issue does not seem to be fixed..
Hi @juhang62 could you provide more info about your setup and the way the problem raises for you, please? Also, you are facing exactly the same circumstances than the OP of this issue?
We added a test for this so is quite strange that this is steal happening, but any info in order to reproduce the issue or understand it better is greatly appreciated :) I think a new issue explaining your circumstances could work better (maybe referencing this one)