coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

POSIX conformance of touch command


From: Anoop Sharma
Subject: POSIX conformance of touch command
Date: Mon, 12 Jan 2015 22:39:05 +0530

touch makes open() system call even for already existing files as seen below:

# Create file abc
$touch abc

# Attempt retouching it
$strace -e trace=open touch abc
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/i386-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
open("abc", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0666) = 3
+++ exited with 0 +++
$


I think this behavior of touch is not in conformance with POSIX specs because it specifies that for existing files only utimensat() should be called and not creat.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]