Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Сustom commands - does not work #1243

Closed
igorog opened this issue Apr 10, 2018 · 41 comments
Closed

Сustom commands - does not work #1243

igorog opened this issue Apr 10, 2018 · 41 comments

Comments

@igorog
Copy link

igorog commented Apr 10, 2018

Arch Linux 'any' Repository: guake 3.0.5-2 Community Maintainers: Balló György Build Date: 2018-03-27 16:51 UTC Last Updated: 2018-03-27 17:00 UTC
System: (Linux 4.15.15-1-ARCH #1 SMP PREEMPT Sat Mar 31 23:59:25 UTC 2018 x86_64 GNU/Linux)
DE: Cinnamon
Steps to reproduce: I created the file ~/.config/gconf/apps/guake/custom-command-file.json, but after selecting a command, from the context menu - nothing happens. My commands are not executed! Please check:
custom-command-file.txt

Output when click custom commands from context menu:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/guake/guake_app.py", line 493, in execute_context_menu_cmd
    self.execute_command(cmd)
  File "/usr/lib/python3.6/site-packages/guake/guake_app.py", line 550, in execute_command
    terminal.feed_child(command, len(command))
TypeError: Vte.Terminal.feed_child() takes exactly 2 arguments (3 given)
@igorog igorog changed the title Сustom commands - do not work Сustom commands - does not work Apr 10, 2018
@gsemet gsemet added this to the 3.1.0 milestone Apr 10, 2018
@gsemet
Copy link
Member

gsemet commented Apr 11, 2018

fixed on HEAD

@gsemet gsemet closed this as completed Apr 11, 2018
@igorog
Copy link
Author

igorog commented Apr 17, 2018

Hello! Today I installed, finally, a new version of Guake v3.2, but bug with non-working custom-commands so remained.
After selecting a command, from the context menu - nothing happens. My commands are not executed!
New Output, when click custom commands from context menu:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/guake/terminal.py", line 122, in feed_child
    super().feed_child(resolved_cmdline, len(resolved_cmdline))
TypeError: Vte.Terminal.feed_child() takes exactly 2 arguments (3 given)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/guake/guake_app.py", line 502, in execute_context_menu_cmd
    self.execute_command(cmd)
  File "/usr/lib/python3.6/site-packages/guake/guake_app.py", line 559, in execute_command
    terminal.feed_child(command)
  File "/usr/lib/python3.6/site-packages/guake/terminal.py", line 125, in feed_child
    super().feed_child(resolved_cmdline)
TypeError: Must be number, not str

@gsemet
Copy link
Member

gsemet commented Apr 17, 2018

Oh, what version of the vte component do you have ? Look like you use the old api

@gsemet
Copy link
Member

gsemet commented Apr 17, 2018

I used your command file and it worked, does it fails on every command on only one particular?

@msoute
Copy link

msoute commented Apr 17, 2018

Same issue here, also on Arch. Vte is VTE Application 0.52.1.

@igorog
Copy link
Author

igorog commented Apr 18, 2018

I have, now established version of vte3 0.52.1-1 (Last Updated in Arch-repository: | 2018-04-09 20:28 UTC). But I tried to install and: vte3-git 0.39.91 and vte-legacy 0.28.2-10 (for use with GTK2). The custom commands does not work on any of these versions of vte.
Still. Maybe it's important. When you run quake spilling that such warnings:

(guake:21687): Vte-WARNING **: 12:01:54.104: (vtegtk.cc:1916):int vte_terminal_match_add_regex(VteTerminal*, VteRegex*, guint32): runtime check failed: (_vte_regex_get_compile_flags(regex) & PCRE2_MULTILINE)

@gsemet
Copy link
Member

gsemet commented Apr 18, 2018

Vte is really a mess to deal with. They break the api every few version and does not follow semver (Gtk being even worst).
So pcre2 multiline can indeed be incompatible with old version.

@gsemet gsemet reopened this Apr 18, 2018
@ivoshm
Copy link

ivoshm commented Apr 18, 2018

On actual Manjaro/ArchLinux is possible to invoke this problem even easier - for example run
guake -n /tmp -e 'ssh somewhere'
and error is here (executed program isn't important).

Workaround: downgrade vte3 package (for me works previous version 0.51.3-0.1).

@gsemet gsemet modified the milestones: 3.1.0, Next version Apr 18, 2018
@gsemet
Copy link
Member

gsemet commented Apr 18, 2018

works for me :(

@gsemet
Copy link
Member

gsemet commented Apr 18, 2018

Sorry guys, I have added a new change on HEAD, but I think it will fail on your version of VTE.

Can one of you try to fix the line in GuakeTerminal.feed_child with the call to feed_child_binary?
I don't know what it should receive (feed_child_binary should receive an int, feed_child works with string for me).

Between the version of VTE and the adaptation layer PyVTE that does some magic, I am lost, and I still not have a way to test on VTE >=0.50 (I am on VTE 0.42 on Ubuntu).

Also, these feed_child* had recent changes and the doc is not clear (the signature changed between two versions, I guess due to a change in PyVTE).

So for this, can one of you checkout the code, use make run to test locally and get a PR that works on your VTE ?
thanks

@gsemet gsemet mentioned this issue Apr 18, 2018
@gsemet
Copy link
Member

gsemet commented Apr 18, 2018

So, I finally got a fedora 26 with vte 0.52 working, the HEAD works great.

@igorog
Copy link
Author

igorog commented Apr 19, 2018

Hello! I tried on your advice to change the call feed_child to feed_child_binary and, unfortunately, it did not fix the problem. The error output is exactly the same:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/guake/guake_app.py", line 502, in execute_context_menu_cmd
    self.execute_command(cmd)
  File "/usr/lib/python3.6/site-packages/guake/guake_app.py", line 559, in execute_command
    terminal.feed_child_binary(command)
  File "/usr/lib/python3.6/site-packages/guake/terminal.py", line 125, in feed_child_binary
    super().feed_child_binary(resolved_cmdline)
TypeError: Must be number, not str

I feel sorry.

@igorog
Copy link
Author

igorog commented Apr 19, 2018

The problem is really in version vte. I have now installed the version 0.50.2.a-1 (vte3-ng-fullwidth-emoji) from the AUR repository and... tadaaaam! - custom commands are working!!! Hurray! I'm thrilled. Gsemet, thank you for the tips and your participation!
Joy was premature. Now conflict with other packages that need vte3. (((

@gsemet
Copy link
Member

gsemet commented Apr 19, 2018 via email

@igorog
Copy link
Author

igorog commented Apr 19, 2018

Gaetan! As I already wrote in the previous post - fixing the health of custom commands by "manual" lowering the VTE version - this is, as it turns out, a bad practice in Arch Linux. In connection with the "manual" lowering of the proposed packages (specifically VTE) - newly installed packages will have to manually register different system dependencies, and it is "crooked and not aesthetically pleasing" : ). Therefore, it is not applicable to the General public. It is necessary to look still normal decision with respect to VTE version >= 0.52, unfortunately. (((

Igor

@gsemet
Copy link
Member

gsemet commented Apr 19, 2018

Do you have an iso I can arch linux easily from (boot directly in GNOME with VTE, ...)? I don't know this system and how to install it on Parallel?

PS: on fedora, 0.52 works :(

@ivoshm
Copy link

ivoshm commented Apr 19, 2018

@gsemet Try Manjaro GNOME edition ... it's actual Arch Linux with GNOME customization. Download on https://manjaro.org/get-manjaro/ as ISO image, boot it and use it in Live Distro mode (without installation).

@ivoshm
Copy link

ivoshm commented Apr 19, 2018

My little investigation:
Problematic files are probably /usr/lib/girepository-1.0/Vte-2.91.typelib and/or /usr/share/gir-1.0/Vte-2.91.gir (both installed from vte3 package). If I replace first one with older version (from 0.51.3 package) problem disappears.
But this is some Python GObject "magic" and I don't know much about it.

@igorog
Copy link
Author

igorog commented Apr 19, 2018

Try Manjaro GNOME edition...

By the way, yes, probably, a good option

@gsemet
Copy link
Member

gsemet commented Apr 19, 2018

if you find the right python call I can encapsulate on try except to that it can work no matter the system...

will try to install manjaro this evening :)

@ivoshm
Copy link

ivoshm commented Apr 19, 2018

GIR file looks like XML annotation for GObject API - I diffed it and the only differences are data type of parameter text - first one is string, second is one field array with string inside.

OLD GIR (working)

<method name="feed_child" c:identifier="vte_terminal_feed_child">
... 
<parameters>
...
  <instance-parameter name="terminal" transfer-ownership="none">
    <doc xml:space="preserve">a #VteTerminal</doc>
    <type name="Terminal" c:type="VteTerminal*"/>
  </instance-parameter>
  <parameter name="text"
             transfer-ownership="none"
             nullable="1"
             allow-none="1">
    <doc xml:space="preserve">data to send to the child</doc>
    <type name="utf8" c:type="const char*"/>
 </parameter>
  <parameter name="length" transfer-ownership="none">
    <doc xml:space="preserve">length of @text in bytes, or -1 if @text is NUL-terminated</doc>
    <type name="gssize" c:type="gssize"/>
  </parameter>
</parameters>
</method>

NEW GIR (not working)

<method name="feed_child" c:identifier="vte_terminal_feed_child">
...
<parameters>
  <instance-parameter name="terminal" transfer-ownership="none">
    <doc xml:space="preserve">a #VteTerminal</doc>
    <type name="Terminal" c:type="VteTerminal*"/>
  </instance-parameter>
    <parameter name="text"
             transfer-ownership="none"
             nullable="1"
             allow-none="1">
    <doc xml:space="preserve">data to send to the child</doc>
    <array length="1" zero-terminated="0" c:type="char*">
      <type name="gchar"/>
    </array>
  </parameter>
  <parameter name="length" transfer-ownership="none">
    <doc xml:space="preserve">length of @text in bytes, or -1 if @text is NUL-terminated</doc>
    <type name="gssize" c:type="gssize"/>
  </parameter>
</parameters>
</method> 

DIFF

*OLD* >>> <type name="utf8" c:type="const char*"/>
*NEW* <<< <array length="1" zero-terminated="0" c:type="char*"><type name="gchar"/></array>

PS: Attention - Manjaro is addictive :-)

@Dn4g
Copy link

Dn4g commented Apr 20, 2018

I have install vte3-ng-fullwidth-emoji - it's works for me at Manjaro Gnome.
Love you @igorog

@gsemet
Copy link
Member

gsemet commented Apr 24, 2018

So I got manjaro on my parallels. Parallels tools does not install yet but I think I'll be able to start working on this asap :)

If anyone of you is motivated enough to work on stabilizeing Guake on Arch, that would still help me a lot !

@igorog
Copy link
Author

igorog commented Apr 24, 2018

I'm ready, than I will be able to help you. 😄

@aichingm
Copy link
Collaborator

aichingm commented Apr 25, 2018

I'm on arch and Custom-Commands are working fine for me.
Guake Terminal: 3.2.1
VTE: 0.52.1
VTE runtime: 0.52.1
Gtk: 3.22.30

Commands file:

[
    {
        "description": "ls",
        "cmd": ["ls",""]
    }
]

guake -n /tmp -e 'ls' also work fine for me.

@igorog
Copy link
Author

igorog commented Apr 25, 2018

Custom-Commands are working fine for me

"If something doesn't work for you, you just don't know how to cook it." 😃 Teach how to cook Arch properly to work. Your file doesn't work for me as well as mine.
The versions are exactly the same as yours:

Guake Terminal: 3.2.1
VTE: 0.52.1
VTE runtime: 0.52.1
Gtk: 3.22.30

@gsemet
Copy link
Member

gsemet commented Apr 25, 2018

So yesterday I tested arch and on manjaro the quickopen and url links did not work indeed. Not tested custom commands

@aichingm
Copy link
Collaborator

@igorog What I was trying to say was that this is not a problem with guake's code but rather with some packages. Are you on "real" arch or a derivation like manjaro or antergos (at least for antergos I can tell that they patch some packages)?

Teaching how to cook arch: Run pacman -Syyu guake vte3 vte-common 😆

@igorog
Copy link
Author

igorog commented Apr 25, 2018

Are you on "real" arch

I'm on the "purest" Arch. 😄

Teaching how to cook arch

And such "dishes" I have learned to cook. Not helping. 😄

@gsemet
Copy link
Member

gsemet commented Apr 25, 2018

If you find limitation on Arch, please add in the doc (FAQ or arch specific section) ! Thanks for the help guys !

@gsemet gsemet modified the milestones: 3.2.1, 0-Next Version Apr 25, 2018
@igorog
Copy link
Author

igorog commented Apr 26, 2018

Thank you, Gaetan! You beat this bug! I have now compiled a new version of 3.2.1 (because it does not exist in the arch repository) and everything works.
Supper!!!

@nberlee
Copy link

nberlee commented Apr 26, 2018

Ive been silently following this thread as I have the same problem, but not anymore.
I just installed the arch update package of guake (3.2.1-1) this morning and now it all works again

@igorog igorog closed this as completed Apr 26, 2018
@gsemet
Copy link
Member

gsemet commented Apr 26, 2018

It is what I call a team work :)

@gsemet gsemet modified the milestones: -- Next Version --, 3.2.2 May 31, 2018
@KeynesYouDigIt
Copy link

KeynesYouDigIt commented Jul 14, 2018

Im having this issue on ubuntu 18 -

  File "/usr/bin/guake", line 10, in <module>
    sys.exit(exec_main())
  File "/usr/lib/python3/dist-packages/guake/main.py", line 356, in exec_main
    if not main():
  File "/usr/lib/python3/dist-packages/guake/main.py", line 297, in main
    remote_object.execute_command(options.command)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 70, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.TypeError: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/service.py", line 707, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/python3/dist-packages/guake/dbusiface.py", line 103, in execute_command
    self.guake.execute_command(command)
  File "/usr/lib/python3/dist-packages/guake/guake_app.py", line 549, in execute_command
    terminal.feed_child(command, len(command))
TypeError: Vte.Terminal.feed_child() takes exactly 2 arguments (3 given)
$ guake --version
Guake Terminal 3.0.5

any time I run a command with guake -e

@gsemet
Copy link
Member

gsemet commented Jul 14, 2018

please update using pip: pip install --user guake

@omidraha
Copy link

For Guake 3.3.0,
When you release package for Ubuntu 18.04?

I have the same problem:

Info:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04 LTS
Release:	18.04
Codename:	bionic
Guake Terminal 3.0.5

Traceback:

Traceback (most recent call last):
  File "/usr/bin/guake", line 10, in <module>
    sys.exit(exec_main())
  File "/usr/lib/python3/dist-packages/guake/main.py", line 356, in exec_main
    if not main():
  File "/usr/lib/python3/dist-packages/guake/main.py", line 297, in main
    remote_object.execute_command(options.command)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.TypeError: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/service.py", line 707, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/python3/dist-packages/guake/dbusiface.py", line 103, in execute_command
    self.guake.execute_command(command)
  File "/usr/lib/python3/dist-packages/guake/guake_app.py", line 549, in execute_command
    terminal.feed_child(command, len(command))
TypeError: Vte.Terminal.feed_child() takes exactly 2 arguments (3 given)

@gsemet,
And after installing with pip, I get this error, when running Guake:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 175, in activate_name_owner
    return self.get_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 361, in get_name_owner
    's', (bus_name,), **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'org.guake3.RemoteControl': no such name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/guake/main.py", line 273, in main
    remote_object = bus.get_object(DBUS_NAME, DBUS_PATH)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.guake3.RemoteControl was not provided by any .service files

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/guake", line 11, in <module>
    sys.exit(exec_main())
  File "/usr/local/lib/python3.6/dist-packages/guake/main.py", line 388, in exec_main
    if not main():
  File "/usr/local/lib/python3.6/dist-packages/guake/main.py", line 287, in main
    from guake.guake_app import Guake
  File "/usr/local/lib/python3.6/dist-packages/guake/guake_app.py", line 55, in <module>
    from guake.about import AboutDialog
  File "/usr/local/lib/python3.6/dist-packages/guake/about.py", line 28, in <module>
    from guake.common import gladefile
  File "/usr/local/lib/python3.6/dist-packages/guake/common.py", line 30, in <module>
    from guake.paths import GLADE_DIR
ModuleNotFoundError: No module named 'guake.paths'

@gsemet
Copy link
Member

gsemet commented Jul 16, 2018

I don’t do packaging. I see guake not being updated in fedora and debian and that annoys me a lot :( arch is pretty much up to date.
That’s why I provide the pip install.

Please ensure to remove everything in /usr/local/lib/python3.6/dist-package/guake and use pip install —user

@omidraha
Copy link

Thanks, fixed by run this command as not root:
$ pip install guake —user guake

@egmontkob
Copy link

Here's the story.

VTE's C api did not change, but its Python bindings indeed did. The intended, correct, and as of vte-0.52 finally achieved version is where there is no separate parameter for the length, that is, only 2 arguments are passed to the method. The "(array length=length)" annotation is responsible for this correct binding.

The feed() method (irrelevant here) had it at least since 0.38 (the beginning of the current VTE API).

The feed_child_binary() method (still not what you have problems with) received this fix in version 0.46, silently squeezed into a bigger commit 00f252725.

The feed_child() method, what you care about, only got this fix for version 0.52 as commit a1cd4a4e6.

Now comes the twist.

Ubuntu breaks it.

(Xenial is still okay, Y-Z-A are beyond EOL, so I only care about Bionic LTS and future releases.)

In the original Bionic release they had a faulty change (silently squeezed into their big PCRE2 patch) that erroneously removed the required annotation from all three of these methods, requiring them to take 3 parameters. In a subsequently released fix they removed this broken patch, "fixing" VTE (making it behave as upstream), but this on the other hand broke some apps that relied on the broken behavior. Therefore, in turn, they are about to reintroduce this patch for Bionic, see Launchpad 1780501.

As far as I understand, and I do sincerely hope, they only do this back and forth in Bionic; in Cosmic they'll hopefully settle with the correct mainstream solution and fix all the apps that relied on the faulty behavior.

What can you do for now?

  • Use try-except.

  • Branch on vte version, and blame Ubuntu for the remaining breakages.

  • Require vte >= 0.52, use two parameters, and blame Ubuntu for the remaining breakages.

  • Require vte >= 0.46, do the charset conversion manually, use feed_child_binary() with two parameters, and blame Ubuntu for the remaining breakages.

I'm sorry for any inconvenience this story caused.

@gsemet
Copy link
Member

gsemet commented Aug 3, 2018

Thanks for your comment ! help understanding. If try/except does the job, let's stick with this brutal-yet-effective approach

@egmontkob
Copy link

Only after submitting my comment did I realize that you have already implemented try/except. Sure, probably the most reasonable solution in this mess!

reback00 added a commit to reback00/void-packages that referenced this issue Jun 28, 2019
1. [template] Added additional dependencies against build warnings
2. [patch] Updated for latest meson
3. [patch] Updated for latest python module name (instead of deprecated `python3` module, changed to `python` module, according to: https://mesonbuild.com/Release-notes-for-0-48-0.html#dependencyversion-now-applies-to-all-dependency-types )
4. [patch] Fixed breakage of write functionality due to recent changes in Vte python bindings. Used to raise a `TypeError: Vte.Terminal.feed_child() takes exactly 2 arguments (3 given)` error which has been fixed. (Explanation here: Guake/guake#1243 (comment) )
pullmoll pushed a commit to void-linux/void-packages that referenced this issue Jun 30, 2019
1. [template] Added additional dependencies against build warnings
2. [patch] Updated for latest meson
3. [patch] Updated for latest python module name (instead of deprecated `python3` module, changed to `python` module, according to: https://mesonbuild.com/Release-notes-for-0-48-0.html#dependencyversion-now-applies-to-all-dependency-types )
4. [patch] Fixed breakage of write functionality due to recent changes in Vte python bindings. Used to raise a `TypeError: Vte.Terminal.feed_child() takes exactly 2 arguments (3 given)` error which has been fixed. (Explanation here: Guake/guake#1243 (comment) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants