[Top][All Lists]

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

bug in `touch -c'

From: TAKAI Kousuke
Subject: bug in `touch -c'
Date: Tue, 16 Apr 2002 21:23:57 +0900
User-agent: T-gnus/6.15.4 (based on Oort Gnus v0.04) (revision 11) NISEMI/1.14.2 (高井幸輔) SLIM/1.14.7 (酒井彩名) APEL/10.3 Emacs/21.2 (sparc-sun-solaris2.6) MULE/5.0 (賢木)


I have found a bug in `touch' command from fileutils 4.1.8
that `touch -c' wrongly reports an error for non-existent file.
(At least) SUSv2 seems to say `touch -c FILE' should not write any
diagnostic messages when FILE does not exist.

  % touch --version
  touch (fileutils) 4.1.8
  % touch --no-create non-existent-file
  touch: setting times of `non-existent-file': No such file or directory

Fileutils-3.16 and 4.0's `touch' appear to behave as SUSv2 says,
but 4.1 and later version have this problem.

Here is a correction I made.

2002-04-16  TAKAI Kousuke  <address@hidden>

        * src/touch.c (touch): Don't report an error when --no-create
        is in effect and error was ENOENT.

diff -ru fileutils-4.1.8.orig/src/touch.c fileutils-4.1.8/src/touch.c
--- fileutils-4.1.8.orig/src/touch.c    2002-02-16 18:01:38.000000000 +0900
+++ fileutils-4.1.8/src/touch.c 2002-04-16 02:43:23.041293648 +0900
@@ -206,7 +206,7 @@
       status = utime (file, &utb);
-  if (status)
+  if (status && !(no_create && errno == ENOENT))
       if (open_errno)
        error (0, open_errno, _("creating %s"), quote (file));
[patch ends here]

Sorry for my poor English.

 TAKAI Kousuke <address@hidden>
  Dept. of Communications and Computer Engineering,
  Graduate School of Infomatics, Kyoto University, Japan

reply via email to

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