tag 558989 patch thanks Hi,
According to http://www.opengroup.org/onlinepubs/009695399/utilities/test.html -nt and -ot were from the KornShell. According to the KornShell documentation at http://www2.research.att.com/sw/download/man/man1/ksh.html file1 -nt file2 True, if file1 exists and file2 does not, or file1 is newer than file2. file1 -ot file2 True, if file2 exists and file1 does not, or file1 is older than file2. The attached patch should make dash follow this behavior. -- Matt http://ftbfs.org/kraai
>From 692f01c077d9aa4e352b349ef17d6229f1185962 Mon Sep 17 00:00:00 2001 From: Matt Kraai <[email protected]> Date: Sat, 5 Dec 2009 07:45:23 -0800 Subject: [PATCH] [BUILTIN] Make -nt and -ot return true if the second file doesn't exist --- src/bltin/test.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bltin/test.c b/src/bltin/test.c index 8e7077a..5bdeeaf 100644 --- a/src/bltin/test.c +++ b/src/bltin/test.c @@ -444,8 +444,8 @@ newerf (const char *f1, const char *f2) struct stat b1, b2; return (stat (f1, &b1) == 0 && - stat (f2, &b2) == 0 && - b1.st_mtime > b2.st_mtime); + (stat (f2, &b2) != 0 || + b1.st_mtime > b2.st_mtime)); } static int @@ -454,8 +454,8 @@ olderf (const char *f1, const char *f2) struct stat b1, b2; return (stat (f1, &b1) == 0 && - stat (f2, &b2) == 0 && - b1.st_mtime < b2.st_mtime); + (stat (f2, &b2) != 0 && + b1.st_mtime < b2.st_mtime)); } static int -- 1.6.5.4

