Why are there open syscalls with empty file names? - linux-kernel

When I use opensnoop to watch file access I see a lot of open syscalls with empty file name. For example, strace cat foobar consistently produces one syscall with empty filename,
$ sudo python3 opensnoop.py
PID COMM FD ERR PATH
3819 upowerd 10 0 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/present
3819 upowerd 10 0 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/energy_now
3819 upowerd -1 2 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/voltage_max_design
3819 upowerd 10 0 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/voltage_min_design
3819 upowerd 10 0 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/status
3819 upowerd 10 0 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/power_now
3819 upowerd -1 2 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/charge_full
3819 upowerd -1 2 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/charge_full_design
3819 upowerd -1 2 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/current_now
3819 upowerd 10 0 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/voltage_now
3819 upowerd 10 0 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/capacity
3819 upowerd -1 2 /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0/temp
137272 strace 3 0 /etc/ld.so.cache
137272 strace 3 0 /lib/x86_64-linux-gnu/librt.so.1
137272 strace 3 0 /lib/x86_64-linux-gnu/libunwind-ptrace.so.0
137272 strace 3 0 /lib/x86_64-linux-gnu/libunwind-x86_64.so.8
137272 strace 3 0
137272 strace 3 0 /lib/x86_64-linux-gnu/libpthread.so.0
137272 strace 3 0 /lib/x86_64-linux-gnu/liblzma.so.5
137272 strace 3 0 /lib/x86_64-linux-gnu/libunwind.so.8
137272 strace 3 0 /usr/lib/locale/locale-archive
137272 strace 3 0 /usr/share/locale/locale.alias
137272 strace -1 2 /usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo
137272 strace -1 2 /usr/share/locale/en_US/LC_MESSAGES/libc.mo
137272 strace -1 2 /usr/share/locale/en.utf8/LC_MESSAGES/libc.mo
137272 strace -1 2 /usr/share/locale/en/LC_MESSAGES/libc.mo
137272 strace -1 2 /usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo
137272 strace -1 2 /usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo
137272 strace -1 2 /usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo
137272 strace -1 2 /usr/share/locale-langpack/en/LC_MESSAGES/libc.mo
137275 cat 3 0 /etc/ld.so.cache
137275 cat 3 0 /lib/x86_64-linux-gnu/libc.so.6
137275 cat 3 0 /usr/lib/locale/locale-archive
137275 cat -1 2 foobar
137275 cat 3 0 /usr/share/locale/locale.alias
137275 cat -1 2 /usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo
137275 cat -1 2 /usr/share/locale/en_US/LC_MESSAGES/libc.mo
137275 cat -1 2 /usr/share/locale/en.utf8/LC_MESSAGES/libc.mo
137275 cat -1 2 /usr/share/locale/en/LC_MESSAGES/libc.mo
137275 cat -1 2 /usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo
137275 cat -1 2 /usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo
137275 cat -1 2 /usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo
137275 cat -1 2 /usr/share/locale-langpack/en/LC_MESSAGES/libc.mo
Is there a reason for such behaviour? If I want to trace file accesses do I have to treat empty file names differently? Would I miss anything by filtering them out?
I actually tried opening empty filename, but that gives an error:
// example.c
// https://stackoverflow.com/q/54793898/1374078
#define _GNU_SOURCE
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
int main(void) {
int fd1 = open(".", O_PATH);
if (fd1 == -1) {
perror("open");
return 1;
}
int fd2 = openat(fd1, "", O_RDONLY);
if (fd2 == -1) {
perror("openat");
close(fd1);
return 1;
}
close(fd1);
puts("");
return 0;
}
$ gcc -ox example.c && ./x
openat: No such file or directory
So how do empty file names get to syscalls?
UPDATE
Here is output of strace
$ strace strace cat foobar 2>&1 | grep open
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libunwind-ptrace.so.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libunwind-x86_64.so.8", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/liblzma.so.5", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libunwind.so.8", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "openat(AT_FDCWD, \"/etc/ld.so.cac"..., 55openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 55
write(2, "openat(AT_FDCWD, \"/lib/x86_64-li"..., 70openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 70
write(2, "openat(AT_FDCWD, \"/usr/lib/local"..., 69openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 69
write(2, "openat(AT_FDCWD, \"foobar\", O_RDO"..., 35openat(AT_FDCWD, "foobar", O_RDONLY) = 35
write(2, "openat(AT_FDCWD, \"/usr/share/loc"..., 69openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 69
write(2, "openat(AT_FDCWD, \"/usr/share/loc"..., 77openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = 77
write(2, "openat(AT_FDCWD, \"/usr/share/loc"..., 72openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = 72
write(2, "openat(AT_FDCWD, \"/usr/share/loc"..., 74openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = 74
write(2, "openat(AT_FDCWD, \"/usr/share/loc"..., 69openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = 69
write(2, "openat(AT_FDCWD, \"/usr/share/loc"..., 86openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = 86
write(2, "openat(AT_FDCWD, \"/usr/share/loc"..., 81openat(AT_FDCWD, "/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = 81
write(2, "openat(AT_FDCWD, \"/usr/share/loc"..., 83openat(AT_FDCWD, "/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = 83
write(2, "openat(AT_FDCWD, \"/usr/share/loc"..., 78openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = 78

Related

Sed: delete lines without pattern except first

How to delete lines that do not match the pattern except the first line?
To delete lines except first i use
sed '1!d'
To delete lines that do not match patter i use
sed '/pattern/!d'
How can i use both of conditions? Things like
sed '1!/pattern/!d'
doesn't work, says unknown command: '/'
As example (if pattern="rcu")
from input
PID PPID PRI NI VSZ RSS STAT TIME CMD
1 0 19 0 33664 4832 Ss 00:00:07 /sbin/init splash
2 0 19 0 0 0 S 00:00:00 [kthreadd]
3 2 39 -20 0 0 I< 00:00:00 [rcu_gp]
4 2 39 -20 0 0 I< 00:00:00 [rcu_par_gp]
8 2 39 -20 0 0 I< 00:00:00 [mm_percpu_wq]
9 2 19 0 0 0 S 00:00:04 [ksoftirqd/0]
get
PID PPID PRI NI VSZ RSS STAT TIME CMD
3 2 39 -20 0 0 I< 00:00:00 [rcu_gp]
4 2 39 -20 0 0 I< 00:00:00 [rcu_par_gp]
Thanks
Output first line and all lines which contain rcu:
sed -n '1p; /rcu/p' file
You could also make a script that reads the file and “extracts” first line that don’t match the pattern (to another temporary file or to the string), make other operations like deleting lines that you want to be deleted and paste that line back in the same place in the file.
As you have tagged awk
awk '{if ($0~/rcu/) print}'
Demo :
$ cat file1.txt
PID PPID PRI NI VSZ RSS STAT TIME CMD
1 0 19 0 33664 4832 Ss 00:00:07 /sbin/init splash
2 0 19 0 0 0 S 00:00:00 [kthreadd]
3 2 39 -20 0 0 I< 00:00:00 [rcu_gp]
4 2 39 -20 0 0 I< 00:00:00 [rcu_par_gp]
8 2 39 -20 0 0 I< 00:00:00 [mm_percpu_wq]
9 2 19 0 0 0 S 00:00:04 [ksoftirqd/0]
$ awk '{if ($0~/rcu/) print}' file1.txt
3 2 39 -20 0 0 I< 00:00:00 [rcu_gp]
4 2 39 -20 0 0 I< 00:00:00 [rcu_par_gp]
$
If when you say except the first if you mean except the first line of the input even if it doesn't match the regexp then this is what you want:
$ awk '/rcu/ || NR==1' file
PID PPID PRI NI VSZ RSS STAT TIME CMD
3 2 39 -20 0 0 I< 00:00:00 [rcu_gp]
4 2 39 -20 0 0 I< 00:00:00 [rcu_par_gp]
or if you mean except the first line that doesn't match the regexp then this is what you want:
$ awk '/rcu/ || !c++' file
PID PPID PRI NI VSZ RSS STAT TIME CMD
3 2 39 -20 0 0 I< 00:00:00 [rcu_gp]
4 2 39 -20 0 0 I< 00:00:00 [rcu_par_gp]

Replace the second entry in all lines containing a specific string in bash

I would like to replace the second entry of all (space or tab-separated) lines containing a specific string. In the following text
1078.732700000 0.00001000 1 0 0 39 13 27 0 0 0 40 14 26 81SaWoLa.43 BAD LABEL, REASSIGNED
-1077.336700000 0.00001000 1 0 0 45 12 34 0 0 0 46 13 34 81SaWoLa.48 BAD LABEL
I would like to replace 0.00001000 by 0.00005214 (searching for the string 81SaWoLa). The result should be
1078.732700000 0.00005214 1 0 0 39 13 27 0 0 0 40 14 26 81SaWoLa.43 BAD LABEL, REASSIGNED
-1077.336700000 0.00005214 1 0 0 45 12 34 0 0 0 46 13 34 81SaWoLa.48 BAD LABEL
Could you please help me how to perform it?
Try this for GNU sed:
$ cat input.txt
1078.732700000 0.00001000 1 0 0 39 13 27 0 0 0 40 14 26 81SaWoLa.43 BAD LABEL, REASSIGNED
-1077.336700000 0.00001000 1 0 0 45 12 34 0 0 0 46 13 34 81SaWoLa.48 BAD LABEL
$ sed -r '/81SaWoLa/s/^([^ \t]+[ \t]+)[^ \t]+(.*)/\10.00005214\2/' input.txt
1078.732700000 0.00005214 1 0 0 39 13 27 0 0 0 40 14 26 81SaWoLa.43 BAD LABEL, REASSIGNED
-1077.336700000 0.00005214 1 0 0 45 12 34 0 0 0 46 13 34 81SaWoLa.48 BAD LABEL
You may use awk to achieve your goal more easily.
$ awk '/81SaWoLa/{$2="0.00005214"}1' file
1078.732700000 0.00005214 1 0 0 39 13 27 0 0 0 40 14 26 81SaWoLa.43 BAD LABEL, REASSIGNED
-1077.336700000 0.00005214 1 0 0 45 12 34 0 0 0 46 13 34 81SaWoLa.48 BAD LABEL
With the variables to be used, used the command as followed,
$ var1=81SaWoLa
$ var2=0.00005214
$ awk -v var1=$var1 -v var2=$var2 '$0 ~ var1{$2=var2}1' file
1078.732700000 0.00005214 1 0 0 39 13 27 0 0 0 40 14 26 81SaWoLa.43 BAD LABEL, REASSIGNED
-1077.336700000 0.00005214 1 0 0 45 12 34 0 0 0 46 13 34 81SaWoLa.48 BAD LABEL
Use awk:
$ awk '/pattern/ { $2 = "new string." }; 1' input.txt
In your case:
$ awk '/81SaWoLa/ { $2 = "0.00005214" }; 1' input.txt
# ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^
# For lines Replace second Print each line, same as:
# matching column with ``{ print $0 }''. ``$0''
# 81SaWoLa ``0.00005214'' contains the whole line.
Use -v name=val to specify a variable:
$ awk -v pat="81SaWoLa" \
-v rep="0.00005214" \
'$0 ~ pat { $2 = rep }; 1' input.txt

glibc error: "free(): invalid next size"

I have a program with an error, when I execute strace -e open myprogram
I have the following message:
open("/etc/ld.so.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libgnutls.so.28", O_RDONLY) = 3
open("/lib/librt.so.1", O_RDONLY) = 3
open("/usr/lib/libz.so.1", O_RDONLY) = 3
open("/usr/lib/libz.so.1", O_RDONLY) = 3
open("/usr/lib/libp11-kit.so.0", O_RDONLY) = 3
open("/usr/lib/libffi.so.6", O_RDONLY) = 3
open("/lib/libdl.so.2", O_RDONLY) = 3
open("/usr/lib/libtasn1.so.6", O_RDONLY) = 3
open("/usr/lib/libnettle.so.4", O_RDONLY) = 3
open("/usr/lib/libhogweed.so.2", O_RDONLY) = 3
open("/usr/lib/libgmp.so.10", O_RDONLY) = 3
open("/lib/libpthread.so.0", O_RDONLY) = 3
open("/lib/libc.so.6", O_RDONLY) = 3
open("/lib/libgcc_s.so.1", O_RDONLY) = 3
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=509, si_status=0, si_utime=0, si_stime=3} ---
before tls_server_init
gnutls_check_version 30105
before gnutls_global_init
open("/dev/tty", O_RDWR|O_NOCTTY|O_NONBLOCK) = 3
*** glibc detected *** /home/myprogram: free(): invalid next size (fast
): 0x01b53200 ***
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=508, si_uid=0} ---
+++ killed by SIGABRT +++
Aborted
Any ideas what the problem is?

cuda-memcheck: Could not start the application (14)

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

Image won't stop rotating in pygame

I have this section of code (similar to the previous piece of code). It's supposed to just sweep 50 degrees left, then stop and sweep 100 degrees right, then stop and sweep 100 degrees to the left, and so forth. Only problem is it stops at the left, goes right, then continues to go right, even though I have a stop there to prevent that from happening.
try:
screen.blit(Turrets[1], (TurretCoords[1]))
if Rotation == 1:
print(TurretRotation[1])
print(Rotation)
TurretRotation[1] = TurretRotation[1] - 1
Turrets[1] = pygame.transform.rotozoom(Turret, TurretRotation[1], 1)
if TurretRotation[1] == -50:
Rotation = -1
else:
print(TurretRotation[1])
print(Rotation)
TurretRotation[1] = TurretRotation[1] + 1
Turrets[1] = pygame.transform.rotozoom(Turret, TurretRotation[1], 1)
if TurretRotation[1] == 50:
Rotation = 1
Yes, I know, I was supposed to change the variables capital letters, and I haven't gotten around to it yet.
This is the output I get from the console.
-1 = Rotate
1 = TurretRotation[1]
-1
2
-1
3
-1
4
-1
5
-1
6
-1
7
-1
8
-1
9
-1
10
-1
11
-1
12
-1
13
-1
14
-1
15
-1
16
-1
17
-1
18
-1
19
-1
20
-1
21
-1
22
-1
23
-1
24
-1
25
-1
26
-1
27
-1
28
-1
29
-1
30
-1
31
-1
32
-1
33
-1
34
-1
35
-1
36
-1
37
-1
38
-1
39
-1
40
-1
41
1
40
1
39
1
38
1
37
1
36
1
35
1
34
1
33
1
32
1
31
1
30
1
29
1
28
1
27
1
26
1
25
1
24
1
23
1
22
1
21
1
20
1
19
1
18
1
17
1
16
1
15
1
14
1
13
1
12
1
11
1
10
1
9
1
8
1
7
1
6
1
5
1
4
1
3
1
2
1
1
1
0
1
-1
1
-2
1
-3
1
-4
1
-5
1
-6
1
-7
1
-8
1
-9
1
-10
1
-11
1
-12
1
-13
1
-14
1
-15
1
-16
1
-17
1
-18
1
-19
1
-20
1
-21
1
-22
1
-23
1
-24
1
-25
1
-26
1
-27
1
-28
1
-29
1
-30
1
-31
1
-32
1
-33
1
-34
1
-35
1
-36
1
-37
1
-38
1
-39
1
-40
1
-41
1
-42
1
-43
1
-44
1
-45
1
-46
1
-47
1
-48
1
-49
1
-50
1
-51
1
-52
1
-53
1
-54
1
-55
1
-56
1
-57
1
-58
1
-59
1
-60
1
-61
1
-62
1
-63
1
-64
1
-65
1
-66
1
-67
1
-68
1
-69
1
-70
1
-71
1
-72
1
-73
1
-74
1
-75
1
-76
1
-77
1
-78
1
-79
1
-80
1
-81
1
-82
1
-83
1
-84
1
I can't run it so I can only advice - I see you have print - so see what's going on with variables. Maybe one of them is changed in different place.
But you can do one this - use <= and >= - it should help.
if TurretRotation[1] >= 50:
if TurretRotation[1] <= -50:

Resources