LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-30-2017, 10:29 PM   #1
mcmxciv
LQ Newbie
 
Registered: Nov 2017
Posts: 17

Rep: Reputation: Disabled
Why vi command could affect parent directory's mtime and ctime?


I launched vi to edit a file,quiting without changing anything.I found that mtime and ctime of the file did't change,which is in line with predictions.But its parent directory's attribute has been changed.The following is steps:

[root@ ~]# pwd
/root
[root@ ~]# stat /root
File: ‘/root’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 802h/2050d Inode: 1048577 Links: 17
Access: (0550/dr-xr-x---) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u: object_r:admin_home_t:s0
Access: 2017-12-01 12:10:15.305000000 +0800
Modify: 2017-12-01 12:22:36.900000000 +0800
Change: 2017-12-01 12:22:36.900000000 +0800
Birth: -
[root@ ~]# stat Gateway
File: ‘Gateway’
Size: 13 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 1060285 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u: object_r:admin_home_t:s0
Access: 2017-12-01 12:22:30.318000000 +0800
Modify: 2017-12-01 12:01:45.185000000 +0800
Change: 2017-12-01 12:01:45.195000000 +0800
Birth: -
[root@ ~]# vi Gateway
[root@ ~]# stat Gateway
File: ‘Gateway’
Size: 13 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 1060285 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u: object_r:admin_home_t:s0
Access: 2017-12-01 12:23:07.781000000 +0800
Modify: 2017-12-01 12:01:45.185000000 +0800
Change: 2017-12-01 12:01:45.195000000 +0800
Birth: -
[root@ ~]# stat /root
File: ‘/root’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 802h/2050d Inode: 1048577 Links: 17
Access: (0550/dr-xr-x---) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u: object_r:admin_home_t:s0
Access: 2017-12-01 12:10:15.305000000 +0800
Modify: 2017-12-01 12:23:11.396000000 +0800
Change: 2017-12-01 12:23:11.396000000 +0800
Birth: -
[root@ ~]#


My distribution is CentOS with kernel 3.10.0-693.el7.x86_64.My question is :why it happens?

Last edited by mcmxciv; 11-30-2017 at 10:30 PM.
 
Old 12-01-2017, 12:26 AM   #2
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
Lightbulb strace rocks

The best way might be to: strace [-f -o <outfile>] vi <file>
To see if it creates something like a tmp file
(/tmp or /var/tmp yes, but . aka $CWD ? Idk).
Or something to do with like .vimrc init/config stuff.

By the way, I think you mean "current", not "parent" dir. Yes?
("parent" of /root would be / aka .. vs .)

Other LQ'ers info welcome (I'm always learnng)

Interesting investigations/studys you're doing
Welcome to LQ Next stop: sysdig !!!

Last edited by !!!; 12-01-2017 at 12:37 AM.
 
1 members found this post helpful.
Old 12-01-2017, 01:05 AM   #3
mcmxciv
LQ Newbie
 
Registered: Nov 2017
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by !!! View Post
The best way might be to: strace [-f -o <outfile>] vi <file>
To see if it creates something like a tmp file
(/tmp or /var/tmp yes, but . aka $CWD ? Idk).
Or something to do with like .vimrc init/config stuff.

By the way, I think you mean "current", not "parent" dir. Yes?
("parent" of /root would be / aka .. vs .)

Other LQ'ers info welcome (I'm always learnng)

Interesting investigations/studys you're doing
Welcome to LQ Next stop: sysdig !!!
its output:

[root@ a]# strace -f -o /tmp/err vi tets
[root@ a]# stat ../a
File: ‘../a’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 802h/2050d Inode: 1320458 Links: 3
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_ubject_r:user_tmp_t:s0
Access: 2017-12-01 14:58:16.020000000 +0800
Modify: 2017-12-01 15:01:25.175000000 +0800
Change: 2017-12-01 15:01:25.175000000 +0800
Birth: -
[root@ tmp]# vi err

8793 execve("/usr/bin/vi", ["vi", "tets"], [/* 36 vars */]) = 0
8793 brk(NULL) = 0x1c45000
8793 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78d035c000
8793 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
8793 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
8793 fstat(3, {st_mode=S_IFREG|0644, st_size=176187, ...}) = 0
8793 mmap(NULL, 176187, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f78d0330000
8793 close(3) = 0
8793 open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300j\0\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=155744, ...}) = 0
8793 mmap(NULL, 2255216, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cff15000
8793 mprotect(0x7f78cff39000, 2093056, PROT_NONE) = 0
8793 mmap(0x7f78d0138000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x23000) = 0x7f78d0138000
8793 mmap(0x7f78d013a000, 6512, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f78d013a000
8793 close(3) = 0
8793 open("/lib64/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\316\0\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=174520, ...}) = 0
8793 mmap(NULL, 2268928, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cfceb000
8793 mprotect(0x7f78cfd10000, 2097152, PROT_NONE) = 0
8793 mmap(0x7f78cff10000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x25000) = 0x7f78cff10000
8793 close(3) = 0
8793 open("/lib64/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\37\0\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=37056, ...}) = 0
8793 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78d032f000
8793 mmap(NULL, 2130560, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cfae2000
8793 mprotect(0x7f78cfae9000, 2097152, PROT_NONE) = 0
8793 mmap(0x7f78cfce9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f78cfce9000
8793 close(3) = 0
8793 open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\35\2\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=2127336, ...}) = 0
8793 mmap(NULL, 3940800, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cf71f000
8793 mprotect(0x7f78cf8d7000, 2097152, PROT_NONE) = 0
8793 mmap(0x7f78cfad7000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b8000) = 0x7f78cfad7000
8793 mmap(0x7f78cfadd000, 16832, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f78cfadd000
8793 close(3) = 0
8793 open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\25\0\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=402384, ...}) = 0
8793 mmap(NULL, 2494984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cf4bd000
8793 mprotect(0x7f78cf51d000, 2097152, PROT_NONE) = 0
8793 mmap(0x7f78cf71d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x60000) = 0x7f78cf71d000
8793 close(3) = 0
8793 open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\16\0\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=19776, ...}) = 0
8793 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78d032e000
8793 mmap(NULL, 2109744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cf2b9000
8793 mprotect(0x7f78cf2bb000, 2097152, PROT_NONE) = 0
8793 mmap(0x7f78cf4bb000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f78cf4bb000
8793 close(3) = 0
8793 open("/lib64/libattr.so.1", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\23\0\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=19888, ...}) = 0
8793 mmap(NULL, 2113904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cf0b4000
8793 mprotect(0x7f78cf0b8000, 2093056, PROT_NONE) = 0
8793 mmap(0x7f78cf2b7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f78cf2b7000
8793 close(3) = 0
8793 open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0m\0\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=144792, ...}) = 0
8793 mmap(NULL, 2208904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cee98000
8793 mprotect(0x7f78ceeaf000, 2093056, PROT_NONE) = 0
8793 mmap(0x7f78cf0ae000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7f78cf0ae000
8793 mmap(0x7f78cf0b0000, 13448, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f78cf0b0000
8793 close(3) = 0
8793 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78d032d000
8793 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78d032b000
8793 arch_prctl(ARCH_SET_FS, 0x7f78d032b800) = 0
8793 mprotect(0x7f78cfad7000, 16384, PROT_READ) = 0
8793 mprotect(0x7f78cf0ae000, 4096, PROT_READ) = 0
8793 mprotect(0x7f78cf2b7000, 4096, PROT_READ) = 0
8793 mprotect(0x7f78cf4bb000, 4096, PROT_READ) = 0
8793 mprotect(0x7f78cf71d000, 4096, PROT_READ) = 0
8793 mprotect(0x7f78cfce9000, 4096, PROT_READ) = 0
8793 mprotect(0x7f78cff10000, 16384, PROT_READ) = 0
8793 mprotect(0x7f78d0138000, 4096, PROT_READ) = 0
8793 mprotect(0x6cd000, 4096, PROT_READ) = 0
8793 mprotect(0x7f78d035d000, 4096, PROT_READ) = 0
8793 munmap(0x7f78d0330000, 176187) = 0
8793 set_tid_address(0x7f78d032bad0) = 8793
8793 set_robust_list(0x7f78d032bae0, 24) = 0
8793 rt_sigaction(SIGRTMIN, {0x7f78cee9e7e0, [], SA_RESTORER|SA_SIGINFO, 0x7f78ceea75e0}, NULL, 8) = 0
8793 rt_sigaction(SIGRT_1, {0x7f78cee9e870, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f78ceea75e0}, NULL, 8) = 0
8793 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
8793 getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
8793 statfs("/sys/fs/selinux", {f_type=SELINUX_MAGIC, f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096, f_flags=ST_VALID|ST_RELATIME}) = 0
8793 statfs("/sys/fs/selinux", {f_type=SELINUX_MAGIC, f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096, f_flags=ST_VALID|ST_RELATIME}) = 0
8793 stat("/sys/fs/selinux", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
8793 brk(NULL) = 0x1c45000
8793 brk(0x1c66000) = 0x1c66000
8793 access("/etc/selinux/config", F_OK) = 0
8793 sigaltstack({ss_sp=0x1c45030, ss_flags=0, ss_size=8192}, NULL) = 0
8793 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
8793 fstat(3, {st_mode=S_IFREG|0644, st_size=106070960, ...}) = 0
8793 mmap(NULL, 106070960, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f78c896f000
8793 close(3) = 0
8793 ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
8793 getcwd("/tmp/a", 4096) = 7
8793 chdir("/tmp/a") = 0
8793 chdir("/root") = 0
8793 getcwd("/root", 1025) = 6
8793 chdir("/tmp/a") = 0
8793 sysinfo({uptime=20787, loads=[192, 960, 2976], totalram=6088568832, freeram=5382508544, sharedram=0, bufferram=195735552, totalswap=6144651264, freeswap=6144651264, procs=157, totalhigh=0, freehigh=0, mem_unit=1}) = 0
8793 getrlimit(RLIMIT_DATA, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
8793 getuid() = 0
8793 stat("/usr/share/vim", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
8793 getcwd("/tmp/a", 4096) = 7
8793 stat("tets", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
8793 rt_sigaction(SIGWINCH, {0x461320, [], SA_RESTORER, 0x7f78cf754270}, {SIG_DFL, [], 0}, 8) = 0
8793 rt_sigprocmask(SIG_UNBLOCK, [WINCH], [], 8) = 0
8793 rt_sigaction(SIGTSTP, {SIG_DFL, [], SA_RESTORER, 0x7f78cf754270}, {SIG_DFL, [], 0}, 8) = 0
8793 rt_sigprocmask(SIG_UNBLOCK, [TSTP], [], 8) = 0
8793 rt_sigaction(SIGPIPE, {SIG_IGN, [], SA_RESTORER, 0x7f78cf754270}, {SIG_DFL, [], 0}, 8) = 0
8793 rt_sigprocmask(SIG_UNBLOCK, [PIPE], [], 8) = 0
8793 rt_sigaction(SIGINT, {0x461350, [], SA_RESTORER, 0x7f78cf754270}, {SIG_DFL, [], 0}, 8) = 0
8793 rt_sigprocmask(SIG_UNBLOCK, [INT], [], 8) = 0
8793 rt_sigaction(SIGALRM, {SIG_IGN, [], SA_RESTORER, 0x7f78cf754270}, {SIG_DFL, [], 0}, 8) = 0
8793 rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
8793 rt_sigaction(SIGPWR, {0x461380, [], SA_RESTORER, 0x7f78cf754270}, {SIG_DFL, [], 0}, 8) = 0
8793 rt_sigprocmask(SIG_UNBLOCK, [PWR], [], 8) = 0
8793 rt_sigaction(SIGHUP, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGQUIT, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGILL, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGTRAP, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGABRT, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGFPE, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGBUS, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGSEGV, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGSYS, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGTERM, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGVTALRM, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGPROF, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGXCPU, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGXFSZ, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGUSR1, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 rt_sigaction(SIGUSR2, {0x461df0, [], SA_RESTORER|SA_STACK, 0x7f78cf754270}, NULL, 8) = 0
8793 ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
8793 stat("/etc/sysconfig/64bit_strstr_via_64bit_strstr_sse2_unaligned", 0x7ffe84c68860) = -1 ENOENT (No such file or directory)
8793 ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
8793 stat("/root/.terminfo", 0x1c4d790) = -1 ENOENT (No such file or directory)
8793 stat("/etc/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
8793 stat("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
8793 access("/etc/terminfo/x/xterm", R_OK) = -1 ENOENT (No such file or directory)
8793 access("/usr/share/terminfo/x/xterm", R_OK) = 0
8793 open("/usr/share/terminfo/x/xterm", O_RDONLY) = 3
8793 fstat(3, {st_mode=S_IFREG|0644, st_size=3371, ...}) = 0
8793 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78d035b000
8793 read(3, "\32\0010\0&\0\17\0\235\1l\5xterm|xterm terminal"..., 4096) = 3371
8793 read(3, "", 4096) = 0
8793 close(3) = 0
8793 munmap(0x7f78d035b000, 4096) = 0
8793 ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
8793 ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
8793 ioctl(1, TIOCGWINSZ, {ws_row=48, ws_col=236, ws_xpixel=0, ws_ypixel=0}) = 0
8793 ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
8793 ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
8793 ioctl(1, TIOCGWINSZ, {ws_row=48, ws_col=236, ws_xpixel=0, ws_ypixel=0}) = 0
8793 brk(NULL) = 0x1c66000
8793 brk(0x1c8b000) = 0x1c8b000
8793 ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
8793 ioctl(1, TIOCGWINSZ, {ws_row=48, ws_col=236, ws_xpixel=0, ws_ypixel=0}) = 0
8793 open(".", O_RDONLY) = 3
8793 fchdir(3) = 0
8793 chdir("/etc") = 0
8793 getcwd("/etc", 4096) = 5
8793 fchdir(3) = 0
8793 close(3) = 0
8793 stat("/etc/virc", {st_mode=S_IFREG|0644, st_size=1982, ...}) = 0
8793 open("/etc/virc", O_RDONLY) = 3
8793 fcntl(3, F_GETFD) = 0
8793 fcntl(3, F_SETFD, FD_CLOEXEC) = 0
8793 fcntl(3, F_GETFL) = 0x8000 (flags O_RDONLY|O_LARGEFILE)
8793 fstat(3, {st_mode=S_IFREG|0644, st_size=1982, ...}) = 0
8793 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78d035b000
8793 read(3, "if v:lang =~ "utf8$" || v:lang ="..., 4096) = 1982
8793 getuid() = 0
8793 read(3, "", 4096) = 0
8793 read(3, "", 4096) = 0
8793 close(3) = 0
8793 munmap(0x7f78d035b000, 4096) = 0
8793 open(".", O_RDONLY) = 3
8793 fchdir(3) = 0
8793 chdir("/root") = 0
8793 getcwd("/root", 4096) = 6
8793 fchdir(3) = 0
8793 close(3) = 0
8793 stat("/root/.vimrc", 0x7ffe84c691a0) = -1 ENOENT (No such file or directory)
8793 open("/root/.vimrc", O_RDONLY) = -1 ENOENT (No such file or directory)
8793 open("/root/_vimrc", O_RDONLY) = -1 ENOENT (No such file or directory)
8793 open(".", O_RDONLY) = 3
8793 fchdir(3) = 0
8793 chdir("/root/.vim") = -1 ENOENT (No such file or directory)
8793 getcwd("/tmp/a", 4096) = 7
8793 fchdir(3) = 0
8793 close(3) = 0
8793 stat("/root/.vim/vimrc", 0x7ffe84c691a0) = -1 ENOENT (No such file or directory)
8793 open("/root/.vim/vimrc", O_RDONLY) = -1 ENOENT (No such file or directory)
8793 open(".", O_RDONLY) = 3
8793 fchdir(3) = 0
8793 chdir("/root") = 0
8793 getcwd("/root", 4096) = 6
8793 fchdir(3) = 0
8793 close(3) = 0
8793 stat("/root/.exrc", 0x7ffe84c691a0) = -1 ENOENT (No such file or directory)
8793 open("/root/.exrc", O_RDONLY) = -1 ENOENT (No such file or directory)
8793 ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
8793 ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost -isig -icanon -echo ...}) = 0
8793 ioctl(0, TCGETS, {B38400 opost -isig -icanon -echo ...}) = 0
8793 write(1, "\33[?1049h\33[?1h\33=", 15) = 15
8793 stat("/tmp/a/tets", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
8793 getuid() = 0
8793 socket(AF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
8793 connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
8793 close(3) = 0
8793 socket(AF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
8793 connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
8793 close(3) = 0
8793 open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
8793 fstat(3, {st_mode=S_IFREG|0644, st_size=1746, ...}) = 0
8793 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78d035b000
8793 read(3, "#\n# /etc/nsswitch.conf\n#\n# An ex"..., 4096) = 1746
8793 read(3, "", 4096) = 0
8793 close(3) = 0
8793 munmap(0x7f78d035b000, 4096) = 0
8793 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
8793 fstat(3, {st_mode=S_IFREG|0644, st_size=176187, ...}) = 0
8793 mmap(NULL, 176187, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f78d0330000
8793 close(3) = 0
8793 open("/lib64/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
8793 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
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=62184, ...}) = 0
8793 mmap(NULL, 2173048, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78c875c000
8793 mprotect(0x7f78c8768000, 2093056, PROT_NONE) = 0
8793 mmap(0x7f78c8967000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb000) = 0x7f78c8967000
8793 mmap(0x7f78c8969000, 22648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f78c8969000
8793 close(3) = 0
8793 mprotect(0x7f78c8967000, 4096, PROT_READ) = 0
8793 munmap(0x7f78d0330000, 176187) = 0
8793 open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
8793 fstat(3, {st_mode=S_IFREG|0644, st_size=3259, ...}) = 0
8793 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78d035b000
8793 read(3, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 3259
8793 close(3) = 0
8793 munmap(0x7f78d035b000, 4096) = 0
8793 uname({sysname="Linux", nodename="asset.xcsc", ...}) = 0
8793 stat("tets", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
8793 stat("tets", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
8793 access("tets", W_OK) = 0
8793 open("tets", O_RDONLY) = 3
8793 readlink("tets", 0x7ffe84c67a70, 4095) = -1 EINVAL (Invalid argument)
8793 open(".tets.swp", O_RDONLY) = -1 ENOENT (No such file or directory)
8793 open(".tets.swp", O_RDWR|O_CREAT|O_EXCL, 0600) = 4
8793 open(".tets.swpx", O_RDONLY) = -1 ENOENT (No such file or directory)
8793 open(".tets.swpx", O_RDWR|O_CREAT|O_EXCL, 0600) = 5
8793 fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
8793 fstat(5, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
8793 close(5) = 0
8793 unlink(".tets.swpx") = 0
8793 close(4) = 0
8793 unlink(".tets.swp") = 0
8793 stat(".tets.swp", 0x7ffe84c68a00) = -1 ENOENT (No such file or directory)
8793 lstat(".tets.swp", 0x7ffe84c68b80) = -1 ENOENT (No such file or directory)
8793 getcwd("/tmp/a", 4096) = 7
8793 lstat(".tets.swp", 0x7ffe84c68f00) = -1 ENOENT (No such file or directory)
8793 open(".tets.swp", O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0600) = 4
8793 fcntl(4, F_GETFD) = 0
8793 fcntl(4, F_SETFD, FD_CLOEXEC) = 0
8793 getxattr(".tets.swp", "security.selinux", "unconfined_ubject_r:user_tmp_t:s0", 255) = 36
8793 access("/var/run/setrans/.setrans-unix", F_OK) = -1 ENOENT (No such file or directory)
8793 futex(0x7f78d013b958, FUTEX_WAKE_PRIVATE, 2147483647) = 0
8793 getxattr(".tets.swp", "security.selinux", "unconfined_ubject_r:user_tmp_t:s0", 255) = 36
8793 getcwd("/tmp/a", 4096) = 7
8793 lseek(4, 0, SEEK_SET) = 0
8793 write(4, "b0VIM 7.4\0\0\0\0\20\0\0\272\375 Z\26&\24\0Y"\0\0root"..., 4096) = 4096
8793 select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)
8793 chmod(".tets.swp", 0644) = 0
8793 write(1, "\33[1;48r\33[?12;25h\33[?12l\33[?25h\33[27"..., 62) = 62
8793 brk(NULL) = 0x1c8b000
8793 brk(0x1cae000) = 0x1cae000
8793 read(3, "", 8192) = 0
8793 close(3) = 0
8793 brk(NULL) = 0x1cae000
8793 brk(NULL) = 0x1cae000
8793 brk(0x1c9e000) = 0x1c9e000
8793 brk(NULL) = 0x1c9e000
8793 write(1, " 0L, 0C", 7) = 7
8793 select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)
8793 getcwd("/tmp/a", 4096) = 7
8793 execve("/usr/bin/vi", ["vi", "tets"], [/* 36 vars */]) = 0
8793 brk(NULL) = 0x1c45000
8793 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78d035c000
8793 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
8793 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
8793 fstat(3, {st_mode=S_IFREG|0644, st_size=176187, ...}) = 0
8793 mmap(NULL, 176187, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f78d0330000
8793 close(3) = 0
8793 open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300j\0\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=155744, ...}) = 0
8793 mmap(NULL, 2255216, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cff15000
8793 mprotect(0x7f78cff39000, 2093056, PROT_NONE) = 0
8793 mmap(0x7f78d0138000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x23000) = 0x7f78d0138000
8793 mmap(0x7f78d013a000, 6512, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f78d013a000
8793 close(3) = 0
8793 open("/lib64/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\316\0\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=174520, ...}) = 0
8793 mmap(NULL, 2268928, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cfceb000
8793 mprotect(0x7f78cfd10000, 2097152, PROT_NONE) = 0
8793 mmap(0x7f78cff10000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x25000) = 0x7f78cff10000
8793 close(3) = 0
8793 open("/lib64/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\37\0\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=37056, ...}) = 0
8793 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f78d032f000
8793 mmap(NULL, 2130560, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cfae2000
8793 mprotect(0x7f78cfae9000, 2097152, PROT_NONE) = 0
8793 mmap(0x7f78cfce9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f78cfce9000
8793 close(3) = 0
8793 open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\35\2\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=2127336, ...}) = 0
8793 mmap(NULL, 3940800, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cf71f000
8793 mprotect(0x7f78cf8d7000, 2097152, PROT_NONE) = 0
8793 mmap(0x7f78cfad7000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b8000) = 0x7f78cfad7000
8793 mmap(0x7f78cfadd000, 16832, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f78cfadd000
8793 close(3) = 0
8793 open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3
8793 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\25\0\0\0\0\0\0"..., 832) = 832
8793 fstat(3, {st_mode=S_IFREG|0755, st_size=402384, ...}) = 0
8793 mmap(NULL, 2494984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f78cf4bd000
8793 mprotect(0x7f78cf51d000, 2097152, PROT_NONE) = 0
8793 mmap(0x7f78cf71d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x60000) = 0x7f78cf71d000
8793 close(3) = 0
8793 open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3

Last edited by mcmxciv; 12-01-2017 at 01:38 AM.
 
Old 12-01-2017, 02:12 AM   #4
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,790

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
vim creates a recovery file (or even two files) next to the edited file.
Quote:
8793 open(".tets.swp", O_RDWR|O_CREAT|O_EXCL, 0600) = 4

8793 open(".tets.swpx", O_RDWR|O_CREAT|O_EXCL, 0600) = 5
That changes the date of the directory.
Try
Code:
vi -n
to not create a recovery file.
(BTW vi is an alias to vim. The original Unix vi creates a recovery file in /var/preserve/)
 
1 members found this post helpful.
Old 12-01-2017, 02:46 AM   #5
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
If you know you aren't going to change a file contents, you can also use the view command instead of vi.

It is the same vi(m) but with the read-only option set. It won't create a recovery file.

Should you change your mind, you can still write the file with the ":w!".
 
Old 12-01-2017, 07:53 AM   #6
mcmxciv
LQ Newbie
 
Registered: Nov 2017
Posts: 17

Original Poster
Rep: Reputation: Disabled
thanks very much!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
btrfs duperemove clobbers mtime and ctime wroom Linux - Software 0 11-18-2015 03:44 PM
tmpwatchc updates directory ctime? password636 Linux - Software 1 11-29-2011 10:44 AM
Directory mtime BBPS Linux - Server 1 11-02-2009 07:33 PM
Can you move a file or directory and still retain mtime? ddenton Linux - General 3 11-21-2008 04:54 PM
mtime/ctime changed on directory entries stardot Linux - Security 2 11-29-2004 10:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration