Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] App::Link breaks when opening a Symlinked FCStd #7596

Open
2 tasks done
Tracked by #12907
leoheck opened this issue Oct 11, 2022 · 13 comments
Open
2 tasks done
Tracked by #12907

[Bug] App::Link breaks when opening a Symlinked FCStd #7596

leoheck opened this issue Oct 11, 2022 · 13 comments
Labels
Bug This issue or PR is related to a bug Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD

Comments

@leoheck
Copy link

leoheck commented Oct 11, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Forums discussion

https://forum.freecadweb.org/viewtopic.php?f=3&t=72491#p632344

Version

0.21 (Development)

Full version info

OS: Ubuntu 22.04.1 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.21.30492 (Git) AppImage
Build type: Release
Branch: master
Hash: b4578fb3eae842eb510a1bc055d07d369a67ce94
Python 3.10.6, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * Defeaturing 1.2.0
  * A2plus 0.4.59c
  * Curves 0.5.8
  * fasteners 0.4.12
  * lattice2 1.0.0
  * Assembly4 0.12.4
  * kicadStepUpMod 10.15.1
  * Help 1.0.3

Subproject(s) affected?

No response

Issue description

When a Symlinked file is opened with Freecad, if it is not in the same folder with it's target (which is most of the time the case) the links to the linked files inside the file doesn't work anymore, since they are not relative to the path of the symlink.

A simple solution would follow the symbolic link to open the actual file, instead, when the given file is a symlink.

Anything else?

Discussion started here Zolko-123/FreeCAD_Assembly4#370 (comment)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@leoheck
Copy link
Author

leoheck commented Oct 11, 2022

A simple solution would follow the symbolic link to open the actual file, instead, when the given file is a symlink.

And maybe, iterate since multi-symlink levels may exist.

@luzpaz
Copy link
Contributor

luzpaz commented Oct 15, 2022

I seem to recall an pre-existing issue regarding symlinks....brb

Edit: indeed the original issue (#5592) is now closed. It was closed in #7034 by @FlachyJoe

@luzpaz luzpaz added Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Bug This issue or PR is related to a bug labels Oct 15, 2022
@Zolko-123
Copy link
Contributor

This is not a [Bug] but the very nature of symlinks. If the user needs the linked (as per App::Link I guess) file to open correctly he has to symlink the linked file into the same folder.

This issue should be closed

@leoheck
Copy link
Author

leoheck commented Oct 24, 2022

No, this is a bug. When you symlink a file, and since Freecad does not adjust paths internally, Freecad should open the target instead. This behavior would solve anything.

@luzpaz
Copy link
Contributor

luzpaz commented Apr 13, 2023

@FlachyJoe care to weigh-in ?

@luzpaz
Copy link
Contributor

luzpaz commented Sep 27, 2023

CC @FlachyJoe

@FlachyJoe
Copy link
Contributor

@luzpaz this issue is about App::Links in a symlinked file. I can't see relation with save problem in junction.
Also, I have no knowledge about App::Link, so I can't do anything for this problem.

@luzpaz
Copy link
Contributor

luzpaz commented Sep 28, 2023

@leoheck just out of curiousity, does realthunder's branch address this issue ?

@leoheck
Copy link
Author

leoheck commented Sep 28, 2023

Sorry @luzpaz I have never used this branch. Unfortunately, I can't answer this.

@luzpaz luzpaz changed the title [Bug] Links break when opening a Symlinked FCStd [Bug] App::Link breaks when opening a Symlinked FCStd Sep 28, 2023
@luzpaz
Copy link
Contributor

luzpaz commented Sep 28, 2023

@realthunder do you have a moment to weigh-in on this ? (specifically since you were involved with App::Link code)

@adrianinsaval
Copy link
Member

I tend to agree with zolko that this does not seem like a bug.

realthunder added a commit to realthunder/FreeCAD that referenced this issue Oct 14, 2023
Added PathResolveMode in PropertyXLink to define four mode of path
resolve.

* Dynamic (default). Resolve the path realtive to the current file path
  of the owner document. In case the file cannot be found, fallback by
  searching through any symlinks inside owner document path.

* Relative. Resolve the path relative to the file path of the owner
  documents without fallback

* RelativeCanonical. Resolve  the path relative to the canoncal path
  (i.e. the true location) of the owner document.

* Absolute. Save and load from the absoluate path of the linked file.

* Canonical. Save and load from the canonical path of the linked file.

Closes FreeCAD#7596
@luzpaz
Copy link
Contributor

luzpaz commented Oct 15, 2023

Anyone able to test realthunder's PR ?

@adrianinsaval
Copy link
Member

others also share the view that is no real bug but normal behavior with symlinks:
#11037 (comment)
#11037 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This issue or PR is related to a bug Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD
Projects
None yet
Development

No branches or pull requests

5 participants