I am having issues getting the pv command to work with tar using Bash process substitution.
I can use pv like this, and it works:
$ tar cvf - dir | pv > file.tar
dir/
dir/b
dir/a
10KiB 0:00:00 [16.9MiB/s] [<=> ]
$ ls -s file.tar
12 file.tar
Using process substitution with cat also works:
$ tar cvf >(cat > file.tar) dir
dir/
dir/b
dir/a
$ ls -s file.tar
12 file.tar
But this command results in an empty file.tar:
$ tar cvf >(pv > file.tar) dir
dir/
dir/b
dir/a
$ ls -s file.tar
0 file.tar
I have also tried tar cvf >(pv - > file.tar) dir with the same result.
My goal is to have pv print out progress, and pipe the output of tar (i.e., the list of files and any errors) to other commands for additional processing. The first example command above only results in 2 output streams: stdout contains the binary tar data, and stderr contains both the list of files and any error messages. Using process substitution will result in 3 output streams: the binary tar data goes to the new process, stdout contains the list of files, and stderr contains any error messages.
Can I use the pv command with Bash process substitution, and if so, how?
I am using pv 1.6.0 and GNU bash, version 4.3.46(1)-release.
Interestingly, if I use strace to try and debug pv, it works:
$ tar cvf >(strace pv > file.tar) dir
dir/
dir/b
dir/a
execve("/usr/bin/pv", ["pv"], [/* 75 vars */]) = 0
brk(NULL) = 0x1eb8000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f46c9bac000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=123417, ...}) = 0
mmap(NULL, 123417, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f46c9b8d000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1864888, ...}) = 0
mmap(NULL, 3967392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f46c95c0000
mprotect(0x7f46c977f000, 2097152, PROT_NONE) = 0
mmap(0x7f46c997f000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7f46c997f000
mmap(0x7f46c9985000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f46c9985000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f46c9b8c000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f46c9b8b000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f46c9b8a000
arch_prctl(ARCH_SET_FS, 0x7f46c9b8b700) = 0
mprotect(0x7f46c997f000, 16384, PROT_READ) = 0
mprotect(0x60d000, 4096, PROT_READ) = 0
mprotect(0x7f46c9bae000, 4096, PROT_READ) = 0
munmap(0x7f46c9b8d000, 123417) = 0
brk(NULL) = 0x1eb8000
brk(0x1ed9000) = 0x1ed9000
fstat(0, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
fstat(1, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
ioctl(2, TCGETS, {B38400 opost isig -icanon -echo ...}) = 0
ioctl(2, TCGETS, {B38400 opost isig -icanon -echo ...}) = 0
ioctl(2, TIOCGWINSZ, {ws_row=73, ws_col=178, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(2, TCGETS, {B38400 opost isig -icanon -echo ...}) = 0
ioctl(2, TCGETS, {B38400 opost isig -icanon -echo ...}) = 0
ioctl(2, SNDCTL_TMR_START or TCSETS, {B38400 opost isig -icanon -echo ...}) = 0
ioctl(2, TCGETS, {B38400 opost isig -icanon -echo ...}) = 0
rt_sigaction(SIGPIPE, {SIG_IGN, [], SA_RESTORER, 0x7f46c95f54b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTTOU, {0x408690, [], SA_RESTORER, 0x7f46c95f54b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTSTP, {0x408660, [], SA_RESTORER, 0x7f46c95f54b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGCONT, {0x408710, [], SA_RESTORER, 0x7f46c95f54b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGWINCH, {0x408620, [], SA_RESTORER, 0x7f46c95f54b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x408640, [], SA_RESTORER, 0x7f46c95f54b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGHUP, {0x408640, [], SA_RESTORER, 0x7f46c95f54b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {0x408640, [], SA_RESTORER, 0x7f46c95f54b0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGSYS, {SIG_IGN, [SYS], SA_RESTORER|SA_RESTART, 0x7f46c95f54b0}, {SIG_DFL, [], 0}, 8) = 0
geteuid() = 4841
stat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=110592, ...}) = 0
msgget(0x500112e9, IPC_CREAT|0600) = 2818048
fstat(0, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
fstat(1, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
ioctl(0, TCGETS, 0x7ffc1cd79860) = -1 ENOTTY (Inappropriate ioctl for device)
fstat(0, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
getpid() = 29280
msgrcv(2818048, 0x7ffc1cd797e0, 568, 29280, IPC_NOWAIT) = -1 ENOMSG (No message of desired type)
mmap(NULL, 135168, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f46c9b69000
select(1, [0], [], NULL, {0, 90000}) = 1 (in [0], left {0, 89998})
splice(0, NULL, 1, NULL, 131072, SPLICE_F_MORE) = 10240
select(1, [0], [], NULL, {0, 90000}) = 1 (in [0], left {0, 89999})
splice(0, NULL, 1, NULL, 131072, SPLICE_F_MORE) = 0
read(0, "", 131072) = 0
write(2, " 10KiB 0:00:00 [ 37MiB/s] [ <"..., 178 10KiB 0:00:00 [ 37MiB/s] [ <=> ]) = 178
) = 1
write(2, "\n", 1
) = 1
close(0) = 0
msgctl(2818048, IPC_RMID, 0x7ffc1cd79b30) = 0
ioctl(2, TCGETS, {B38400 opost isig -icanon -echo ...}) = 0
ioctl(2, SNDCTL_TMR_START or TCSETS, {B38400 opost isig -icanon -echo ...}) = 0
ioctl(2, TCGETS, {B38400 opost isig -icanon -echo ...}) = 0
rt_sigaction(SIGPIPE, {SIG_DFL, [], SA_RESTORER, 0x7f46c95f54b0}, NULL, 8) = 0
rt_sigaction(SIGTTOU, {SIG_DFL, [], SA_RESTORER, 0x7f46c95f54b0}, NULL, 8) = 0
rt_sigaction(SIGTSTP, {SIG_DFL, [], SA_RESTORER, 0x7f46c95f54b0}, NULL, 8) = 0
rt_sigaction(SIGCONT, {SIG_DFL, [], SA_RESTORER, 0x7f46c95f54b0}, NULL, 8) = 0
rt_sigaction(SIGWINCH, {SIG_DFL, [], SA_RESTORER, 0x7f46c95f54b0}, NULL, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f46c95f54b0}, NULL, 8) = 0
rt_sigaction(SIGHUP, {SIG_DFL, [], SA_RESTORER, 0x7f46c95f54b0}, NULL, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER, 0x7f46c95f54b0}, NULL, 8) = 0
munmap(0x7f46c9b69000, 135168) = 0
exit_group(0) = ?
+++ exited with 0 +++
$ ls -s file.tar
12 file.tar
Related
So I've known this fact that convolution has commutative/associative property while correlation does not but never really written out a simple example to test this out. (proofs in equation forms exist out there)
I was just trying this simple example:
Image : [1 0 -1 0 1 0 1 1]
A kernel = [-1 0 1]
B kernel = [-1 0 1]
Using convolution, I * (A * B) should equal (I * A) * B, but when I tried this they were not equal.. which confused me a lot. would anyone be able to help out? maybe I made a human error in doing computation.. but they should be equal right? (assuming borders are treated as 0s)
And using correlation, the same should not be equal as I understand.. which they dont, but then, my convolution did not either so lol (but it should!)
Any help would be appreciated.
also,
A*B (convolution) would be [0 -2 0] right?
and AxB (cross correlation) would be [0 2 0]?
The convolution operator is commutative. So, you are right that I*(A*B) should be equal to (I*A)*B. Let's convert this to matrix formation first. Convolution by kernel A can be translated to multiplication by the following convolution matrix, C:
C=
[-1 0 1 0 0 0 0 0]
[ 0 -1 0 1 0 0 0 0]
[ 0 0 -1 0 1 0 0 0]
[ 0 0 0 -1 0 1 0 0]
[ 0 0 0 0 -1 0 1 0]
[ 0 0 0 0 0 -1 0 1]
[ 1 0 0 0 0 0 -1 0]
[ 0 1 0 0 0 0 0 -1]
We have taken the kernel [-1 0 1] and zero-padded it by 5 zeros on first row. Then, each row below is a cyclic shift by 1 position to the right of the preceding row.
So, if we want to compute the convolution of kernel A with I:
I = [1 0 -1 0 1 0 1 1]
We simply compute the matrix-vector multiplication:
C*I^T
(where I^T is the transposed vector).
Following the above formulation, we obtain:
I*(A*B) = (C*C)*I^T
Computing C*C you get the following matrix:
C^2=
[ 1 0 -2 0 1 0 0 0]
[ 0 1 0 -2 0 1 0 0]
[ 0 0 1 0 -2 0 1 0]
[ 0 0 0 1 0 -2 0 1]
[ 1 0 0 0 1 0 -2 0]
[ 0 1 0 0 0 1 0 -2]
[-2 0 1 0 0 0 1 0]
[ 0 -2 0 1 0 0 0 1]
and:
I*(A*B) = (C*C)*I^T =
[ 4]
[ 0]
[-2]
[ 1]
[ 0]
[-2]
[-2]
[ 1]
whereas (I*A)*B is in matrix formulation C*(C*I^T) which is equal to I*(A*B)=(C*C)*I^T from matrix associativity.
You can validate this result by running the following numpy code:
import numpy as np
C = [[-1,0,1,0,0,0,0,0]]
for k in range(7):
C.append(np.roll(C[0],k+1))
C = np.array(C)
#print(C)
I = np.transpose(np.array([[1,0,-1,0,1,0,1,1]]))
print(f'C=\n{C}\n')
print(f'C^2=\n{C#C}\n')
print(f'(C*C)*I=\n{(C#C)#I}\n')
print(f' C*(C*I)=\n{C#(C#I)}\n')
The result of running the above code is:
C=
[[-1 0 1 0 0 0 0 0]
[ 0 -1 0 1 0 0 0 0]
[ 0 0 -1 0 1 0 0 0]
[ 0 0 0 -1 0 1 0 0]
[ 0 0 0 0 -1 0 1 0]
[ 0 0 0 0 0 -1 0 1]
[ 1 0 0 0 0 0 -1 0]
[ 0 1 0 0 0 0 0 -1]]
C^2=
[[ 1 0 -2 0 1 0 0 0]
[ 0 1 0 -2 0 1 0 0]
[ 0 0 1 0 -2 0 1 0]
[ 0 0 0 1 0 -2 0 1]
[ 1 0 0 0 1 0 -2 0]
[ 0 1 0 0 0 1 0 -2]
[-2 0 1 0 0 0 1 0]
[ 0 -2 0 1 0 0 0 1]]
(C*C)*I=
[[ 4]
[ 0]
[-2]
[ 1]
[ 0]
[-2]
[-2]
[ 1]]
C*(C*I)=
[[ 4]
[ 0]
[-2]
[ 1]
[ 0]
[-2]
[-2]
[ 1]]
So you can see that the same result is obtained.
Note that A*B is not [0 -2 0] but [1 0 -2 0 1] because you take A=[-1 0 1] (zero pad it on both sides to it has 2 zeros on each side) and move it as a sliding window over B=[-1 0 1] so first you get: [-1-1, 0-1 + -10, -11 + 00 + 1-1, 10 + 01, 11] = [1 0 -2 0 1]. The resulting convolution of 2 kernels of width n will be of length 2n-1.
I run a adb shell script in background,for example:
sh /data/test.sh &. the thread pid is 2442
After that, I run the exit command. The background script thread will be killed.
I don't know how to fix the problem.
shell background thread should ignore the SIGHUP signal.
more info:
ps -A | grep -E "2442|1007|978"
root 978 1 134760 4860 poll_schedule_timeout 0 S adbd
root 1007 978 33492 2916 sigsuspend 0 S sh
root 2442 1007 33492 3168 0 0 R sh
I fetch signal:
# strace -p 2442
strace: Process 2442 attached
--- SIGHUP {si_signo=SIGHUP, si_code=SI_USER, si_pid=1007, si_uid=0} ---
rt_sigreturn({mask=[RTMIN]}) = 264
rt_sigprocmask(SIG_BLOCK, [CHLD RTMIN], [RTMIN], 8) = 0
rt_sigprocmask(SIG_SETMASK, [RTMIN], [CHLD RTMIN], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD RTMIN], [RTMIN], 8) = 0
madvise(0x74a7648000, 4096, MADV_DONTNEED) = 0
madvise(0x74a7624000, 4096, MADV_DONTNEED) = 0
fcntl(3, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(4, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(5, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(6, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(29, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(30, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(31, F_GETFD) = -1 EBADF (Bad file descriptor)
close(2) = 0
close(1) = 0
close(0) = 0
mprotect(0x74a8298000, 4096, PROT_READ|PROT_WRITE) = 0
mprotect(0x74a8298000, 4096, PROT_READ) = 0
mprotect(0x74a8298000, 4096, PROT_READ|PROT_WRITE) = 0
mprotect(0x74a8298000, 4096, PROT_READ) = 0
munmap(0x74a8298000, 4096) = 0
exit_group(129) = ?
+++ exited with 129 +++
and parent signal info:
strace -p 1007
strace: Process 1007 attached
read(0, "\4", 1) = 1
write(2, "^D\r\n", 4) = 4
ioctl(10, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo ...}) = 0
write(2, "You have running jobs\n", 22) = 22
rt_sigprocmask(SIG_BLOCK, [CHLD RTMIN], [RTMIN], 8) = 0
rt_sigprocmask(SIG_SETMASK, [RTMIN], [CHLD RTMIN], 8) = 0
ioctl(10, TIOCGWINSZ, {ws_row=55, ws_col=102, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(10, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost -isig -icanon -echo ...}) = 0
read(0, "\n", 1) = 1
write(2, "\r\n", 2) = 2
ioctl(10, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo ...}) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD RTMIN], [RTMIN], 8) = 0
rt_sigprocmask(SIG_SETMASK, [RTMIN], [CHLD RTMIN], 8) = 0
ioctl(10, TIOCGWINSZ, {ws_row=55, ws_col=102, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(10, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost -isig -icanon -echo ...}) = 0
read(0, "\4", 1) = 1
write(2, "^D\r\n", 4) = 4
ioctl(10, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo ...}) = 0
kill(-2442, SIGHUP) = 0
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[RTMIN]}) = 0
nanosleep({tv_sec=1, tv_nsec=0}, 0x7ff000fe60) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD RTMIN], [RTMIN], 8) = 0
rt_sigprocmask(SIG_SETMASK, [RTMIN], [CHLD RTMIN], 8) = 0
ioctl(10, TCGETS, {B38400 opost isig icanon echo ...}) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD RTMIN], [RTMIN], 8) = 0
madvise(0x7ec8048000, 4096, MADV_DONTNEED) = 0
madvise(0x7ec8024000, 4096, MADV_DONTNEED) = 0
fcntl(3, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(4, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(5, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(6, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(7, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(8, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(9, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(10, F_GETFD) = 0x1 (flags FD_CLOEXEC)
close(10) = 0
fcntl(11, F_GETFD) = -1 EBADF (Bad file descriptor)
fcntl(31, F_GETFD) = -1 EBADF (Bad file descriptor)
close(2) = 0
close(1) = 0
close(0) = 0
mprotect(0x7ec8b48000, 4096, PROT_READ|PROT_WRITE) = 0
mprotect(0x7ec8b48000, 4096, PROT_READ) = 0
mprotect(0x7ec8b48000, 4096, PROT_READ|PROT_WRITE) = 0
mprotect(0x7ec8b48000, 4096, PROT_READ) = 0
munmap(0x7ec8b48000, 4096) = 0
exit_group(0) = ?
+++ exited with 0 +++
Use the nohup command, thus:
nohup command
This tells Android not to kill the process with SIGHUP. Run nohup --help for more information.
I want to silently test whether X11 is working, from a script.
I keep getting "connect /tmp/.X11-unix/X1: No such file or directory", even if I redirect stdout and stderr to /dev/null with (for example) xset q > /dev/null 2>&1
I strace'd, and it doesn't appear to be getting written by xset. I also strace'd the relevant sshd and it doesn't seem to be writing it either.
xset, xdpyinfo and the test program at How to check if X server is running? all output this useless error message. In fact, so does vim. But "ls" does not.
I also tried: script -e -c 'xset q' /dev/null > /dev/null 2>&1
...but even that outputs the error message.
What do I need to do to silence this overaggressive error message?
Thanks!
PS: Here's an strace of xset q:
20878 execve("/usr/bin/xset", ["xset", "q"], 0x7ffe3e91cfe0 /* 33 vars */) = 0
20878 brk(NULL) = 0x563d8a664000
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=141841, ...}) = 0
20878 mmap(NULL, 141841, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f19ac118000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXmuu.so.1", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\23\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=14528, ...}) = 0
20878 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac144000
20878 mmap(NULL, 2109592, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19abd10000
20878 mprotect(0x7f19abd13000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19abf12000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f19abf12000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXext.so.6", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\2205\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=73640, ...}) = 0
20878 mmap(NULL, 2169496, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19abaf8000
20878 mprotect(0x7f19abb09000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19abd08000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10000) = 0x7f19abd08000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libX11.so.6", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\207\1\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=1277384, ...}) = 0
20878 mmap(NULL, 3374392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19ab7c0000
20878 mprotect(0x7f19ab8f3000, 2097152, PROT_NONE) = 0
20878 mmap(0x7f19abaf3000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x133000) = 0x7f19abaf3000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\34\2\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0755, st_size=2030544, ...}) = 0
20878 mmap(NULL, 4131552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19ab3c8000
20878 mprotect(0x7f19ab5af000, 2097152, PROT_NONE) = 0
20878 mmap(0x7f19ab7af000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f19ab7af000
20878 mmap(0x7f19ab7b5000, 15072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19ab7b5000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libxcb.so.1", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\261\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=162232, ...}) = 0
20878 mmap(NULL, 2257576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19ab1a0000
20878 mprotect(0x7f19ab1c6000, 2097152, PROT_NONE) = 0
20878 mmap(0x7f19ab3c6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7f19ab3c6000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\16\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=14560, ...}) = 0
20878 mmap(NULL, 2109712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aaf98000
20878 mprotect(0x7f19aaf9b000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19ab19a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f19ab19a000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXau.so.6", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\16\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=14456, ...}) = 0
20878 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac142000
20878 mmap(NULL, 2109720, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aad90000
20878 mprotect(0x7f19aad92000, 2097152, PROT_NONE) = 0
20878 mmap(0x7f19aaf92000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f19aaf92000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXdmcp.so.6", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\21\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=22616, ...}) = 0
20878 mmap(NULL, 2117760, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aab88000
20878 mprotect(0x7f19aab8d000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19aad8c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7f19aad8c000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libbsd.so.0", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P4\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=80104, ...}) = 0
20878 mmap(NULL, 2179152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa970000
20878 mprotect(0x7f19aa983000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19aab82000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12000) = 0x7f19aab82000
20878 mmap(0x7f19aab84000, 80, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19aab84000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\"\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=31680, ...}) = 0
20878 mmap(NULL, 2128864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa768000
20878 mprotect(0x7f19aa76f000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19aa96e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f19aa96e000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000b\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0755, st_size=144976, ...}) = 0
20878 mmap(NULL, 2221184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa548000
20878 mprotect(0x7f19aa562000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19aa761000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19000) = 0x7f19aa761000
20878 mmap(0x7f19aa763000, 13440, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19aa763000
20878 close(3) = 0
20878 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac13d000
20878 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac115000
20878 arch_prctl(ARCH_SET_FS, 0x7f19ac115740) = 0
20878 mprotect(0x7f19ab7af000, 16384, PROT_READ) = 0
20878 mprotect(0x7f19aa761000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19aa96e000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19aab82000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19aad8c000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19aaf92000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19ab19a000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19ab3c6000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19abaf3000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19abd08000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19abf12000, 4096, PROT_READ) = 0
20878 mprotect(0x563d8872f000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19ac13f000, 4096, PROT_READ) = 0
20878 munmap(0x7f19ac118000, 141841) = 0
20878 set_tid_address(0x7f19ac115a10) = 20878
20878 set_robust_list(0x7f19ac115a20, 24) = 0
20878 rt_sigaction(SIGRTMIN, {sa_handler=0x7f19aa54dcb0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f19aa55a890}, NULL, 8) = 0
20878 rt_sigaction(SIGRT_1, {sa_handler=0x7f19aa54dd50, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7f19aa55a890}, NULL, 8) = 0
20878 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
20878 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
20878 brk(NULL) = 0x563d8a664000
20878 brk(0x563d8a685000) = 0x563d8a685000
20878 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
20878 connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
20878 close(3) = 0
20878 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
20878 connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
20878 close(3) = 0
20878 openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=529, ...}) = 0
20878 read(3, "# /etc/nsswitch.conf\n#\n# Example"..., 4096) = 529
20878 read(3, "", 4096) = 0
20878 close(3) = 0
20878 stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=304, ...}) = 0
20878 openat(AT_FDCWD, "/etc/host.conf", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=92, ...}) = 0
20878 read(3, "# The \"order\" line is only used "..., 4096) = 92
20878 read(3, "", 4096) = 0
20878 close(3) = 0
20878 futex(0x7f19ab7b7ba4, FUTEX_WAKE_PRIVATE, 2147483647) = 0
20878 openat(AT_FDCWD, "/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=304, ...}) = 0
20878 read(3, "# Dynamic resolv.conf(5) file fo"..., 4096) = 304
20878 read(3, "", 4096) = 0
20878 close(3) = 0
20878 uname({sysname="Linux", nodename="zareason-limbo", ...}) = 0
20878 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=141841, ...}) = 0
20878 mmap(NULL, 141841, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f19ac0f0000
20878 close(3) = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P#\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=47568, ...}) = 0
20878 mmap(NULL, 2168632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa330000
20878 mprotect(0x7f19aa33b000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19aa53a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7f19aa53a000
20878 mmap(0x7f19aa53c000, 22328, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19aa53c000
20878 close(3) = 0
20878 mprotect(0x7f19aa53a000, 4096, PROT_READ) = 0
20878 munmap(0x7f19ac0f0000, 141841) = 0
20878 openat(AT_FDCWD, "/etc/hosts", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=403, ...}) = 0
20878 read(3, "127.0.0.1\tlocalhost\n127.0.1.1\tza"..., 4096) = 403
20878 read(3, "", 4096) = 0
20878 close(3) = 0
20878 socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 3
20878 setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
20878 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
20878 connect(3, {sa_family=AF_INET, sin_port=htons(6013), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
20878 getpeername(3, {sa_family=AF_INET, sin_port=htons(6013), sin_addr=inet_addr("127.0.0.1")}, [124->16]) = 0
20878 uname({sysname="Linux", nodename="zareason-limbo", ...}) = 0
20878 access("/home/dstromberg/.Xauthority", R_OK) = 0
20878 openat(AT_FDCWD, "/home/dstromberg/.Xauthority", O_RDONLY) = 4
20878 fstat(4, {st_mode=S_IFREG|0600, st_size=827, ...}) = 0
20878 read(4, "\1\0\0\16zareason-limbo\0\0010\0\22MIT-MAGIC"..., 4096) = 827
20878 read(4, "", 4096) = 0
20878 close(4) = 0
20878 getsockname(3, {sa_family=AF_INET, sin_port=htons(37214), sin_addr=inet_addr("127.0.0.1")}, [124->16]) = 0
20878 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR)
20878 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
20878 fcntl(3, F_SETFD, FD_CLOEXEC) = 0
20878 poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
20878 writev(3, [{iov_base="l\0\v\0\0\0\22\0\20\0\0\0", iov_len=12}, {iov_base="", iov_len=0}, {iov_base="MIT-MAGIC-COOKIE-1", iov_len=18}, {iov_base="\0\0", iov_len=2}, {iov_base="\256b\245\317f\262\25\254\27\365!H\212\3316J", iov_len=16}, {iov_base="", iov_len=0}], 6) = 48
20878 recvfrom(3, 0x563d8a6660e0, 8, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
20878 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN|POLLERR|POLLHUP}])
20878 recvfrom(3, 0x563d8a6660e0, 8, 0, NULL, NULL) = -1 ECONNRESET (Connection reset by peer)
20878 shutdown(3, SHUT_RDWR) = -1 ENOTCONN (Transport endpoint is not connected)
20878 close(3) = 0
20878 write(2, "xset: unable to open display \"l"..., 47) = 47
20878 exit_group(1) = ?
20878 +++ exited with 1 +++
And here's a type -a xset:
$ type -a xset
below cmd output started 2019 Sun Jun 30 07:49:33 AM PDT
xset is /usr/bin/xset
Running without redirection, to show the order of the messages:
$ xset q
below cmd output started 2019 Sun Jun 30 08:03:24 AM PDT
connect /tmp/.X11-unix/X1: No such file or directory
xset: unable to open display "localhost:13.0"
In response to a comment from melpomene, I set up a test account with no startup files at all. I then ssh -Y'd to it, sudo'd, and got the same error message as described above.
I had been testing in gnome-terminal exclusively. I just tried konsole and again got the offending error message.
I just tried strace'ing the openssh client; it produced a single occurrence of the string "connect", which did not look relevant (other than connecting to the ssh server).
I had been testing exclusively on a Linux Mint 19.1 system. I just tried it on a freshly-installed Debian 9.9 system, and got the same result.
Steps to replicate:
ssh -Y remote.host.example.com
sudo bash
xset -q > /dev/null 2>&1
You may see the offending error message after these 3 simple steps.
This is pretty easy to understand and replicate, but there is a number of moving parts.
We ssh to a remote machine with X forwarding. This ssh process must have access to a working X server locally. Here we'll start it up with a joke $DISPLAY:
(local) $ DISPLAY=:87 ssh -Y remote
Warning: No xauth data; using fake authentication data for X11 forwarding
That Warning is an indication that ssh cannot contact a working X server locally.
On remote $DISPLAY is not :87
(remote) $ echo $DISPLAY
(remote) localhost:11.0
This is the magic that ssh's -Y does and how its X11 proxy works.
We run a command on remote that tries to connect to $DISPLAY:
(remote) $ xset -q
connect /tmp/.X11-unix/X99: No such file or directory
xset: unable to open display "localhost:11.0"
And here is your problem:
(remote) $ xset -q >/dev/null 2>&1
connect /tmp/.X11-unix/X99: No such file or directory
The unable error message was being printed by xset,
and has been redirected away.
However the connect error message is coming out of ssh.
Remember that xset runs on remote,
while ssh is running on local.
You need to validate $DISPLAY on local before running ssh.
You can quieten ssh in a number of ways,
but I'm not a fan of throwing away error messages.
One way would be to reduce the error verbosity:
(local) $ DISPLAY=:87 ssh -Y -o LogLevel=FATAL remote 'xset -q &>/dev/null'
See man ssh_config for a list of ssh settings.
I have a text-menu like script which is used for some small operations.
And inside it there is a read command.
for e.g
read response
Now say if the script is ran and it will wait for user input. I let it stay idle and wait for the TMOUT to kick in. I just wanted to trap this signal and exit.
So I simply try:
trap 'exit' ALRM
read response
But it does not work, the script just kind of loop itself(e.g refresh this menu again)
I tried to do strace on this process when TMOUT comes, and I did see this SIGARLM, kicking in after the select subsystem call, but the script is ignoring it for some reason?
The only thing when it worked was if I do "trap exit ERR" and not "trap exit ALRM"
Any advise please?
strace:
06:49:22 select(1, [0], NULL, NULL, NULL) = ? ERESTARTNOHAND (To be
restarted if no handler)
06:49:32 --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
06:49:32 alarm(0) = 0
06:49:32 rt_sigprocmask(SIG_UNBLOCK, [ALRM], NULL, 8) = 0
06:49:32 ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost isig icanon echo
...}) = 0
06:49:32 ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
06:49:32 write(1, "\n###############################"..., 327) = 327
06:49:32 write(1, "Your choice: ", 13) = 13
06:49:32 rt_sigaction(SIGALRM, {0x453d70, [], SA_RESTORER|SA_INTERRUPT,
0x7f407e998250}, {0x453d70, [], SA_RESTORER|SA_INTERRUPT, 0x7f407e998250},
8) = 0
06:49:32 setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={20, 0}},
{it_interval={0, 0}, it_value={0, 0}}) = 0
06:49:32 rt_sigaction(SIGWINCH, {0x41a760, [], SA_RESTORER|SA_INTERRUPT,
0x7f407e998250}, {0x41a760, [], SA_RESTORER|SA_INTERRUPT, 0x7f407e998250},
8) = 0
06:49:32 ioctl(2, TIOCGWINSZ, {ws_row=59, ws_col=211, ws_xpixel=0,
ws_ypixel=0}) = 0
06:49:32 rt_sigprocmask(SIG_UNBLOCK, [WINCH], NULL, 8) = 0
06:49:32 ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0
06:49:32 ioctl(2, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost -isig -icanon -
echo ...}) = 0
06:49:32 select(1, [0], NULL, NULL, NULL) = ? ERESTARTNOHAND (To be
restarted if no handler)
06:49:52 --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
06:49:52 alarm(0) = 0
06:49:52 rt_sigprocmask(SIG_UNBLOCK, [ALRM], NULL, 8) = 0
06:49:52 ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost isig icanon echo
...}) = 0
06:49:52 ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
06:49:52 write(1, "\n###############################"..., 327) = 327
06:49:52 write(1, "Your choice: ", 13) = 13
06:49:52 rt_sigaction(SIGALRM, {0x453d70, [], SA_RESTORER|SA_INTERRUPT,
0x7f407e998250}, {0x453d70, [], SA_RESTORER|SA_INTERRUPT, 0x7f407e998250},
8) = 0
06:49:52 setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={20, 0}},
{it_interval={0, 0}, it_value={0, 0}}) = 0
06:49:52 rt_sigaction(SIGWINCH, {0x41a760, [], SA_RESTORER|SA_INTERRUPT,
0x7f407e998250}, {0x41a760, [], SA_RESTORER|SA_INTERRUPT, 0x7f407e998250},
8) = 0
06:49:52 ioctl(2, TIOCGWINSZ, {ws_row=59, ws_col=211, ws_xpixel=0,
ws_ypixel=0}) = 0
06:49:52 rt_sigprocmask(SIG_UNBLOCK, [WINCH], NULL, 8) = 0
06:49:52 ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0
06:49:52 ioctl(2, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost -isig -icanon -
echo ...}) = 0
06:49:52 select(1, [0], NULL, NULL, NULL^Cstrace: Process 26653 detached
I'm trying to use cuda-memcheck to debug my application. Ubuntu 12.04, GeForce GTX 680 / K20c, CUDA 6.5.
Trivial example, trivial.cu:
#include <stdio.h>
__global__ void foo()
{
}
int main()
{
foo<<<1,1>>>();
printf("CUDA error: %s\n", cudaGetErrorString(cudaGetLastError()));
return 0;
}
I compiled it via nvcc trivial.cu -o trivial.bin. Running ./trivial.bin directly works fine now. It prints the output:
CUDA error: no error
Now I'm calling it via cuda-memcheck ./trivial.bin. COMPUTE_PROFILE, CUDA_PROFILE, CUDA_INJECTION32_DLL and CUDA_INJECTION64_DLL are all unset. I have write access to /tmp. $TMPDIR = /var/tmp/625352.1.16C-32G-GPU-K20, and I can also write to $TMPDIR.
I'm getting this output:
========= CUDA-MEMCHECK
========= Could not start the application (14)
========= No CUDA-MEMCHECK results found
(It might be SGE related. I'm getting this error only in a non-interactive SGE job.)
I can now reproduce the error in an interactive shell via:
mkdir /var/tmp/625352.1.16C-32G-GPU-K20
export TMPDIR=/var/tmp/625352.1.16C-32G-GPU-K20
cuda-memcheck ./trivial.bin
So it somehow gets confused with this $TMPDIR. This seems like an internal bug in cuda-memcheck.
It seems to happen if the length of $TMPDIR is greater or equal than 30 chars.
I have not found a single result on Google about this error, nor in the documentation.
What is the problem? How can I fix the problem? How can I find out what the error means? What does the error code (14) mean? (And where could I ask?)
strace output:
+ strace cuda-memcheck ./trivial.bin
execve("/usr/local/cuda-6.5/bin/cuda-memcheck", ["cuda-memcheck", "./trivial.bin"], [/* 122 vars */]) = 0
brk(0) = 0x1af8000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b430d6f1000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("tls/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("tls/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib/tls/x86_64", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib/tls", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib/x86_64", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
open("/usr/local/cuda-6.0/lib64/tls/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-6.0/lib64/tls/x86_64", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.0/lib64/tls/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-6.0/lib64/tls", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.0/lib64/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-6.0/lib64/x86_64", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.0/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-6.0/lib64", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib/atlas-base/tls/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/atlas-base/tls/x86_64", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/lib/atlas-base/tls/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/atlas-base/tls", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/lib/atlas-base/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/atlas-base/x86_64", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/lib/atlas-base/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/atlas-base", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/local/cuda-6.5/lib64/tls/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-6.5/lib64/tls/x86_64", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.5/lib64/tls/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-6.5/lib64/tls", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.5/lib64/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-6.5/lib64/x86_64", 0x7fff1cb31520) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.5/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/cuda-6.5/lib64", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=115443, ...}) = 0
mmap(NULL, 115443, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2b430d720000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14768, ...}) = 0
mmap(NULL, 2109704, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2b430d920000
mprotect(0x2b430d922000, 2097152, PROT_NONE) = 0
mmap(0x2b430db22000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x2b430db22000
close(3) = 0
open("tls/x86_64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("tls/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("x86_64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.0/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/atlas-base/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.5/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200l\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=135366, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b430d6f3000
mmap(NULL, 2212904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2b430db28000
mprotect(0x2b430db40000, 2093056, PROT_NONE) = 0
mmap(0x2b430dd3f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x2b430dd3f000
mmap(0x2b430dd41000, 13352, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2b430dd41000
close(3) = 0
open("tls/x86_64/librt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("tls/librt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("x86_64/librt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("librt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/librt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.0/lib64/librt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/atlas-base/librt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.5/lib64/librt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340!\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=31752, ...}) = 0
mmap(NULL, 2128984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2b430dd48000
mprotect(0x2b430dd4f000, 2093056, PROT_NONE) = 0
mmap(0x2b430df4e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x2b430df4e000
close(3) = 0
open("tls/x86_64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("tls/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("x86_64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.0/lib64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/atlas-base/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.5/lib64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\241\5\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=962656, ...}) = 0
mmap(NULL, 3142544, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2b430df50000
mprotect(0x2b430e032000, 2093056, PROT_NONE) = 0
mmap(0x2b430e231000, 40960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe1000) = 0x2b430e231000
mmap(0x2b430e23b000, 82832, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2b430e23b000
close(3) = 0
open("tls/x86_64/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("tls/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("x86_64/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.0/lib64/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/atlas-base/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.5/lib64/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0pU\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1030512, ...}) = 0
mmap(NULL, 3125544, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2b430e250000
mprotect(0x2b430e34b000, 2093056, PROT_NONE) = 0
mmap(0x2b430e54a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xfa000) = 0x2b430e54a000
close(3) = 0
open("tls/x86_64/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("tls/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("x86_64/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.0/lib64/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/atlas-base/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.5/lib64/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320(\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=88384, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b430d6f4000
mmap(NULL, 2184216, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2b430e550000
mprotect(0x2b430e565000, 2093056, PROT_NONE) = 0
mmap(0x2b430e764000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14000) = 0x2b430e764000
close(3) = 0
open("tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.0/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/atlas-base/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/cuda-6.5/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\30\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1815224, ...}) = 0
mmap(NULL, 3929304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2b430e768000
mprotect(0x2b430e91d000, 2097152, PROT_NONE) = 0
mmap(0x2b430eb1d000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b5000) = 0x2b430eb1d000
mmap(0x2b430eb23000, 17624, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2b430eb23000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b430d6f5000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b430d6f6000
arch_prctl(ARCH_SET_FS, 0x2b430d6f6340) = 0
mprotect(0x2b430eb1d000, 16384, PROT_READ) = 0
mprotect(0x2b430e764000, 4096, PROT_READ) = 0
mprotect(0x2b430e54a000, 4096, PROT_READ) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b430d71a000
mprotect(0x2b430e231000, 32768, PROT_READ) = 0
mprotect(0x2b430dd3f000, 4096, PROT_READ) = 0
mprotect(0x2b430df4e000, 4096, PROT_READ) = 0
mprotect(0x2b430db22000, 4096, PROT_READ) = 0
mprotect(0x2b430d91a000, 4096, PROT_READ) = 0
munmap(0x2b430d720000, 115443) = 0
set_tid_address(0x2b430d6f6610) = 2023
set_robust_list(0x2b430d6f6620, 0x18) = 0
futex(0x7fff1cb31e1c, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 2b430d6f6340) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGRTMIN, {0x2b430db2e750, [], SA_RESTORER|SA_SIGINFO, 0x2b430db37cb0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x2b430db2e7e0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x2b430db37cb0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0
futex(0x2b430e23bed0, FUTEX_WAKE_PRIVATE, 2147483647) = 0
brk(0) = 0x1af8000
brk(0x1b19000) = 0x1b19000
fstat(1, {st_mode=S_IFREG|0644, st_size=28120, ...}) = 0
mmap(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b430d71b000
statfs("/dev/shm/", {f_type=0x1021994, f_bsize=4096, f_blocks=4116014, f_bfree=4116014, f_bavail=4116014, f_files=4116014, f_ffree=4116011, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
futex(0x2b430df4f360, FUTEX_WAKE_PRIVATE, 2147483647) = 0
open("/dev/shm/2023", O_RDWR|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/dev/shm/2023", O_RDWR|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/dev/shm/2023", O_RDWR|O_CREAT|O_EXCL|O_TRUNC|O_NOFOLLOW|O_CLOEXEC, 0600) = 3
ftruncate(3, 262176) = 0
mmap(NULL, 262176, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0x2b430d820000
open("/dev/shm/2023", O_RDWR|O_NOFOLLOW|O_CLOEXEC) = 4
lseek(4, 0, SEEK_END) = 262176
mmap(NULL, 262176, PROT_READ|PROT_WRITE, MAP_SHARED, 4, 0) = 0x2b430d868000
write(1, "========= CUDA-MEMCHECK\n========"..., 112========= CUDA-MEMCHECK
========= Could not start the application (14)
========= No CUDA-MEMCHECK results found
) = 112
exit_group(0) = ?
This seems like an internal bug in cuda-memcheck. It seems to happen if the length of $TMPDIR is greater or equal than 30 chars. I guess their internal buffer for storing the temp filename is too short.
As a workaround, I now do:
ln -s $TMPDIR /tmp/cuda-$PPID
export TMPDIR=/tmp/cuda-$PPID