9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] bug? test f -older t
Date: Tue,  1 Oct 2013 07:53:58 -0400	[thread overview]
Message-ID: <8b7ddf05bd2993bf15286a6ad2d4f780@kw.quanstro.net> (raw)
In-Reply-To: <7963B664-4127-47A3-B8CF-88FA70C52AA6@ar.aichi-u.ac.jp>

On Tue Oct  1 07:35:11 EDT 2013, arisawa@ar.aichi-u.ac.jp wrote:
> Hello,
> 
> Am I missing something?
> It seems logic is inverted to me.
> 
> Kenji Arisawa
> 
> maia% ls -l
> ...
> --rw-rw-r-- M 323 arisawa arisawa         0 Sep 29 06:29 x
> --rw-rw-r-- M 323 arisawa arisawa        14 Sep 28 17:50 z
> maia% mtime x
>  1380403777 x
> maia% if(test z -older 1380403777) echo older
> maia% if(! test z -older 1380403777) echo older

i assume that there is some copy paste error here?  (the 
mtime of z is not shown.)

if not, "older" is not equivalent to "not younger than";
x is older than y means mtime(x) < mtime(y), and not ≤.

minooka; touch x
minooka; mtime x
 1380627631 x
minooka; if(test x -older 1380627631) echo older
minooka; if(test x -older 1380627632) echo older
older

> I have forgotten that I took up this bug in Jun this year.
> Already fixed in distribution?

the distribution's executable is really broken.  even if the sign is wrong,
one of the following must be true:

minooka; 9fs sources
minooka; if(/n/sources/plan9/386/bin/test x -older 1380627630)echo older
minooka; if(/n/sources/plan9/386/bin/test x -older 1380627631)echo older
minooka; if(/n/sources/plan9/386/bin/test x -older 1380627632)echo older

> 	r = dir->mtime + n < time(0);
> 	free(dir);
> 	return r;

i have the following, perhaps from your suggestion:

	if(rel)
		n = time(0) - n;
	if(n < 0)
		r =  0;
	else
		r = dir->mtime < n;

- erik



  parent reply	other threads:[~2013-10-01 11:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-01 11:34 arisawa
2013-10-01 11:44 ` arisawa
2013-10-01 11:53 ` erik quanstrom [this message]
2013-10-01 13:10   ` arisawa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b7ddf05bd2993bf15286a6ad2d4f780@kw.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).