diff mbox series

[bug#38390,core-updates] Scheme-only bootstrap: merge wip-bootstrap

Message ID 87o8w5gs6m.fsf@gnu.org
State Accepted
Headers show
Series [bug#38390,core-updates] Scheme-only bootstrap: merge wip-bootstrap | expand

Commit Message

Janneke Nieuwenhuizen Dec. 18, 2019, 10:55 p.m. UTC
Jan Nieuwenhuizen writes:

Hi,

A new step forward.

>>>>   * look into awkward combined bash+gash dependency of glibc-mesboot0
>>>
>>> Haven't addressed this.  I quickly looked with Ludo at this, not really
>>> into it though.  WYDT?
>>
>> Hmm, dunno.  I can take a look later.
>
> Okay, great.  This issue still remains.  I will try to create a bug
> report for Gash, I think Gash hangs while running configure, while
> bash-mesboot* have trouble running make-syscalls.sh correctly.

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 

--8<---------------cut here---------------start------------->8---
--8<---------------cut here---------------end--------------->8---

Greetings,
janneke

Comments

Ludovic Courtès Dec. 19, 2019, 11:08 a.m. UTC | #1
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 mbox series

Patch

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;