Ok, I think I've fixed it. Please bear with me if the fix is not perfect
/ there's something wrong with it that I've missed, I'm no Python
developer nor I've ever developed for GNOME projects.

Here's the patch:

--- /usr/bin/gnome-terminal     2024-09-16 15:44:46.000000000 +0200
+++ gnome-terminal      2024-10-18 19:04:30.926428246 +0200
@@ -39,10 +39,8 @@
 
     def server_appeared(self, con, name, owner):
         # start gnome-terminal now
-         Gio.Subprocess.new(['/usr/bin/gnome-terminal.real',
-                             '--app-id', name] +
-                             self.args,
-                             Gio.SubprocessFlags.NONE)
+         self.args[1:1]=['--app-id', name]
+         Gio.Subprocess.new(self.args, Gio.SubprocessFlags.NONE)
 
     def spawn_terminal_server(self, name, cls):
         args = ['/usr/libexec/gnome-terminal-server',


The issue is with a superflous argument during the invocation of 
`gnome-terminal.real` (as Egmont Koblinger mentioned) *and* with how arguments 
are ordered before the invocation; self.args already contains 
`/usr/bin/gnome-terminal.real` (along with the list of arguments), so the fix 
is to *not* inject another `/usr/bin/gnome-terminal.real` + `--app-id=name` at 
the start of the argument list and rather inject just `--app-id=name` after the 
first element in self.args (hence after `/usr/bin/gnome-terminal.real`).

I haven't tested this extensively, but after the patch I can succesfully
start the server and invoke new instances passing `--class`.

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to gnome-terminal in Ubuntu.
https://bugs.launchpad.net/bugs/2073881

Title:
  gnome-terminal stopped accepting arguments: # Failed to parse
  arguments: Too many arguments

Status in gnome-terminal package in Ubuntu:
  Confirmed

Bug description:
  I have created a simple org.weechat.weechat-ssh.desktop to launch
  gnome-terminal with an app-id, window title, etc using

  gnome-terminal --window --disable-factory --class weechat-ssh --name
  weechat-ssh --app-id org.weechat.weechat-ssh --title WeeChat -- ssh
  -oControlMaster=no -i /home/jak/.ssh/weechat_ssh_id_rsa -o
  IdentitiesOnly=yes -t weechat@10.0.0.1 -- tmux attach -dt irc

  
  This stopped working with the (AFAICT) gnome-terminal:amd64 (3.52.0-1ubuntu2 
-> 3.52.2-1ubuntu1) update.

  Even reducing the argument list further breaks:

  jak@jak-t14-g3:~/.local/share/applications$ $ gnome-terminal --window --class 
weechat-ssh 
  # Failed to parse arguments: Too many arguments
  jak@jak-t14-g3:~/.local/share/applications$ gnome-terminal  --class 
weechat-ssh 
  # Failed to parse arguments: Too many arguments

  ProblemType: Bug
  DistroRelease: Ubuntu 24.10
  Package: gnome-terminal 3.52.2-1ubuntu1
  ProcVersionSignature: Ubuntu 6.8.0-31.31-generic 6.8.1
  Uname: Linux 6.8.0-31-generic x86_64
  NonfreeKernelModules: zfs
  ApportVersion: 2.28.1-0ubuntu4
  Architecture: amd64
  CasperMD5CheckResult: pass
  CurrentDesktop: GNOME
  Date: Tue Jul 23 22:06:54 2024
  InstallationDate: Installed on 2022-11-26 (605 days ago)
  InstallationMedia: Ubuntu 23.04 "Lunar Lobster" - Alpha amd64 (20221126)
  SourcePackage: gnome-terminal
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/2073881/+subscriptions


-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to