diff mbox series

[bug#40753] gnu: spacefm: Add dependencies for extra functionality.

Message ID 20200427022956.7c7d7263.raghavgururajan@disroot.org
State Accepted
Headers show
Series [bug#40753] gnu: spacefm: Add dependencies for extra functionality. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job

Commit Message

Raghav Gururajan April 27, 2020, 6:29 a.m. UTC
Hi Jan!

> >>>HERE<<<  
> 
> > * gnu/packages/lxde.scm (spacefm): Fix privilege management and icons.  
> 
> Please move this remark:
> 
> > This commit contains changes that were accidentally left out in
> > commit bf37b49cdd345bcedeb7142f61968d3a6e15e8d8.  
> 
> beteen subject and "* gnu/packages/lxde", so to >>>HERE<<<

Sure.

> >      (arguments
> > -     `(#:configure-flags (list (string-append "--with-bash-path="
> > -                                              (assoc-ref %build-inputs
> > "bash")
> > -                                              "/bin/bash")
> > -                               (string-append "--sysconfdir="
> > -                                              (assoc-ref %outputs "out")
> > -                                              "/etc"))))
> > +     `(#:phases
> > +       (modify-phases %standard-phases
> > +         (add-after 'unpack 'patch-spacefm-conf
> > +           (lambda* (#:key inputs #:allow-other-keys)
> > +             (substitute* "etc/spacefm.conf"
> > +               (("#terminal_su=/bin/su")
> > +                (string-append "terminal_su="
> > +                               (string-append (assoc-ref inputs "sudo")
> > +                                              "/bin/sudo"))))  
> 
> Does this work; SU is not SUDO?  Also, I don't see how <sudo>/bin/sudo
> would work.  When I run this
> 
>     $(guix build sudo)/bin/sudo 
> 
> I get
> 
>     sudo: /gnu/store/l320ig872ny66d1yi6v7n4zb93iz50dx-sudo-1.8.31p1/bin/sudo
> must be owned by uid 0 and have the setuid bit set
> 
> Am I missing something?

The option just has the name "su". It can be sudo too. I wouldn't worry about
this terminal_su option. This is just has to be set, so that spacefm doesn't
throw "no valid program found" error, now and then, because of default FHS path.
SpaceFM primarily uses graphical_su, which has been set to 'ktsuss'.

> > +             (substitute* "etc/spacefm.conf"
> > +               (("#graphical_su=/usr/bin/gksu")
> > +                (string-append "graphical_su="
> > +                               (string-append (assoc-ref inputs "ktsuss")
> > +                                              "/bin/ktsuss"))))
> > +             #t)))  
> 
> Changing the default configurations does not seem to work for me.  When
> I select
> 
>     /File/Root Window
> 
> there is a pop-up that says: Please configure a valid Terminal SU
> command.  Does it work for You?

This is exactly the error I was talking about above. Once we apply this patch,
the error appearing stops and ktsuss will pop right up.

> 
> > +       #:configure-flags (list   
>                                  ^
> Trailing space.

Thanks! I have attached revised patch with this email.

Regards,
RG.

Comments

Efraim Flashner April 27, 2020, 6:38 a.m. UTC | #1
On Guix System $(guix build sudo)/bin/sudo isn't setuid, we'd need the
one from /run/setuid-programs.

(ins)efraim@E5400 ~$ which sudo
/run/setuid-programs/sudo
Janneke Nieuwenhuizen April 27, 2020, 8:37 a.m. UTC | #2
Raghav Gururajan writes:

Hello Raghav,

>> Does this work; SU is not SUDO?  Also, I don't see how <sudo>/bin/sudo
>> would work.  When I run this
>> 
>>     $(guix build sudo)/bin/sudo 
>> 
>> I get
>> 
>>     sudo: /gnu/store/l320ig872ny66d1yi6v7n4zb93iz50dx-sudo-1.8.31p1/bin/sudo
>> must be owned by uid 0 and have the setuid bit set
>> 
>> Am I missing something?
>
> The option just has the name "su". It can be sudo too. I wouldn't worry about
> this terminal_su option.

That's okay, I'm not really worried :-)

When I read a patch, and I cannot imagine how that would work, I would
like to learn more to understand it beter, or remove it.  I do not like
adding code that I do not understand, and also does not work.

> This is just has to be set, so that spacefm doesn't throw "no valid
> program found" error, now and then, because of default FHS path.
> SpaceFM primarily uses graphical_su, which has been set to 'ktsuss'.

Okay, that would explain something.  So, TERMINAL_SU just needs to be
set to "some" existing executable, but is not used?  What about

     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-spacefm-conf
           (lambda _
             ;; If terminal_su is unset, users get a popup:
             ;; "Please configure a valid Terminal SU command."
             (substitute* "etc/spacefm.conf"
               (("#terminal_su=/bin/su")
                "terminal_su=/run/current-system/profile/bin/false"))
             #t)))

I tested this, and it hase the same, partially functional result, as
using sudo and setting #graphical_su.  WDYT?

>> > +             (substitute* "etc/spacefm.conf"
>> > +               (("#graphical_su=/usr/bin/gksu")
>> > +                (string-append "graphical_su="
>> > +                               (string-append (assoc-ref inputs "ktsuss")
>> > +                                              "/bin/ktsuss"))))
>> > +             #t)))  
>> 
>> Changing the default configurations does not seem to work for me.  When
>> I select
>> 
>>     /File/Root Window
>> 
>> there is a pop-up that says: Please configure a valid Terminal SU
>> command.  Does it work for You?
>
> This is exactly the error I was talking about above. Once we apply this patch,
> the error appearing stops and ktsuss will pop right up.

Hmm.  Can you double check?  I tested your patch again today it (still)
does not work.  I get

    Please configure a valid Terminal SU command.

Only when I manually point spacefm to it's configuration file, like so

    /gnu/store/y24705ci3dcjiqdig3k3x18pc6aymnzc-spacefm-1.0.6/bin/spacefm -c /gnu/store/y24705ci3dcjiqdig3k3x18pc6aymnzc-spacefm-1.0.6/etc/spacefm/

then the popup disappears.  So now I am wondering, is the problem with
your setup or with mine?  What do you think?

By the way, the KTSUSS popup (when I see it) does not work for me.  Have
you tested KTSUSS?

Greetings,
janneke
Janneke Nieuwenhuizen April 27, 2020, 8:42 a.m. UTC | #3
Efraim Flashner writes:

> On Guix System $(guix build sudo)/bin/sudo isn't setuid, we'd need the
> one from /run/setuid-programs.
>
> (ins)efraim@E5400 ~$ which sudo
> /run/setuid-programs/sudo

Yes, that's what I wanted to suggest...but then I saw that the setting
is called TERMINAL_SU (not SUDO).  That got me thinking: this is
possibly not used at all...could be dead code?

janneke
diff mbox series

Patch

From 636d358dc3290433b929ebd72ad087dbfa50c8a5 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Mon, 27 Apr 2020 02:27:16 -0400
Subject: [PATCH] gnu: spacefm: Fix privilege management.

* gnu/packages/lxde.scm (spacefm): Fix privilege management.
---
 gnu/packages/lxde.scm | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/lxde.scm b/gnu/packages/lxde.scm
index 9de96a21cb..8b9759bc9c 100644
--- a/gnu/packages/lxde.scm
+++ b/gnu/packages/lxde.scm
@@ -27,6 +27,7 @@ 
 
 (define-module (gnu packages lxde)
   #:use-module (gnu packages)
+  #:use-module (gnu packages admin)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages disk)
@@ -288,21 +289,42 @@  with freedesktop.org standard.")
        ("gtk+" ,gtk+)
        ("ifuse" ,ifuse)
        ("jmtpfs" ,jmtpfs)
+       ("ktsuss" ,ktsuss)
        ("libx11" ,libx11)
        ("lsof" ,lsof)
        ("pango" ,pango)
        ("shared-mime-info" ,shared-mime-info)
        ("startup-notification" ,startup-notification)
+       ("sudo" ,sudo)
        ("udevil" ,udevil)
        ("util-linux" ,util-linux)
        ("wget" ,wget)))
     (arguments
-     `(#:configure-flags (list (string-append "--with-bash-path="
-                                              (assoc-ref %build-inputs "bash")
-                                              "/bin/bash")
-                               (string-append "--sysconfdir="
-                                              (assoc-ref %outputs "out")
-                                              "/etc"))))
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-spacefm-conf
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "etc/spacefm.conf"
+               (("#terminal_su=/bin/su")
+                (string-append "terminal_su="
+                               (string-append (assoc-ref inputs "sudo")
+                                              "/bin/sudo"))))
+             (substitute* "etc/spacefm.conf"
+               (("#graphical_su=/usr/bin/gksu")
+                (string-append "graphical_su="
+                               (string-append (assoc-ref inputs "ktsuss")
+                                              "/bin/ktsuss"))))
+             #t)))
+       #:configure-flags (list
+                          (string-append "--with-preferable-sudo="
+                                         (assoc-ref %build-inputs "ktsuss")
+                                         "/bin/ktsuss")
+                          (string-append "--with-bash-path="
+                                         (assoc-ref %build-inputs "bash")
+                                         "/bin/bash")
+                          (string-append "--sysconfdir="
+                                         (assoc-ref %outputs "out")
+                                         "/etc"))))
     (home-page "https://ignorantguru.github.io/spacefm/")
     (synopsis "Multi-panel tabbed file manager")
     (description "SpaceFM is a graphical, multi-panel, tabbed file manager
-- 
2.26.2