Getting point-and-click working

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting point-and-click working

David Sumbler
I put off trying to get point-and-click for several years (!) until
now, because the instructions in the Usage Manual seemed rather
cryptic.  But point-and-click would be massively useful, so I thought I
would try to set it up.  I followed the instructions to the best of my
limited ability and, rather as I expected, it didn't work for me.

I am running Ubuntu 18.04 with emacs 25.2. and the Unity desktop.

I have LYEDITOR set to "emacsclient --no-wait +%(line)s:%(column)s %" file)s".
I don't have EDITOR set to anything at the moment.

I couldn't seem to find whether I was running gnome 2 or 3, so I
carried out the steps documented for gnome 2, but running

        gnome-open textedit:///etc/issue:1:0:0

produced an error saying that the URL could not be found.

So I tried the gnome 3 steps.  I created a file
        ~/tmp/lilypond-invoke-editor.desktop
containing the material specified in the UM, i.e.:

        [Desktop Entry]
        Version=1.0
        Name=lilypond-invoke-editor
        GenericName=Textedit URI handler
        Comment=URI handler for textedit:
        Exec=lilypond-invoke-editor %u
        Terminal=false
        Type=Application
        MimeType=x-scheme-handler/textedit;
        Categories=Editor
        NoDisplay=true

I then executed:

        xdg-desktop-menu install ./lilypond-invoke-editor.desktop
        xdg-mime default lilypond-invoke-editor.desktop x-scheme-handler/textedit

Now when I start emacs, run the command server-start and then issue the
command

        gnome-open textedit:///etc/issue:1:0:0

the file /etc/issue does indeed open in emacs.  It contains the single
line

        Ubuntu 18.04.1 LTS \n \l

This seemed promising, to me.

The PDF viewer I use is evince, so I added the lines

        # For Textedit links
        /usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,

to the file /etc/apparmor.d/local/usr.bin.evince (which was previously
empty), and then ran

        sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince

as instructed in the UM.

However, when I open a lilypond PDF file in evince and click on a note,
I get an error message:

        Unable to open external link.
        Failed to execute child process “lilypond-invoke-editor” (Permission denied)

Yet I can run lilypond-invoke-editor from a command line without any
parameters, and I get the expected usage help.

Can anyone suggest what I have done wrong or omitted to do?

David





_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

Andrew Bernard
Hi David,

Use the About page in Settings to find out which Gnome version you have.

I  upgraded all my 18.04 Ubuntu systems to 18.10, so I can't recall what Gnome release came with 18.04.


Andrew



On Sat, 9 Feb 2019 at 04:17, David Sumbler <[hidden email]> wrote:

I couldn't seem to find whether I was running gnome 2 or 3, so I
carried out the steps documented for gnome 2, but running


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

Andrew Bernard
In reply to this post by David Sumbler
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

Andrew Bernard
In reply to this post by David Sumbler
Hi David,

What version of lilypond are you using?


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

Andrew Bernard
In reply to this post by David Sumbler
Hi David,

I set this up on Ubuntu 18.10 (no 18.04 left on my machines, sorry) and although I do not get error messages from Document Viewer, emacs is not invoked. So, not working for me, but in a different way.

Each to his own, and there are pros and cons each way, but I eventually became tired of all the difficulties with Ubuntu and switched to Debian where everything is good. It may not be helpful to you to hear that, but it did solve all my lilypond issues of various sorts. However, there are many committed Ubuntu users on the list.

Andrew



_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

Federico Bruni-2
In reply to this post by David Sumbler


Il giorno ven 8 feb 2019 alle 18:16, David Sumbler <[hidden email]>
ha scritto:
> I put off trying to get point-and-click for several years (!) until
> now, because the instructions in the Usage Manual seemed rather
> cryptic.  But point-and-click would be massively useful, so I thought
> I
> would try to set it up.  I followed the instructions to the best of my
> limited ability and, rather as I expected, it didn't work for me.
>
> I am running Ubuntu 18.04 with emacs 25.2. and the Unity desktop.
>

I don't think it's important if you are using Unity or Gnome 3. In both
cases you should probably follow the instructions for GNOME 3 in the
Usage manual.


> I have LYEDITOR set to "emacsclient --no-wait +%(line)s:%(column)s %"
> file)s".
> I don't have EDITOR set to anything at the moment.
>

The file variable is called incorrectly. I guess it's a typo in your
email?
Anyway, you don't need to use this long form, as the command should be
already defined in lilypond source.
You can check it with these commands:

[~]$ which lilypond-invoke-editor
~/.local/bin/lilypond-invoke-editor
[~]$ grep emacs
.local/lilypond/usr/share/lilypond/current/scm/editor.scm
         "emacs"))))
  '(("emacs" .  "emacsclient --no-wait +%(line)s:%(column)s %(file)s ||
(emacs +%(line)s:%(column)s %(file)s&)")

So you can use:

export LYEDITOR=emacs

This is all I have to do to make it work on Fedora 29, GNOME 3.30.2.

I also have this line in ~/.emacs:

(server-start)

This is explained in current master Documentation. Unfortunately
LilyPond releases have been blocked for the last seven months so you
have to build it yourself or check the sources on Savannah.



> I couldn't seem to find whether I was running gnome 2 or 3, so I
> carried out the steps documented for gnome 2, but running
>
> gnome-open textedit:///etc/issue:1:0:0
>
> produced an error saying that the URL could not be found.
>

When I find some time I'll improve the documentation.

> So I tried the gnome 3 steps.  I created a file
> ~/tmp/lilypond-invoke-editor.desktop
> containing the material specified in the UM, i.e.:
>
> [Desktop Entry]
> Version=1.0
> Name=lilypond-invoke-editor
> GenericName=Textedit URI handler
> Comment=URI handler for textedit:
> Exec=lilypond-invoke-editor %u
> Terminal=false
> Type=Application
> MimeType=x-scheme-handler/textedit;
> Categories=Editor
> NoDisplay=true
>
> I then executed:
>
> xdg-desktop-menu install ./lilypond-invoke-editor.desktop
> xdg-mime default lilypond-invoke-editor.desktop
> x-scheme-handler/textedit
>
> Now when I start emacs, run the command server-start and then issue
> the
> command
>
> gnome-open textedit:///etc/issue:1:0:0
>
> the file /etc/issue does indeed open in emacs.  It contains the single
> line
>
> Ubuntu 18.04.1 LTS \n \l
>
> This seemed promising, to me.
>

So far so good.
By the way, it opens once or twice? If you are using a LilyPond
installer released before October 2018 (today the answer is yes), you
might get two windows. If you are using a version provided by your
distro, you won't probably have this bug. See this PR:
https://github.com/gperciva/gub/pull/48


> The PDF viewer I use is evince, so I added the lines
>
> # For Textedit links
> /usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,
>
> to the file /etc/apparmor.d/local/usr.bin.evince (which was previously
> empty), and then ran
>
> sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince
>
> as instructed in the UM.
>

> However, when I open a lilypond PDF file in evince and click on a
> note,
> I get an error message:
>
> Unable to open external link.
> Failed to execute child process “lilypond-invoke-editor”
> (Permission denied)
>
> Yet I can run lilypond-invoke-editor from a command line without any
> parameters, and I get the expected usage help.
>
> Can anyone suggest what I have done wrong or omitted to do?
>

I never had this problem since Fedora doesn't use AppArmor (nor Debian,
wich I used previously).
Have you tried logging out the session or restarting?
Or just restart apparmor:

sudo /etc/init.d/apparmor restart

If it doesn't help, try disabling AppArmor for Evince:

https://askubuntu.com/questions/344834/evince-document-viewer-failed-to-execute-child-process-nemo-permission-deni




_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

David Sumbler
On Sat, 2019-02-09 at 11:05 +0100, Federico Bruni wrote:

> Il giorno ven 8 feb 2019 alle 18:16, David Sumbler <
> [hidden email]>
> ha scritto:
> > I put off trying to get point-and-click for several years (!) until
> > now, because the instructions in the Usage Manual seemed rather
> > cryptic.  But point-and-click would be massively useful, so I
> > thought I would try to set it up.  I followed the instructions to
> > the best of my limited ability and, rather as I expected, it didn't
> > work for me.
> >
> > I am running Ubuntu 18.04 with emacs 25.2. and the Unity desktop.
>
> I don't think it's important if you are using Unity or Gnome 3. In
> both cases you should probably follow the instructions for GNOME 3 in
> the Usage manual.
>
> > I have LYEDITOR set to "emacsclient --no-wait +%(line)s:%(column)s
> > %" file)s".
> > I don't have EDITOR set to anything at the moment.
>
> The file variable is called incorrectly. I guess it's a typo in your
> email?

Yes it was - apologies.  My LYEDITOR was correctly set to
        emacsclient --no-wait +%(line)s:%(column)s %(file)s
as shown in the Usage Manual.

> Anyway, you don't need to use this long form, as the command should
> be already defined in lilypond source.
> You can check it with these commands:
>
> [~]$ which lilypond-invoke-editor
> ~/.local/bin/lilypond-invoke-editor
> [~]$ grep emacs
> .local/lilypond/usr/share/lilypond/current/scm/editor.scm
>          "emacs"))))
>   '(("emacs" .  "emacsclient --no-wait +%(line)s:%(column)s %(file)s
> ||
> (emacs +%(line)s:%(column)s %(file)s&)")
>
> So you can use:
>
> export LYEDITOR=emacs

My lilypond is a global install in /usr/local/ rather than ~/local/ -
perhaps this is what is causing the permissions error.  Apart from
that, the output of the 'grep emacs'... command is identical to yours.

I have therefore now changed LYEDITOR to 'emacs' to simplify things, as
you suggest.

> This is all I have to do to make it work on Fedora 29, GNOME 3.30.2.
>
> I also have this line in ~/.emacs:
>
> (server-start)
>
> This is explained in current master Documentation. Unfortunately
> LilyPond releases have been blocked for the last seven months so you
> have to build it yourself or check the sources on Savannah.

At the moment I am issuing the server-start command in a running emacs.
But of course I shall add it to my .emacs file at some point.

<snip> </snip>

> > Now when I start emacs, run the command server-start and then
> > issue
> > the
> > command
> >
> > gnome-open textedit:///etc/issue:1:0:0
> >
> > the file /etc/issue does indeed open in emacs.  It contains the
> > single
> > line
> >
> > Ubuntu 18.04.1 LTS \n \l
> >
> > This seemed promising, to me.
> >
>
> So far so good.
> By the way, it opens once or twice? If you are using a LilyPond
> installer released before October 2018 (today the answer is yes),
> you might get two windows. If you are using a version provided by
> your distro, you won't probably have this bug. See this PR:
> https://github.com/gperciva/gub/pull/48

It opens once.  I am using LilyPond 2.19.82 downloaded last August.

> > The PDF viewer I use is evince, so I added the lines
> >
> > # For Textedit links
> > /usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,
> >
> > to the file /etc/apparmor.d/local/usr.bin.evince (which was
> > previously empty), and then ran
> >
> > sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince
> >
> > as instructed in the UM.
> >
> > However, when I open a lilypond PDF file in evince and click on a
> > note, I get an error message:
> >
> > Unable to open external link.
> > Failed to execute child process “lilypond-invoke-editor”
> > (Permission denied)
> >
> > Yet I can run lilypond-invoke-editor from a command line without
> > any parameters, and I get the expected usage help.
> >
> > Can anyone suggest what I have done wrong or omitted to do?
>
> I never had this problem since Fedora doesn't use AppArmor (nor
> Debian, wich I used previously).
> Have you tried logging out the session or restarting?
> Or just restart apparmor:
>
> sudo /etc/init.d/apparmor restart

No success, I'm sorry to say.

> If it doesn't help, try disabling AppArmor for Evince:
>
https://askubuntu.com/questions/344834/evince-document-viewer-failed-to-execute-child-process-nemo-permission-deni

I tried all the suggestions on the page suggested.  Nothing helped
except for completely disabling AppArmor for Evince.  The links then
work as intended!

But it would be preferable, probably, not to do that, so I removed the
disabling link and tried again with the AppArmor files modified as you
suggested.  I rebooted and, sad to say, the old problem occurs.

However, in case you or anyone else can make a further suggestion on
how to get things working even with AppArmor doing its thing, here are
the lines that appear in my /var/log/syslog file when I open a Lilypond
PDF file in Evince, and then click on a link.

Upon opening the file, I get (in a single line):

Feb  9 18:11:21 vesta kernel: [  975.529752] audit: type=1400
audit(1549735881.448:47): apparmor="DENIED"
operation="open" profile="/usr/bin/evince"
name="/home/david/.local/share/applications/mimeapps.list" pid=3241
comm="evince" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

When I click on a link in the displayed file, I get:

Feb  9 18:11:38 vesta kernel: [  992.243804] audit: type=1400
audit(1549735898.161:48): apparmor="DENIED"
operation="exec" profile="/usr/bin/evince"
name="/usr/local/bin/lilypond-wrapper.guile" pid=3261
comm="evince" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0

Although all of the other 71 files in ~/.local/share/applications/ have
me as owner and group, the file mimeapps.list has owner and group set
to root.  I looked at my partner's computer, which is running Ubuntu
16.04, and there the corresponding file has owner and group set to the
user, rather than root.  (Presumably this is some change made in
Ubuntu, since I don't think I can have done anything to change it.)

So I tried changing the ownership of that file on my computer, and sure
enough, I no longer see an error in the log file when evince is
started.  But when I click on a link in the Lilypond file I still get:

Feb  9 18:34:45 vesta kernel: [  200.968460] audit: type=1400
audit(1549737285.711:45): apparmor="DENIED"
operation="exec" profile="/usr/bin/evince"
name="/usr/local/bin/lilypond-wrapper.guile" pid=2507
comm="evince" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0

Clearly I can't sensibly change the ownership of
/usr/local/bin/lilypond-wrapper.guile, and presumably this is the sort
of thing AppArmor is supposed to sort out.  I did, however, try adding
a line specifically for this file in
/etc/apparmor.d/local/usr.bin.evince, but it hasn't helped.

Meanwhile, I shall go back to disabling AppArmor for Evince, even
though it is probably slightly less than ideal.

Thanks for all your help.

David







_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

David Wright
On Sat 09 Feb 2019 at 19:03:02 (+0000), David Sumbler wrote:

> I tried all the suggestions on the page suggested.  Nothing helped
> except for completely disabling AppArmor for Evince.  The links then
> work as intended!
>
> But it would be preferable, probably, not to do that, so I removed the
> disabling link and tried again with the AppArmor files modified as you
> suggested.  I rebooted and, sad to say, the old problem occurs.
>
> However, in case you or anyone else can make a further suggestion on
> how to get things working even with AppArmor doing its thing, here are
> the lines that appear in my /var/log/syslog file when I open a Lilypond
> PDF file in Evince, and then click on a link.
>
> Upon opening the file, I get (in a single line):
>
> Feb  9 18:11:21 vesta kernel: [  975.529752] audit: type=1400
> audit(1549735881.448:47): apparmor="DENIED"
> operation="open" profile="/usr/bin/evince"
> name="/home/david/.local/share/applications/mimeapps.list" pid=3241
> comm="evince" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
>
> When I click on a link in the displayed file, I get:
>
> Feb  9 18:11:38 vesta kernel: [  992.243804] audit: type=1400
> audit(1549735898.161:48): apparmor="DENIED"
> operation="exec" profile="/usr/bin/evince"
> name="/usr/local/bin/lilypond-wrapper.guile" pid=3261
> comm="evince" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
>
> Although all of the other 71 files in ~/.local/share/applications/ have
> me as owner and group, the file mimeapps.list has owner and group set
> to root.  I looked at my partner's computer, which is running Ubuntu
> 16.04, and there the corresponding file has owner and group set to the
> user, rather than root.  (Presumably this is some change made in
> Ubuntu, since I don't think I can have done anything to change it.)

Is it possible you accidentally ran the command
xdg-mime default lilypond-invoke-editor.desktop x-scheme-handler/textedit
with sudo? There's no way root should be owning any files in /home.

> So I tried changing the ownership of that file on my computer, and sure
> enough, I no longer see an error in the log file when evince is
> started.  But when I click on a link in the Lilypond file I still get:
>
> Feb  9 18:34:45 vesta kernel: [  200.968460] audit: type=1400
> audit(1549737285.711:45): apparmor="DENIED"
> operation="exec" profile="/usr/bin/evince"
> name="/usr/local/bin/lilypond-wrapper.guile" pid=2507
> comm="evince" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
>
> Clearly I can't sensibly change the ownership of
> /usr/local/bin/lilypond-wrapper.guile, and presumably this is the sort
> of thing AppArmor is supposed to sort out.  I did, however, try adding
> a line specifically for this file in
> /etc/apparmor.d/local/usr.bin.evince, but it hasn't helped.

I too use Debian and, although there are apparmor files dotted around,
it doesn't use them here. However, I get the impression that the
apparmor files are loaded into the kernel, rather than being used
in situ. So I wonder whether, *whenever* you make changes to any of
these files, you have to reparse them with apparmor_parser. Did
you do that? (I don't know if they're loaded at boot time.)

> Meanwhile, I shall go back to disabling AppArmor for Evince, even
> though it is probably slightly less than ideal.

BTW I think there are a few small wrinkles in the documentation:

If you write a file called lilypond-invoke-editor.desktop in a local
directory such as /tmp, then you need to run
xdg-desktop-menu install /tmp/lilypond-invoke-editor.desktop
and not
xdg-desktop-menu install ./lilypond-invoke-editor.desktop

If you run evince but not Gnome, then gnome-open may not be present,
but it may be worth trying xdg-open.

I assume (but cannot test) that the lines:

# For Textedit links
/usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,

should be adjusted according to where lilypond was installed.
(In your case, you happen to have matched its assumption.)

Cheers,
David.

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

Federico Bruni-2
In reply to this post by David Sumbler


Il giorno sab 9 feb 2019 alle 20:03, David Sumbler <[hidden email]>
ha scritto:

> On Sat, 2019-02-09 at 11:05 +0100, Federico Bruni wrote:
>> [...]
>>
>>  So far so good.
>>  By the way, it opens once or twice? If you are using a LilyPond
>>  installer released before October 2018 (today the answer is yes),
>>  you might get two windows. If you are using a version provided by
>>  your distro, you won't probably have this bug. See this PR:
>>  <https://github.com/gperciva/gub/pull/48>
>
> It opens once.  I am using LilyPond 2.19.82 downloaded last August.
>

Ok, this might depend on the editor you use.
I remember Gedit opened twice before that fix.

In case you have troubles with other editors, you can safely delete "-e
main" in the exec line in lilypond-wrapper.guile.


>
> When I click on a link in the displayed file, I get:
>
> Feb  9 18:11:38 vesta kernel: [  992.243804] audit: type=1400
> audit(1549735898.161:48): apparmor="DENIED"
> operation="exec" profile="/usr/bin/evince"
> name="/usr/local/bin/lilypond-wrapper.guile" pid=3261
> comm="evince" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
>
> Although all of the other 71 files in ~/.local/share/applications/
> have
> me as owner and group, the file mimeapps.list has owner and group set
> to root.  I looked at my partner's computer, which is running Ubuntu
> 16.04, and there the corresponding file has owner and group set to the
> user, rather than root.  (Presumably this is some change made in
> Ubuntu, since I don't think I can have done anything to change it.)
>
> So I tried changing the ownership of that file on my computer, and
> sure
> enough, I no longer see an error in the log file when evince is
> started.  But when I click on a link in the Lilypond file I still get:
>
> Feb  9 18:34:45 vesta kernel: [  200.968460] audit: type=1400
> audit(1549737285.711:45): apparmor="DENIED"
> operation="exec" profile="/usr/bin/evince"
> name="/usr/local/bin/lilypond-wrapper.guile" pid=2507
> comm="evince" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
>

0 is the root user id. 1000 is your user id.
ouid is the object owner id and it's assigned to the root user. No idea
what is the object  here... if it's the executable, then it's correct.


> Clearly I can't sensibly change the ownership of
> /usr/local/bin/lilypond-wrapper.guile, and presumably this is the sort
> of thing AppArmor is supposed to sort out.  I did, however, try adding
> a line specifically for this file in
> /etc/apparmor.d/local/usr.bin.evince, but it hasn't helped.
>

You should not change the ownership of the scripts in /usr/local/bin.

You might search for other files owned by root in your home directory,
e.g.:

$ find ~/.local -user root
$ find ~/.config -user root




_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

Andrew Bernard
Hello All,

Didn't this come up in 2015 on the list here:


Is it that the Ubuntu lilypond is broken (still)?

FWIW though, on my pristine Ubuntu 18.10, clicking the PDF just does nothing. nada. All works great on Debian 9.


Andrew



On Sun, 10 Feb 2019 at 20:08, Federico Bruni <[hidden email]> wrote:


Il giorno sab 9 feb 2019 alle 20:03, David Sumbler <[hidden email]>
ha scritto:
> On Sat, 2019-02-09 at 11:05 +0100, Federico Bruni wrote:
>> [...]
>>
>>  So far so good.
>>  By the way, it opens once or twice? If you are using a LilyPond
>>  installer released before October 2018 (today the answer is yes),
>>  you might get two windows. If you are using a version provided by
>>  your distro, you won't probably have this bug. See this PR:
>>  <https://github.com/gperciva/gub/pull/48>
>
> It opens once.  I am using LilyPond 2.19.82 downloaded last August.
>

Ok, this might depend on the editor you use.
I remember Gedit opened twice before that fix.

In case you have troubles with other editors, you can safely delete "-e
main" in the exec line in lilypond-wrapper.guile.


>
> When I click on a link in the displayed file, I get:
>
> Feb  9 18:11:38 vesta kernel: [  992.243804] audit: type=1400
> audit(1549735898.161:48): apparmor="DENIED"
> operation="exec" profile="/usr/bin/evince"
> name="/usr/local/bin/lilypond-wrapper.guile" pid=3261
> comm="evince" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
>
> Although all of the other 71 files in ~/.local/share/applications/
> have
> me as owner and group, the file mimeapps.list has owner and group set
> to root.  I looked at my partner's computer, which is running Ubuntu
> 16.04, and there the corresponding file has owner and group set to the
> user, rather than root.  (Presumably this is some change made in
> Ubuntu, since I don't think I can have done anything to change it.)
>
> So I tried changing the ownership of that file on my computer, and
> sure
> enough, I no longer see an error in the log file when evince is
> started.  But when I click on a link in the Lilypond file I still get:
>
> Feb  9 18:34:45 vesta kernel: [  200.968460] audit: type=1400
> audit(1549737285.711:45): apparmor="DENIED"
> operation="exec" profile="/usr/bin/evince"
> name="/usr/local/bin/lilypond-wrapper.guile" pid=2507
> comm="evince" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
>

0 is the root user id. 1000 is your user id.
ouid is the object owner id and it's assigned to the root user. No idea
what is the object  here... if it's the executable, then it's correct.


> Clearly I can't sensibly change the ownership of
> /usr/local/bin/lilypond-wrapper.guile, and presumably this is the sort
> of thing AppArmor is supposed to sort out.  I did, however, try adding
> a line specifically for this file in
> /etc/apparmor.d/local/usr.bin.evince, but it hasn't helped.
>

You should not change the ownership of the scripts in /usr/local/bin.

You might search for other files owned by root in your home directory,
e.g.:

$ find ~/.local -user root
$ find ~/.config -user root




_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

David Sumbler
On Sun, 2019-02-10 at 20:14 +1100, Andrew Bernard wrote:
> Hello All,
>
> Didn't this come up in 2015 on the list here:
>
>
https://lists.gnu.org/archive/html/lilypond-user/2015-06/msg00168.html
>
> Is it that the Ubuntu lilypond is broken (still)?
>
> FWIW though, on my pristine Ubuntu 18.10, clicking the PDF just does
> nothing. nada. All works great on Debian 9.
>
>
> Andrew

The Ubuntu lilypond may well be broken for all I know, but my
difficulties with point-and-click do not relate to this.  I have never
used the version in the Ubuntu repository: I always download from the
Lilypond site.  I am currently running 2.19.82.

David


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

Aaron Hill
In reply to this post by Andrew Bernard
On 2019-02-10 1:14 am, Andrew Bernard wrote:
> Didn't this come up in 2015 on the list here:
>
> https://lists.gnu.org/archive/html/lilypond-user/2015-06/msg00168.html

That's an interesting thread.  It turns up an alternate script [1] for
handling the textedit: URI scheme, however curiously the script
incorrectly interprets [2] the parameters of a link.  The proper format
is "file:line:char:column" not "file:line:start:end".

[1]: https://github.com/markk/textedit-ly
[2]:
https://github.com/markk/textedit-ly/blob/master/textedit.py#L29-L32

This scheme stems from ly:input-file-line-char-column (backed by
Source_file::get_counts internally) which returns the zero-based
character index and the one-based column number.  Of note, columns are
computed assuming eight-wide tabulation.

It seems the script author was not aware of this scheme and assumed
there was an off-by-one error, as they mention their solution "places
the cursor at the character number in the url, rather than one character
to the left".

Providing you do not use tab characters in your input files, you would
see that 'column' will always be one more than 'char'.  It could be
misinterpreted that this is a character range, rather than two different
values.  As such, if you try to use 'char' as a column number rather
than a character index, you will see a problem with editors that assume
a one-based value.

The script in particular applies their fix when using vim, which is an
editor that expects a one-based column number.  But adding one to 'char'
(which is called 'start' in the script) is invalid if there are tab
characters on the line, as you will still end up at a column left of
where you would expect the cursor to be.

The solution is to ignore the 'char' value completely and only use
'column' to launch vim with a command similar to the following:

     vim --remote '+:norm%(line)sG%(column)s|' %(file)s

(This is using the same Python-style substitution arguments expected in
the LYEDITOR variable.)

-- Aaron Hill

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

David Sumbler
In reply to this post by Federico Bruni-2
Thank you all for your help in this matter.

Today I have point-and-click working as it should, with AppArmor
apparently doing what it is supposed to do.

What made the difference was the following:

The Usage Manual 4.1.1 says that the lines
        # For Textedit links
        /usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,
should be added to the file /etc/apparmor.d/local/usr.bin.evince .
This file did not exist, although there are several other files in that
directory, so I had created the file and put just the two lines above
in it.  Unfortunately, as I reported, point-and-click didn't work for
me.

With the difficulties I was having, yesterday I disabled AppArmor for
Evince by adding a soft link to /etc/apparmor.d/usr.bin.evince in
/etc/apparmor.d/disable/ .  This is what made point-and-click work
eventually for me yesterday.

However, following your latest emails to the list on the topic, today I
thought I would have another go.  I deleted the disabling link, and ran
'sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince'
 again.  I also ran
'sudo apparmor_parser -r -T -W /etc/apparmor.d/local/usr.bin.evince'.
I don't know whether that needed to be done or not, but I found that it
throws out a syntax error.

So I copied the lines out of the second file and inserted them into the
main usr.bin.evince file.  I then deleted
/etc/apparmor.d/local/usr.bin.evince .

After I ran
'sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince'once more, I found that point-and-click works as it should.

I don't pretend to understand what is going on here, but in summary it appears that if the additional lines are added to /etc/apparmor.d/usr.bin.evince rather than to /etc/apparmor.d/local/usr.bin.evince it all works.

I should add that, in addition to the above, I have corrected the
ownership of ~/.local/share/applications/mimeapps.list.  (I don't know
how this came to be owned by root: I have looked at my bash history,
and I certainly had not run
'xdg-mime default lilypond-invoke-editor.desktop x-scheme-handler/textedit'
with sudo.)

The point-and-click facility will be very useful to me now that I have
got to the point of correcting and tweaking a 150-page score and its
associated parts.  But without your helpful suggestions, I would never
have got it working, so thanks again.

David


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

Aaron Hill
In reply to this post by Aaron Hill
On 2019-02-10 5:15 am, Aaron Hill wrote:
> This scheme stems from ly:input-file-line-char-column (backed by
> Source_file::get_counts internally) which returns the zero-based
> character index and the one-based column number.  Of note, columns are
> computed assuming eight-wide tabulation.

To be precise, ly:input-file-line-char-column returns zero-based values
for both character index and column number.  It is actually the code in
output-ps.scm (and output-svg.scm) that adds one to the column number
when building the URI.  So, I should have said that it is the textedit:
scheme itself that defines the column number as one-based, not the
underlying code that is counting actual characters.  Sorry for the
confusion.


-- Aaron Hill

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

David Wright
In reply to this post by David Sumbler
On Sun 10 Feb 2019 at 13:43:16 (+0000), David Sumbler wrote:
> Thank you all for your help in this matter.
>
> Today I have point-and-click working as it should, with AppArmor
> apparently doing what it is supposed to do.

Great.

While reading the following, bear in mind that I run Debian, and
apparmor itself is not installed here. My interest is mainly
concerned with futureproofing. (I think buster is already in
one of its frozen stages on its way to release. Who knows if
apparmor is installed by default.)

> What made the difference was the following:
>
> The Usage Manual 4.1.1 says that the lines
> # For Textedit links
> /usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,
> should be added to the file /etc/apparmor.d/local/usr.bin.evince .
> This file did not exist, although there are several other files in that
> directory, so I had created the file and put just the two lines above
> in it.  Unfortunately, as I reported, point-and-click didn't work for
> me.

Debian stretch creates /etc/apparmor.d/local/usr.bin.evince during
post-installation. It's just a placeholder with a comment referring
to /etc/apparmor.d/local/README which is actually in the apparmor
package (that I had to download):

# This directory is intended to contain profile additions and overrides for
# inclusion by distributed profiles to aid in packaging AppArmor for
# distributions.
#
# The shipped profiles in /etc/apparmor.d can still be modified by an
# administrator and people should modify the shipped profile when making
# large policy changes, rather than trying to make those adjustments here.
#
# For simple access additions or the occasional deny override, adjusting them
# here can prevent the package manager of the distribution from interfering
# with local modifications. As always, new policy should be reviewed to ensure
# it is appropriate for your site.
#
# For example, if the shipped /etc/apparmor.d/usr.sbin.smbd profile has:
#   #include <local/usr.sbin.smbd>
#
# then an administrator can adjust /etc/apparmor.d/local/usr.sbin.smbd to
# contain any additional paths to be allowed, such as:
#
#   /var/exports/** lrwk,
#
# Keep in mind that 'deny' rules are evaluated after allow rules, so you won't
# be able to allow access to files that are explicitly denied by the shipped
# profile using this mechanism.

In fact, /etc/apparmor.d/usr.bin.evince doesn't contain a reference to
the local file, but several   #include <abstractions/evince>   where
is found

  # Site-specific additions and overrides. See local/README for details.
  #include <local/usr.bin.evince>

There's a lot of ubuntu stuff in these files, so I'm not sure why
the necessary files didn't get created, but in what you outline below,
you've taken what they call the "large policy change" approach above.

> With the difficulties I was having, yesterday I disabled AppArmor for
> Evince by adding a soft link to /etc/apparmor.d/usr.bin.evince in
> /etc/apparmor.d/disable/ .  This is what made point-and-click work
> eventually for me yesterday.
>
> However, following your latest emails to the list on the topic, today I
> thought I would have another go.  I deleted the disabling link, and ran
> 'sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince'
>  again.  I also ran
> 'sudo apparmor_parser -r -T -W /etc/apparmor.d/local/usr.bin.evince'.
> I don't know whether that needed to be done or not, but I found that it
> throws out a syntax error.

The main file contains several   path-to-foo { … }   structures which
the local file gets inserted into. The parser's not going to know what
to do with something like   bar,   being fed to it.
(I see it also seems to understand   FOO="bar"   syntax.)

> So I copied the lines out of the second file and inserted them into the
> main usr.bin.evince file.

Presumably within the   /usr/bin/evince { … }   section.

> I then deleted
> /etc/apparmor.d/local/usr.bin.evince .
>
> After I ran
> 'sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince'once more, I found that point-and-click works as it should.

> I don't pretend to understand what is going on here, but in summary it appears that if the additional lines are added to /etc/apparmor.d/usr.bin.evince rather than to /etc/apparmor.d/local/usr.bin.evince it all works.

I guess someone needs to disect the current ubuntu files to figure out
a preferred method, if fiddling with /etc/apparmor.d/usr.bin.evince
can be avoided.

> I should add that, in addition to the above, I have corrected the
> ownership of ~/.local/share/applications/mimeapps.list.  (I don't know
> how this came to be owned by root: I have looked at my bash history,
> and I certainly had not run
> 'xdg-mime default lilypond-invoke-editor.desktop x-scheme-handler/textedit'
> with sudo.)

My first step would be to look at the modification timestamp on the
file, then check /var/log/auth around that time.
But forensics at a distance is no fun.

> The point-and-click facility will be very useful to me now that I have
> got to the point of correcting and tweaking a 150-page score and its
> associated parts.  But without your helpful suggestions, I would never
> have got it working, so thanks again.

Thanks for setting the problem. It's made me look at an area that
others elsewhere often have problems with, so it's been a useful
learning experience about the mechanics. Now to understand exactly
what "Cx ->" means… (And zathura still doesn't work for me.)

Cheers,
David.

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting point-and-click working

Andrew Bernard
In reply to this post by David Sumbler
Hi All,

I am following the same track today.

Can I add a discovery, and a different issue on my Ubuntu 18.10?

The discovery is that the /etc/apparmor.d/local directory exists to allow local modifications and add-ons to files in the /etc/apparmor.d directory. At the end of /etc/apparmor.d/usr.bin.evince are the following lines:

  # Site-specific additions and overrides. See local/README for details.
  #include <local/usr.bin.evince>

You need to uncomment the include line out so that the local file gets taken account of. Then run apparmor_parser on the top level file.

Also restart apparmor:

# /etc/init.d/apparmor restart

just for good measure (I am not sure if this is essential).

I hope this makes sense of part of the foregoing thread.

But now, for me on Ubuntu 18.10, the problem is solved but it has moved further down the track. Observing /var/log/syslog is useful for debugging this work. We get:


Feb 23 23:41:30 ubu1810 kernel: [  420.450790] audit: type=1400 audit(1550925690.952:84): apparmor="DENIED" operation="exec" profile="/usr/bin/evince" name="/home/andro/bin/lilypond-wrapper.guile" pid=3532 comm="gio-launch-desk" requested_mask="x" denied_mask="x" fsuid=1000 ouid=1000

So now you can see that the next lilypond wrapper down the line is blocked.

I know very little about apparmor. Does anybody know the appropriate incantation to sort this out?

Andrew



On Mon, 11 Feb 2019 at 00:43, David Sumbler <[hidden email]> wrote:
Thank you all for your help in this matter.

Today I have point-and-click working as it should, with AppArmor
apparently doing what it is supposed to do.

What made the difference was the following:

The Usage Manual 4.1.1 says that the lines
        # For Textedit links
        /usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,
should be added to the file /etc/apparmor.d/local/usr.bin.evince .
This file did not exist, although there are several other files in that
directory, so I had created the file and put just the two lines above
in it.  Unfortunately, as I reported, point-and-click didn't work for
me.

With the difficulties I was having, yesterday I disabled AppArmor for
Evince by adding a soft link to /etc/apparmor.d/usr.bin.evince in
/etc/apparmor.d/disable/ .  This is what made point-and-click work
eventually for me yesterday.

However, following your latest emails to the list on the topic, today I
thought I would have another go.  I deleted the disabling link, and ran
'sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince'
 again.  I also ran
'sudo apparmor_parser -r -T -W /etc/apparmor.d/local/usr.bin.evince'.
I don't know whether that needed to be done or not, but I found that it
throws out a syntax error.

So I copied the lines out of the second file and inserted them into the
main usr.bin.evince file.  I then deleted
/etc/apparmor.d/local/usr.bin.evince .

After I ran
'sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince'once more, I found that point-and-click works as it should.

I don't pretend to understand what is going on here, but in summary it appears that if the additional lines are added to /etc/apparmor.d/usr.bin.evince rather than to /etc/apparmor.d/local/usr.bin.evince it all works.


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user