Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Fork Polkit to remove SpiderMonkey dependency
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
NTU
Apprentice
Apprentice


Joined: 17 Jul 2015
Posts: 187

PostPosted: Wed Jan 30, 2019 1:43 am    Post subject: Fork Polkit to remove SpiderMonkey dependency Reply with quote

Hi everyone,

I stripped out all the JavaScript code in Polkit so you don't need SpiderMonkey (removes JavaScript support) for it anymore. I just wanted your input on this one change:
Code:
authority = POLKIT_BACKEND_AUTHORITY (g_object_new (POLKIT_BACKEND_TYPE_JS_AUTHORITY, NULL));

to:
Code:
authority = POLKIT_BACKEND_AUTHORITY (g_object_new (POLKIT_BACKEND_TYPE_AUTHORITY, NULL));

I'm not sure if this correct, but since Polkit is the only thing that requires SpiderMonkey, and "JavaScript" and "authentication manager" don't really fit, I pulled it. I don't want SpiderMonkey on my system anyway if I can help it, the Mozilla developers say it's not an official project anyway and it's incomplete.

Original code:
https://cgit.freedesktop.org/polkit/tree/src/polkitbackend/polkitbackendauthority.c#n1434 (top of page)

Is using POLKIT_BACKEND_TYPE_AUTHORITY right in this case?

Thank you!
Back to top
View user's profile Send private message
NTU
Apprentice
Apprentice


Joined: 17 Jul 2015
Posts: 187

PostPosted: Fri Feb 01, 2019 6:12 am    Post subject: Reply with quote

After digging through the code more, that line is fine but now I need to figure out how to write this rule:

https://cgit.freedesktop.org/polkit/tree/src/polkitbackend/50-default.rules

In Python and have Polkit use it via GObjectIntrospection.

In the documentation:

https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html

It mentions, "the libpolkit-gobject-1 library wraps the polkit D-Bus API and is usable from any C/C++ program as well as higher-level languages supporting GObjectIntrospection such as Javascript and Python" but there are no examples I can find about writing a Polkit rule in Python.

Thank you!

Edit: Polkit rules cannot be written in Python. https://lists.freedesktop.org/archives/polkit-devel/2019-February/000591.html

Edit 2: Found this: https://github.com/magcius/polkit/tree/duktape I think my best option here is to update that tree to use Duktape to 2.3.0 against latest HEAD checkout of Polkit if I want to get away from SpiderMonkey. Duktape was designed to be embedded. Polkit rules are simple and only a few lines anyway, you don't need a massive JS engine from Firefox.
Back to top
View user's profile Send private message
Oschtan
n00b
n00b


Joined: 27 Dec 2008
Posts: 71
Location: Russia, Novosibirsk

PostPosted: Wed Jun 26, 2019 4:43 am    Post subject: Reply with quote

Earlier we have xulrunner compiled just for the sake of NPAPI header files. Now we compile spidermonkey just for the sake of polkit rules. Tomorrow they will say that duktape is outdated. Why is it easier if you can put the whole gentoo tree? Nobody needs anything.
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Wed Oct 09, 2019 1:12 am    Post subject: Reply with quote

You're absolutely right. Polkit and Spidermonkey are a nightmare - and it's time to get rid of them!

They say polkit is about security. But I never understood how it works or how to configure it. And a large chain of other packages depend on polkit, making it even more obscure. But obscurity doesn't mean security -- obscurity means insecurity!

I use systemd and Weston as DE. I use some KDE programs like Konsole or Kate and some GTK programs like Firefox or Thunderbird. No matter what I tried to get rid of udisks and polkit, one of those packages always pulled them back in.

Then I realized that I have to install udisks, polkit & friends, but I don't have to run them. So udisks and polkit were installed on my machine, but the daemons were disabled and they didn't run.

Today I managed to get completely rid of udisks, polkit, Spidermonkey & friends. I added the lines below to packages.provided:
Code:
sys-auth/polkit-0.115-r4
sys-fs/udisks-2.8.2
sys-auth/polkit-qt-0.112.0_p20160416-r2
kde-plasma/polkit-kde-agent-5.16.5

After that I removed those packages and ran 'emerge --depclean'. I was happy to see that udisks, polkit, Spidermonkey & friends were gone.

A few libraries were preserved, because kauth depended on some sys-auth/polkit-qt libraries. I re-emerged kauth - and the preserved libs were gone.

And now I'm happy that I have a machine without udisks, polkit and Spidermonkey - and everything works nicely. :)
Back to top
View user's profile Send private message
saski4711
Apprentice
Apprentice


Joined: 24 Jun 2004
Posts: 202

PostPosted: Fri Sep 18, 2020 6:10 am    Post subject: Reply with quote

any progress towards making this suitable for general usage?
Back to top
View user's profile Send private message
mirekm
Apprentice
Apprentice


Joined: 12 Feb 2004
Posts: 219
Location: Gliwice

PostPosted: Fri Sep 18, 2020 6:35 am    Post subject: Reply with quote

There is project using duktape instead of spidermonkey.
You can find ebuilds in pentoo overlay.
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2896

PostPosted: Fri Sep 18, 2020 12:20 pm    Post subject: Reply with quote

mirekm wrote:
There is project using duktape instead of spidermonkey.
If want to keep track of addition status for official ::gentoo see bug #734326 and the upstream PR which unfortunately seems to be a bit deadlocked right now (but still seeing interest).

On another note, ~testing =spidermonkey-78.2.0 no longer need python2.7 to build (albeit requires rust now), most other >=78 mozilla-based ebuilds "should" be moving away from the py2 dependency soon'ish as well.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3472
Location: Canada

PostPosted: Sat Nov 07, 2020 7:47 am    Post subject: Reply with quote

Ionen wrote:


On another note, ~testing =spidermonkey-78.2.0 no longer need python2.7 to build (albeit requires rust now)


and llvm
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3999

PostPosted: Sat Nov 07, 2020 8:24 am    Post subject: Reply with quote

mirekm wrote:
There is project using duktape instead of spidermonkey.
You can find ebuilds in pentoo overlay.
Just got removed: commit.
Alternatively, miramir overlay may still fit, untested here.
Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3999

PostPosted: Sat Nov 07, 2020 8:26 am    Post subject: Reply with quote

Ionen wrote:
mirekm wrote:
There is project using duktape instead of spidermonkey.
If want to keep track of addition status for official ::gentoo see bug #734326 and the upstream PR which unfortunately seems to be a bit deadlocked right now (but still seeing interest).

On another note, ~testing =spidermonkey-78.2.0 no longer need python2.7 to build (albeit requires rust now), most other >=78 mozilla-based ebuilds "should" be moving away from the py2 dependency soon'ish as well.
Code:
* dependency graph for dev-lang/spidermonkey-68.12.0
 `--  dev-lang/spidermonkey-68.12.0  amd64
   `--  dev-libs/icu-67.1  (>=dev-libs/icu-63.1) amd64
   `--  dev-libs/nspr-4.29  (>=dev-libs/nspr-4.21) ~amd64
   `--  sys-libs/readline-8.0_p4  (sys-libs/readline) amd64
   `--  sys-libs/zlib-1.2.11-r2  (>=sys-libs/zlib-1.2.3) amd64
   `--  dev-lang/python-2.7.18-r4  (dev-lang/python) amd64
   `--  dev-lang/python-3.9.0  (dev-lang/python) amd64
   `--  dev-lang/python-3.8.5  (dev-lang/python) amd64
   `--  dev-lang/python-3.7.9  (dev-lang/python) amd64
   `--  dev-lang/python-3.6.12  (dev-lang/python) amd64
   `--  app-portage/elt-patches-20170815  (>=app-portage/elt-patches-20170815) amd64
   `--  sys-devel/automake-1.16.1-r1  (>=sys-devel/automake-1.16.1) amd64
   `--  sys-devel/automake-1.15.1-r2  (>=sys-devel/automake-1.15.1) amd64
   `--  sys-devel/autoconf-2.13-r1  (~sys-devel/autoconf-2.13) amd64
   `--  sys-devel/libtool-2.4.6-r6  (>=sys-devel/libtool-2.4) amd64
[ dev-lang/spidermonkey-68.12.0 stats: packages (15), max depth (1) ]
seems the low limit here.
Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3472
Location: Canada

PostPosted: Sat Nov 07, 2020 5:16 pm    Post subject: Reply with quote

I'll take python-2.7 dependency over rust+llvm+300 Mb spidermonkey-78 (versus 32Mb for 60) just to run polkit, anytime

Last edited by dmpogo on Sat Nov 07, 2020 5:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
Perfect Gentleman
Veteran
Veteran


Joined: 18 May 2014
Posts: 1256

PostPosted: Sat Nov 07, 2020 5:21 pm    Post subject: Reply with quote

it's easier to use duktape'd polkit.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3472
Location: Canada

PostPosted: Sat Nov 07, 2020 5:29 pm    Post subject: Reply with quote

Perfect Gentleman wrote:
it's easier to use duktape'd polkit.


In what sense ? I have yet to need to do anything with polkit configuration, to know what is easy or not :) (which, I may say, is impressive for a service, unless polkit does not do anything :) )
Back to top
View user's profile Send private message
Perfect Gentleman
Veteran
Veteran


Joined: 18 May 2014
Posts: 1256

PostPosted: Sat Nov 07, 2020 5:42 pm    Post subject: Reply with quote

In sense of deps and time compilation. Being using duktape'd polkit for more than a year and have no any problems with it on 2 PCs with KDE.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3472
Location: Canada

PostPosted: Sat Nov 07, 2020 5:45 pm    Post subject: Reply with quote

Perfect Gentleman wrote:
In sense of deps and time compilation. Being using duktape'd polkit for more than a year and have no any problems with it on 2 PCs with KDE.


Ok, sure.

Of course the main issue with polkit is that needs javascript at al. Such a basic service shouldn't have :( All this python-2.7 issue was minor. I was more hopeful in this patch discussion that
the original guy tried to rip the Javascript out of it, but somehow it all has fizzled down to python support.
Back to top
View user's profile Send private message
Perfect Gentleman
Veteran
Veteran


Joined: 18 May 2014
Posts: 1256

PostPosted: Sat Nov 07, 2020 5:53 pm    Post subject: Reply with quote

As for me I've Rust and LVVM as it's nearly impossible to have system without them of course if you don't use bin-packages.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3472
Location: Canada

PostPosted: Sat Nov 07, 2020 6:03 pm    Post subject: Reply with quote

Perfect Gentleman wrote:
As for me I've Rust and LVVM as it's nearly impossible to have system without them of course if you don't use bin-packages.



I have rust-bin because of a single librsvg. But not llvm. llvm was needed only for mesa, but I use nvidia-drivers, so can compile mesa without llvm. Again, rust etc is just a consequence here,
the main culprit is a need for spidermonkey in the first place.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3472
Location: Canada

PostPosted: Thu Dec 10, 2020 5:18 am    Post subject: Reply with quote

Ionen wrote:
mirekm wrote:
There is project using duktape instead of spidermonkey.
If want to keep track of addition status for official ::gentoo see bug #734326 and the upstream PR which unfortunately seems to be a bit deadlocked right now (but still seeing interest).

On another note, ~testing =spidermonkey-78.2.0 no longer need python2.7 to build (albeit requires rust now), most other >=78 mozilla-based ebuilds "should" be moving away from the py2 dependency soon'ish as well.



There is lively recent activity on your second link. Keeping fingers crossed
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum