#860347 xserver-xorg-core: can't produce script.log for running X server via sudo (work around: sudo -i and then run the script)

Package:
xserver-xorg-core
Source:
xorg-server
Description:
Xorg X server - core server
Submitter:
Mark
Date:
2019-10-12 14:45:03 UTC
Severity:
important
#860347#5
Date:
2017-04-14 21:41:59 UTC
From:
To:
Dear Maintainer,

For the ability to file other bug reports, this bug is in fact responsible for
affecting.

I cannot, via the command
"sudo /usr/share/bug/xorg/script 3>/tmp/script.log"

produce a script.log, say, for an attachment to a bug report. I am given:

/usr/share/bug/xorg/script: 19: /usr/share/bug/xorg/script: 3: Bad file
descriptor

#860347#8
Date:
2017-04-14 23:38:23 UTC
From:
To:
At 2017-04-14T14:41:59-0700, Mark wrote:

I think this may be a shell usage problem.

File descriptor (fd) 3 is not open by default.  Only the standard file
descriptors are; see stdin(3)[1].

The bug script redirects its standard output to fd 3.  It is the
responsibilty of the calling environment to open that fd.

You could write a small wrapper script that opens fd 3, directs it to a
file, and then executes the bug script.

$ cat > bugwrap
#!/bin/sh
exec 3> /tmp/script.log
exec /usr/share/bug/xorg/script
^D
$ chmod 600 bugwrap
$ sudo ./bugwrap

Regards,
Branden

[1] in the manpages-dev package

#860347#13
Date:
2017-04-15 07:55:05 UTC
From:
To:
Hi!

The problem is that you're trying to run the script with 'sudo' which
doesn't work. Becoming root first, then running the script works
as expected though:

glaubitz@ikarus:~$ sudo /usr/share/bug/xorg/script 3>/tmp/script.log
/usr/share/bug/xorg/script: 19: /usr/share/bug/xorg/script: 3: Bad file descriptor
glaubitz@ikarus:~$ sudo -i
root@ikarus:~# /usr/share/bug/xorg/script 3>/tmp/script.log
root@ikarus:~# head /tmp/script.log
/etc/X11/X does not exist.
/etc/X11/X is not a symlink.
/etc/X11/X is not executable.

VGA-compatible devices on PCI bus:
----------------------------------
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 5500 [8086:1616] (rev 09)

/etc/X11/xorg.conf does not exist.

root@ikarus:~#

Adrian

#860347#22
Date:
2019-10-12 14:34:04 UTC
From:
To:
I stumbled into this bug today and, according to my findings, this is
due to `/bin/sh' being symlinked to `/bin/dash'.

If you replace `#!/bin/sh' with `#!/bin/bash', it works.