
{"id":5919,"date":"2011-03-25T11:19:32","date_gmt":"2011-03-25T11:19:32","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=4778"},"modified":"2011-03-25T11:19:32","modified_gmt":"2011-03-25T11:19:32","slug":"coreutils-touch-c-behaves-incorrectly-non-posix-and-is-not-sufficiently-documented","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2011\/03\/25\/coreutils-touch-c-behaves-incorrectly-non-posix-and-is-not-sufficiently-documented\/","title":{"rendered":"touch -c behaves incorrectly (non-POSIX)"},"content":{"rendered":"<p><a href=\"http:\/\/www.trueangle.org\/wp-content\/uploads\/2011\/03\/595ba-debian-bug-439033-2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.trueangle.org\/wp-content\/uploads\/2011\/03\/595ba-debian-bug-439033-2.png\" alt=\"\" title=\"debian.bug-439033\" width=\"406\" height=\"226\" class=\"alignnone size-full wp-image-4780\" \/><\/a><br \/>\n<a>http:\/\/bugs.debian.org\/cgi-bin\/bugreport.cgi?bug=439033<\/a><\/p>\n<pre>\nPOSIX says about 'touch'[*]:\n\n-c\n    Do not create a specified file if it does not exist. Do not write\n    any diagnostic messages concerning this condition.\n\n[*] http:\/\/www.opengroup.org\/onlinepubs\/009695399\/utilities\/touch.html\n\nBut under some conditions, 'touch' writes a diagnostic message when\nthe file doesn't exist. For instance:\n\nvin:~&gt; mkdir dir\nvin:~&gt; chmod 000 dir\nvin:~&gt; \/usr\/bin\/touch -c dir\/file\n\/usr\/bin\/touch: setting times of `dir\/file': Permission denied\nzsh: exit 1     \/usr\/bin\/touch -c dir\/file\nvin:~[1]&gt;\n\nNote that the BSD 'touch' does not have this problem, as shown by the\ntest below (under Mac OS X):\n\nprunille:~&gt; mkdir dir\nprunille:~&gt; chmod 000 dir\nprunille:~&gt; \/usr\/bin\/touch -c dir\/file\nprunille:~&gt;\n\nAlso the touch(1) man page doesn't say that no diagnostic messages\nare written when the file doesn't exist. Users are not required to\nlook at the POSIX standard to get the full documentation.\n\nDitto for the manual (coreutils.info).\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/bugs.debian.org\/cgi-bin\/bugreport.cgi?bug=439033 POSIX says about &#8216;touch'[*]: -c Do not create a specified file if it does not exist. Do not write any diagnostic messages concerning this condition. [*] http:\/\/www.opengroup.org\/onlinepubs\/009695399\/utilities\/touch.html But under some conditions, &#8216;touch&#8217; writes a diagnostic message when the file doesn&#8217;t exist. For instance: vin:~&gt; mkdir dir vin:~&gt; chmod 000 dir vin:~&gt; \/usr\/bin\/touch -c dir\/file &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2011\/03\/25\/coreutils-touch-c-behaves-incorrectly-non-posix-and-is-not-sufficiently-documented\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;touch -c behaves incorrectly (non-POSIX)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":-1,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[590,1203,1591],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/5919"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=5919"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/5919\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=5919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=5919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=5919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}