Message ID | 87o8w5gs6m.fsf@gnu.org |
---|---|
State | Accepted |
Headers | show |
Series | [bug#38390,core-updates] Scheme-only bootstrap: merge wip-bootstrap | expand |
Hi! Jan Nieuwenhuizen <janneke@gnu.org> skribis: > Good news. bash-mesboot0 now compiles with either gash+gash-core-utils, > or with bash-mesboot0. > > Gash' "test -L FILE" used to crash on non-existing files, not sure why > that made configure hang; but that's how I found and fixed it. > > The problem with bash-mesboot0 turned out to be a Mes C Library problem, > related to buffered reads. Buffered reads were introduced when working > on the Hurd. > > Not clearing the read buffer on lseek, when lseek is not allowed (bash > uses the same: lseek (FD, 0, SEEK_CUR) to find out if it may seek), > fixes the problem. That took me a couple of days to find, but very > happy Woow, wild! Great that you found out! Thank you, Ludo’.
diff --git a/lib/linux/lseek.c b/lib/linux/lseek.c index 94f2f9f7a..f71af59f5 100644 --- a/lib/linux/lseek.c +++ b/lib/linux/lseek.c @@ -24,9 +24,21 @@ #include <stdio.h> #include <sys/types.h> +#if !__MESC__ /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */ +off_t +_lseek (int filedes, off_t offset, int whence) +{ + return _sys_call3 (SYS_lseek, (int) filedes, (long) offset, (int) whence); +} +#endif + off_t lseek (int filedes, off_t offset, int whence) { +#if !__MESC__ /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */ + if (_lseek (filedes, 0, SEEK_CUR) == -1) + return -1; +#endif size_t skip = __buffered_read_clear (filedes); if (whence == SEEK_CUR) offset -= skip;