Download raw body.
vi struggling to save commit messages
On Tue, Mar 07, 2023 at 07:41:05PM -0700, Ted Bullock wrote: > I'm getting this when I try to commit a file now that got has switched > to vi instead of ed. :P > > vi reports: > logmsg-vu6jOR: file modified more recently than this copy > > My got working directory is shared on an NFS mount since my old Sun > workstation is quite thin and doesn't have much of a hdd. > > I double checked the time on the NFS server, it's correct and consistent > with the workstation. > > I initiated the commit at 19:30 and the temp message has a valid > timestamp as far as I can tell. > > -rw------- 1 tbullock tbullock 189 Mar 7 19:30 logmsg-vu6jOR > > I can force the commit by giving vi the :w! command instead of just > closing it out with ZZ but it's not a muscle I've used before. > vi prints this message if device number, inode, or timestamp do not match exactly the values it saw when first opening the file. And vi is using nanosecond precision for its timestamp check. I wonder if the timestamp between NFS server and client could differ by some amount of nanoseconds? Or would such a difference be unexpected with NFS? Out of curiousity, does sleeping for 1 second before starting vi affect vi's behaviour? diff /home/stsp/src/got commit - cee3836880940ba0d1203e0682a43a680132bc27 path + /home/stsp/src/got blob - e95ba2936e96e58c1f16c13b3a81b482f35d02a4 file + got/got.c --- got/got.c +++ got/got.c @@ -444,12 +444,17 @@ edit_logmsg(char **logmsg, const char *editor, const c struct stat st, st2; FILE *fp = NULL; size_t logmsg_len; + struct timespec timeout; *logmsg = NULL; if (stat(logmsg_path, &st) == -1) return got_error_from_errno2("stat", logmsg_path); + timeout.tv_sec = 1; + timeout.tv_nsec = 0; + nanosleep(&timeout, NULL); + if (spawn_editor(editor, logmsg_path) == -1) return got_error_from_errno("failed spawning editor");
vi struggling to save commit messages