Issues 1665 & 1666; Symbolic links & backups

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
flachyjoe
Veteran
Posts: 1869
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: Issues 1665 & 1666; Symbolic links & backups

Post by flachyjoe »

adrianinsaval wrote: Tue Jun 21, 2022 2:17 pm And what about a link to a link? is that handled by your code @flachyjoe ? I tried in bash an it is handled by cp
Yes
https://www.boost.org/doc/libs/1_66_0/libs/filesystem/doc/reference.html#canonical wrote: Overview: Converts p, which must exist, to an absolute path that has no symbolic link, dot, or dot-dot elements.
https://www.boost.org/doc/libs/1_66_0/libs/filesystem/doc/reference.html#weakly_canonical wrote:Overview: Returns p with symlinks resolved and the result normalized.
Returns: A path composed of the result of calling the canonical function on a path composed of the leading elements of p that exist, if any, followed by the elements of p that do not exist, if any.
- Flachy Joe -
Image
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Issues 1665 & 1666; Symbolic links & backups

Post by adrianinsaval »

It would be nice to see an implementation of the copy then delete method that openbrain proposed, it might also fix an issue I recently discussed about icloud: https://forum.freecadweb.org/viewtopic.php?f=8&t=68404
User avatar
flachyjoe
Veteran
Posts: 1869
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: Issues 1665 & 1666; Symbolic links & backups

Post by flachyjoe »

- Flachy Joe -
Image
User avatar
flachyjoe
Veteran
Posts: 1869
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: Issues 1665 & 1666; Symbolic links & backups

Post by flachyjoe »

Hi,
openBrain wrote: Tue Jun 21, 2022 7:36 pm Sorry missed your post
Zolko wrote: Tue Jun 21, 2022 4:27 pm if doc.FCStd is read-only, then you can't do this copy (at least not in the shell)
Yes, that's why it fixes also the read-only issue. ;)
FYI :
https://www.boost.org/doc/libs/1_53_0/libs/filesystem/doc/reference.html#symlink_perms wrote: On ISO/IEC 9945 permissions() resolves symlinks unless symlink_perms is specified. Meaningless on Windows as permissions() never resolves symlinks. Meaningless on Mac OS X and some other BSD systems as permissions() always resolves symlinks. Get over it.
So the source file can be read-only even if the symlink is not and vice-versa. :?
- Flachy Joe -
Image
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Issues 1665 & 1666; Symbolic links & backups

Post by adrianinsaval »

Get over it.
:lol: that many people went complaining to the boost people huh? anyways, IMO it's the target's permissions that matter, does freecad check the file permissions at any moment? Also, what's the point of having permissions at all if in the end the program can decide if it respects them or not?
User avatar
flachyjoe
Veteran
Posts: 1869
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: Issues 1665 & 1666; Symbolic links & backups

Post by flachyjoe »

Proposal : https://github.com/FreeCAD/FreeCAD/comp ... t_readonly

EDIT : not ready yet… :oops:

EDIT2 : It seems ok. Please test :geek:
- Flachy Joe -
Image
User avatar
flachyjoe
Veteran
Posts: 1869
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: Issues 1665 & 1666; Symbolic links & backups

Post by flachyjoe »

Hi,
I've added a backup rotation so FCStd1 is always the oldest.

Changes are in this branch, I'll clean it for PR if you're ok.
- Flachy Joe -
Image
Post Reply