Bug#994848: xterm: "xterm -e command" should return the exit code of "command"

2021-09-22 Thread Axel Beckert
Hi Sven,

Sven Joachim wrote:
> > for test suites of tools which manipulate terminals, it would be nice if
> > "xterm -e command" would return the exit code of "command", e.g.
> >
> >   $ xterm -e false
> >
> > should exit with return code 1, but actually does exit with return code 0.
> 
> That would certainly be useful for automatic tests, but seems to clash
> with xterm's current use of error return codes when it itself encounters
> a fatal problem.

Indeed. Maybe a new option is then the better way to go here. My
suggestion would be "-E" similar how Perl' -e and -E work. They do the
same, but -E does more.

> All the terminal emulators on my system behave the same way as xterm and
> happily exit 0, even when the command specified in the -e option cannot
> be found.

For my current use case I used the following workaround to transport
output and exit code:

  override_dh_auto_test:
xvfb-run xterm -e '( dh_auto_test ; echo $$? ) | tee 
debian/xterm_dh_auto_test.log'
cat debian/xterm_dh_auto_test.log
sh -c 'exit $$(tail -1 debian/xterm_dh_auto_test.log)'

Quite hackish, but seems to work so far. (Double dollar sign due to
being Makefile syntax.)

Only downside so far: I can't capture STDERR because as soon as I add
"2>&1", xtermcontrol argues it can't find the controlling terminal
anymore. But that might be an xtermcontrol issue.

Regards, Axel
-- 
 ,''`.  |  Axel Beckert , https://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-|  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



Bug#994848: xterm: "xterm -e command" should return the exit code of "command"

2021-09-22 Thread Sven Joachim
On 2021-09-21 22:52 +0200, Axel Beckert wrote:

> Package: xterm
> Version: 368-2
> Severity: wishlist
> Tags: upstream
>
> Hi,
>
> for test suites of tools which manipulate terminals, it would be nice if
> "xterm -e command" would return the exit code of "command", e.g.
>
>   $ xterm -e false
>
> should exit with return code 1, but actually does exit with return code 0.

That would certainly be useful for automatic tests, but seems to clash
with xterm's current use of error return codes when it itself encounters
a fatal problem.  See the "ERROR MESSAGES" section in the manpage.

All the terminal emulators on my system behave the same way as xterm and
happily exit 0, even when the command specified in the -e option cannot
be found.

Cheers,
   Sven



Bug#994848: xterm: "xterm -e command" should return the exit code of "command"

2021-09-21 Thread Axel Beckert
Package: xterm
Version: 368-2
Severity: wishlist
Tags: upstream

Hi,

for test suites of tools which manipulate terminals, it would be nice if
"xterm -e command" would return the exit code of "command", e.g.

  $ xterm -e false

should exit with return code 1, but actually does exit with return code 0.

This issue might be related with https://bugs.debian.org/427798 as being
able to save the contents of the terminal would be nice in the above
mentioned use case as well.

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (980, 'unstable-debug'), (600, 'testing'), 
(111, 'buildd-unstable'), (111, 'buildd-experimental'), (110, 'experimental'), 
(105, 'experimental-debug')
Architecture: amd64 (x86_64)

Kernel: Linux 5.13.0-trunk-amd64 (SMP w/2 CPU threads)
Kernel taint flags: TAINT_CPU_OUT_OF_SPEC
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages xterm depends on:
ii  libc6   2.32-4
ii  libfontconfig1  2.13.1-4.2
ii  libfreetype62.10.4+dfsg-1
ii  libice6 2:1.0.10-1
ii  libtinfo6   6.2+20210905-1
ii  libutempter01.2.1-2
ii  libx11-62:1.7.2-2+b1
ii  libxaw7 2:1.0.13-1.1
ii  libxext62:1.3.4-1
ii  libxft2 2.3.2-2
ii  libxinerama12:1.1.4-2
ii  libxmu6 2:1.1.2-2+b3
ii  libxpm4 1:3.5.12-1
ii  libxt6  1:1.2.0-1
ii  xbitmaps1.1.1-2.1

Versions of packages xterm recommends:
ii  x11-utils  7.7+5

Versions of packages xterm suggests:
pn  xfonts-cyrillic  

-- no debconf information