Addon BoltsFC can no longer be installed/updated

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Addon BoltsFC can no longer be installed/updated

Post by uwestoehr »

In current FC 0.19 I can no longer update or install the addon BoltsFC. When trying this in the addon manager, nothing happens while I see in the report window:

Code: Select all

  File "D:\FreeCAD-build\Mod\AddonManager\addonmanager_workers.py", line 616, in run
    utils.symlink(os.path.join(clonedir, f), os.path.join(macro_dir, f))
  File "D:\FreeCAD-build\Mod\AddonManager\addonmanager_utilities.py", line 72, in symlink
    os_symlink(source, link_name)
OSError: symbolic link privilege not held
Other addons I tested (e.g. Fasteners) are not affected.
Could it be a bug in BoltsFC itself?

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18504 (Git)
Build type: Release
Branch: master
Hash: f66023a646db4b2502bb3637897443b3525ca3c7
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
Last edited by uwestoehr on Thu Oct 10, 2019 10:08 am, edited 1 time in total.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Addon BoltsFC can no longer be installed/updated

Post by vocx »

uwestoehr wrote: Thu Oct 10, 2019 12:15 am ...

Code: Select all

    os_symlink(source, link_name)
OSError: symbolic link privilege not held
...
Could it be a bug in BoltsFC itself?
...
I cannot reproduce in an Ubuntu Linux system. I tested installing and reinstalling the workbench several times and it worked fine.

Now, the error message you seem to be getting is about symbolic links. Traditionally symbolic links are a feature of Unix systems, but not of Windows. I haven't looked at the code of the Addon Manager so I don't know how it implements this os_symlink() function. However, I think the problem is probably elsewhere as you said other workbenches install correctly.

If I were to guess, I'd say it's a problem of permissions in Windows.
Privlege error trying to create symlink using python on windows 10
Eryk Sun wrote: If UAC is enabled and your user is an administrator, then the Local Security Authority (LSA, hosted in lsass.exe) logs your user on with a restricted access token. For this token, the BUILTIN\Administrators group is used only for denying access; the integrity-level label is medium instead of high; and the privileges typically granted to an administrator have been filtered out.

To create a symbolic link, you need to create the process using your unrestricted/elevated access token (i.e. elevated from medium to high integrity level). Do this by right-clicking and selecting "Run as administrator". This elevated token will be inherited by child processes, so it suffices to run your Python script from an elevated command prompt, which you can open via the keyboard shortcut Win+X A. You can verify that the cmd shell is elevated by running whoami /priv and checking for the presence of SeCreateSymbolicLinkPrivilege. Don't be alarmed if the state is disabled. The Windows CreateSymbolicLink function automatically enables this privilege.

That said, since you're creating a directory symbolic link, then perhaps a junction will work just as well. No special privilege is required to create a junction. You can create a junction using cmd's mklink command. For example:

subprocess.check_call('mklink /J "%s" "%s"' % (link, target), shell=True)
Maybe the Addon Manager needs to be modified a bit to handle symbolic links better in Windows.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
Roy_043
Veteran
Posts: 8552
Joined: Thu Dec 27, 2018 12:28 pm

Re: Addon BoltsFC can no longer be installed/updated

Post by Roy_043 »

The problem also occurs in V0.18:

Code: Select all

OS: Windows 8.1
Word size of OS: 64-bit
Word size of FreeCAD: 32-bit
Version: 0.18.16093 +38 (Git)
Build type: Release
Branch: (HEAD detached at 0.18.3)
Hash: 3129ae4296e40ed20e7b3d460b86e6969acbe1c3
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: Dutch/Netherlands (nl_NL)
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Addon BoltsFC can no longer be installed/updated

Post by uwestoehr »

Thank you for testing. So it is a BoltsFC issue that occurs only on Windows.
I opened now a bugreport to BoltsFC:
https://github.com/boltsparts/BOLTS/issues/206
Syres
Veteran
Posts: 2900
Joined: Thu Aug 09, 2018 11:14 am

Re: Addon BoltsFC can no longer be installed/updated

Post by Syres »

uwestoehr wrote: Thu Oct 10, 2019 10:10 am So it is a BoltsFC issue that occurs only on Windows.
It downloads and installs fine on my Windows build but you haven't stated whether you are using GitPython, I'm not. Therefore using the standard HTML zip download works OK here.


OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18504 (Git)
Build type: Release
Branch: master
Hash: f66023a646db4b2502bb3637897443b3525ca3c7
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Addon BoltsFC can no longer be installed/updated

Post by sgrogan »

"fight the good fight"
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Addon BoltsFC can no longer be installed/updated

Post by uwestoehr »

Syres wrote: Thu Oct 10, 2019 10:51 am It downloads and installs fine on my Windows build but you haven't stated whether you are using GitPython, I'm not. Therefore using the standard HTML zip download works OK here.
I don't understand. I just use the addon manager and try to install BoltsFC. This fails on Win 10 and Win 7 with FC 0.18 and FC 0.19git.

OK, if you have admin permissions, then the symlink can be established without problems and that's why you don't see the problem.
Last edited by uwestoehr on Thu Oct 10, 2019 11:40 am, edited 1 time in total.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Addon BoltsFC can no longer be installed/updated

Post by uwestoehr »

I don't understand the solutions proposed there because I don't see the need of a symlink at all. There is the AppData directory of FC that holds all addon files. So all files can be copied there and no symlink to them is necessary. I checked now and BoltsFC is the only addon so far that tries to establish a symlink.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Addon BoltsFC can no longer be installed/updated

Post by vocx »

uwestoehr wrote: Thu Oct 10, 2019 11:39 am ... I checked now and BoltsFC is the only addon so far that tries to establish a symlink.
Correct. I would say this is a bad design decision by BOLTSFC. It is a "workbench", but to launch it you have to run a macro. This doesn't make sense. It is like this for historical reasons. The original BOLTS was created around 2013 when FreeCAD didn't have an Addon Manager, and there wasn't a standardized way of installing extensions.

I think the proper way to solve this issue is to encapsulate the code of the start_bolts.FCMacro into a proper function in the workbench, and then provide a menu, toolbar and buttons. Then it will become a proper installable workbench, like BIM or Dodo, for example.
bernd wrote: ping
What do you think Bernd? I haven't looked at the code of start_bolts, but I imagine it isn't very complex. It probably just creates the graphical interface with all the elements that can be inserted.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Addon BoltsFC can no longer be installed/updated

Post by sgrogan »

Bolts is actually a module that requires a starter macro. If you get it working you will see that it lives in a side bar and stays active when switching to other workbenches. One version of workfeature works the same.

On Win7 there is no way to add a simlink without admin privileges. If you run FreeCAD as admin the simlink will be created. Another possibility is to copy the starter macro to your macro directory. I think this is handled by the fall back .zip installation but is not handled for the gitpython installation method. It could be added, special logic for updating would also be required.

For Win10 my first link has a proposed solution, I can't test because I'm still on Win7.

The symlink is the preferred method on linux because it's not common to have two copies of the same file when the file can just be symlinked. And yes Bolts pre-dates the addons, but it wasn't meant to be a workbench, but rather a tool that could be used from many workbenches.
"fight the good fight"
Post Reply