"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
"Todd C. Miller" <millert@openbsd.org>
Subject:
Re: vi struggling to save commit messages
To:
Ted Bullock <tbullock@comlore.com>
Cc:
gameoftrees@openbsd.org
Date:
Wed, 08 Mar 2023 13:49:21 -0700

Download raw body.

Thread
  • Todd C. Miller:

    vi struggling to save commit messages

  • On Wed, 08 Mar 2023 13:19:39 -0700, Ted Bullock wrote:
    
    > I can see why it triggers, it's comparing identical timestamps, not
    > relative. This is inconsistent with the error text too which explicitly
    > says "file modified more recently than this copy".
    >
    > timespeccmp(&sb.st_mtim, &ep->mtim, !=)
    >
    > should be
    >
    > timespeccmp(&sb.st_mtim, &ep->mtim, <=)
    
    No, that is not what the warning means.  It is telling you that the
    file has been modified outside the editor.  The "!=" is correct
    because even if the the time stamp is earlier, the file still has
    been modified _after_ the editor was run.
    
    For sudo I had to truncate tv_nsec to usec when comparing mtime to
    avoid issues with file systems that only support usec-granularity
    time stamps, such as on Linux.
    
     - todd
    
    
  • Todd C. Miller:

    vi struggling to save commit messages