diff mbox series

Updated patches for the port of gccgo to GNU/Hurd

Message ID d4df7a13d2fc9c652b0469316596d637ab09ada6.camel@gmail.com
State New
Headers show
Series Updated patches for the port of gccgo to GNU/Hurd | expand

Commit Message

Svante Signell Jan. 31, 2019, 3:40 p.m. UTC
Hello,

As advised by the Debian gcc maintainer Matthias Klose and golang
developer Ian Lance Taylor I'm re-submitting the patches for
the port of gccgo to GNU/Hurd again. Now GOOS value is changed from gnu
to hurd as requested.

The 12 patches are:
src_libgo_build.diff
src_libgo_runtime.diff
src_libgo_go_crypto.diff
src_libgo_go_internal.diff
src_libgo_go_net.diff
src_libgo_go_os.diff
src_libgo_go_runtime.diff
src_libgo_go_syscall.diff
src_libgo_go_test.diff

src_libgo_testsuite_gotest.diff
add-hurd-to-libgo-headers.diff
add-hurd-to-libgo-test-headers.diff

Added is also the patch to apply these patches for a Debian build:
debian_rules.patch.diff

Preliminary ChangeLog entries are included in each patch.

With them the latest the latest Debian gcc-snapshot (20190125-2) has
been successfully built. Test results (varies slightly) for libgo and go:

                === libgo Summary ===

# of expected passes            160
# of unexpected failures        24

                === go Summary ===

# of expected passes            518
# of untested testcases         834

Note that similar numbers are obtained also for Linux.

After these patches have been applied upstream some further work is needed to go
through the tests, and enable/disable some of them to work properly (and find
the sigaltstack bugs in Hurd).

I do also have a wish: Can you upstream, and Debian use autoreconf to create
Makefile.in files from Makefile.am files now when the build system supports
recent versions of autoconf and automake. It is very cumbersome to create
patches for Maikefile.in files compared to Makefil.am ones.

Thanks!

Comments

Ian Lance Taylor Feb. 7, 2019, 5:04 a.m. UTC | #1
On Thu, Jan 31, 2019 at 7:40 AM Svante Signell <svante.signell@gmail.com> wrote:
>
> As advised by the Debian gcc maintainer Matthias Klose and golang
> developer Ian Lance Taylor I'm re-submitting the patches for
> the port of gccgo to GNU/Hurd again. Now GOOS value is changed from gnu
> to hurd as requested.
>
> The 12 patches are:
> src_libgo_build.diff
> src_libgo_runtime.diff
> src_libgo_go_crypto.diff
> src_libgo_go_internal.diff
> src_libgo_go_net.diff
> src_libgo_go_os.diff
> src_libgo_go_runtime.diff
> src_libgo_go_syscall.diff
> src_libgo_go_test.diff
>
> src_libgo_testsuite_gotest.diff
> add-hurd-to-libgo-headers.diff
> add-hurd-to-libgo-test-headers.diff

Thanks.  I've committed versions of all of these patches other than
src_libgo_testsuite_gotest.diff.  I omitted that one because as far as
I can tell it won't work.  While the original code may not run on the
Hurd, the modified version won't work.

I made various changes, and I'm sure I broke some things.  Take a look
at GCC trunk and see how it seems.

Ian
Matthias Klose Feb. 8, 2019, 11:07 p.m. UTC | #2
On 07.02.19 06:04, Ian Lance Taylor wrote:
> On Thu, Jan 31, 2019 at 7:40 AM Svante Signell <svante.signell@gmail.com> wrote:
>>
>> As advised by the Debian gcc maintainer Matthias Klose and golang
>> developer Ian Lance Taylor I'm re-submitting the patches for
>> the port of gccgo to GNU/Hurd again. Now GOOS value is changed from gnu
>> to hurd as requested.
>>
>> The 12 patches are:
>> src_libgo_build.diff
>> src_libgo_runtime.diff
>> src_libgo_go_crypto.diff
>> src_libgo_go_internal.diff
>> src_libgo_go_net.diff
>> src_libgo_go_os.diff
>> src_libgo_go_runtime.diff
>> src_libgo_go_syscall.diff
>> src_libgo_go_test.diff
>>
>> src_libgo_testsuite_gotest.diff
>> add-hurd-to-libgo-headers.diff
>> add-hurd-to-libgo-test-headers.diff
> 
> Thanks.  I've committed versions of all of these patches other than
> src_libgo_testsuite_gotest.diff.  I omitted that one because as far as
> I can tell it won't work.  While the original code may not run on the
> Hurd, the modified version won't work.
> 
> I made various changes, and I'm sure I broke some things.  Take a look
> at GCC trunk and see how it seems.

libtool: compile:  /<<PKGBUILDDIR>>/build/./gcc/gccgo
-B/<<PKGBUILDDIR>>/build/./gcc/ -B/usr/i686-gnu/bin/ -B/usr/i6
86-gnu/lib/ -isystem /usr/i686-gnu/include -isystem /usr/i686-gnu/sys-include
-isystem /<<PKGBUILDDIR>>/build/sys-in
clude -fchecking=1 -minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=syscall
-fPIC -o .libs/syscall.o
gccgo: fatal error: no input files
compilation terminated.
Makefile:2844: recipe for target 'syscall.lo' failed
make[6]: *** [syscall.lo] Error 1
make[6]: Leaving directory '/<<PKGBUILDDIR>>/build/i686-gnu/libgo'
Makefile:2242: recipe for target 'all-recursive' failed
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory '/<<PKGBUILDDIR>>/build/i686-gnu/libgo'
Makefile:1167: recipe for target 'all' failed
make[4]: *** [all] Error 2
make[4]: Leaving directory '/<<PKGBUILDDIR>>/build/i686-gnu/libgo'
Makefile:20078: recipe for target 'all-target-libgo' failed
make[3]: *** [all-target-libgo] Error 2
make[3]: Leaving directory '/<<PKGBUILDDIR>>/build'
Makefile:24129: recipe for target 'bootstrap' failed
make[2]: *** [bootstrap] Error 2
Ian Lance Taylor Feb. 9, 2019, 10:40 p.m. UTC | #3
On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose <doko@debian.org> wrote:
>
> On 07.02.19 06:04, Ian Lance Taylor wrote:
> > On Thu, Jan 31, 2019 at 7:40 AM Svante Signell <svante.signell@gmail.com> wrote:
> >>
> >> As advised by the Debian gcc maintainer Matthias Klose and golang
> >> developer Ian Lance Taylor I'm re-submitting the patches for
> >> the port of gccgo to GNU/Hurd again. Now GOOS value is changed from gnu
> >> to hurd as requested.
> >>
> >> The 12 patches are:
> >> src_libgo_build.diff
> >> src_libgo_runtime.diff
> >> src_libgo_go_crypto.diff
> >> src_libgo_go_internal.diff
> >> src_libgo_go_net.diff
> >> src_libgo_go_os.diff
> >> src_libgo_go_runtime.diff
> >> src_libgo_go_syscall.diff
> >> src_libgo_go_test.diff
> >>
> >> src_libgo_testsuite_gotest.diff
> >> add-hurd-to-libgo-headers.diff
> >> add-hurd-to-libgo-test-headers.diff
> >
> > Thanks.  I've committed versions of all of these patches other than
> > src_libgo_testsuite_gotest.diff.  I omitted that one because as far as
> > I can tell it won't work.  While the original code may not run on the
> > Hurd, the modified version won't work.
> >
> > I made various changes, and I'm sure I broke some things.  Take a look
> > at GCC trunk and see how it seems.
>
> libtool: compile:  /<<PKGBUILDDIR>>/build/./gcc/gccgo
> -B/<<PKGBUILDDIR>>/build/./gcc/ -B/usr/i686-gnu/bin/ -B/usr/i6
> 86-gnu/lib/ -isystem /usr/i686-gnu/include -isystem /usr/i686-gnu/sys-include
> -isystem /<<PKGBUILDDIR>>/build/sys-in
> clude -fchecking=1 -minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=syscall
> -fPIC -o .libs/syscall.o
> gccgo: fatal error: no input files
> compilation terminated.
> Makefile:2844: recipe for target 'syscall.lo' failed
> make[6]: *** [syscall.lo] Error 1
> make[6]: Leaving directory '/<<PKGBUILDDIR>>/build/i686-gnu/libgo'
> Makefile:2242: recipe for target 'all-recursive' failed
> make[5]: *** [all-recursive] Error 1
> make[5]: Leaving directory '/<<PKGBUILDDIR>>/build/i686-gnu/libgo'
> Makefile:1167: recipe for target 'all' failed
> make[4]: *** [all] Error 2
> make[4]: Leaving directory '/<<PKGBUILDDIR>>/build/i686-gnu/libgo'
> Makefile:20078: recipe for target 'all-target-libgo' failed
> make[3]: *** [all-target-libgo] Error 2
> make[3]: Leaving directory '/<<PKGBUILDDIR>>/build'
> Makefile:24129: recipe for target 'bootstrap' failed
> make[2]: *** [bootstrap] Error 2

What are the lines before that in the log?  For some reason libtool is
being invoke with no source files.  The lines before the failing line
should show an invocation of match.sh that determines the source
files.

Ian
Svante Signell Feb. 9, 2019, 10:57 p.m. UTC | #4
On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose <doko@debian.org> wrote:
> > On 07.02.19 06:04, Ian Lance Taylor wrote:

> What are the lines before that in the log?  For some reason libtool is
> being invoke with no source files.  The lines before the failing line
> should show an invocation of match.sh that determines the source
> files.

Thanks for your job upstreaming the patches!

I've found some problems. Current problem is with the mksysinfo.sh patch. But
there are some other things missing. New patches will be submitted tomorrow. 

Thanks!
Svante Signell Feb. 10, 2019, 11:40 a.m. UTC | #5
On Sat, 2019-02-09 at 23:57 +0100, Svante Signell wrote:
> On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> > On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose <doko@debian.org> wrote:
> > > On 07.02.19 06:04, Ian Lance Taylor wrote:
> > What are the lines before that in the log?  For some reason libtool is
> > being invoke with no source files.  The lines before the failing line
> > should show an invocation of match.sh that determines the source
> > files.
> 
> Thanks for your job upstreaming the patches!
> 
> I've found some problems. Current problem is with the mksysinfo.sh patch. But
> there are some other things missing. New patches will be submitted tomorrow. 

Attached are three additional patches needed to build libgo on GNU/Hurd:
src_libgo_mksysinfo.sh.diff
src_libgo_go_syscall_wait.c.diff
src_libgo_testsuite_gotest.diff

For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to the old
version, using sed -i -e. As written now ${fsid_to_dev} expands to 
fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e expression #4,
char 1: unknown command: `''". Unfortunately, I have not yet been able to modify
the expansion omitting the single qoutes around the shell variable.

The second patch, src_libgo_go_syscall_wait.c.diff, is needed since WCONTINUED
is not defined and is needed for WIFCONTINUED to be defined in wait.h.

The third patch, src_libgo_testsuite_gotest.diff, is not strictly needed, but
running the tests the annoying text is displayed: "ps: comm: Unknown format
spec"

Thanks!
Index: gcc-9-9-20190208/src/libgo/go/syscall/wait.c
===================================================================
--- gcc-9-9-20190208.orig/src/libgo/go/syscall/wait.c
+++ gcc-9-9-20190208/src/libgo/go/syscall/wait.c
@@ -8,6 +8,13 @@
    OS-independent.  */
 
 #include <stdint.h>
+
+/* WCONTINUED is not defined on GNU/Hurd */
+#ifdef __GNU__
+#ifndef WCONTINUED
+#define WCONTINUED 0
+#endif
+#endif
 #include <sys/wait.h>
 
 #include "runtime.h"
Index: gcc-9-9-20190208/src/libgo/mksysinfo.sh
===================================================================
--- gcc-9-9-20190208.orig/src/libgo/mksysinfo.sh
+++ gcc-9-9-20190208/src/libgo/mksysinfo.sh
@@ -486,9 +486,8 @@ grep '^type _st_timespec ' gen-sysinfo.g
 
 # Special treatment of struct stat st_dev for GNU/Hurd
 # /usr/include/i386-gnu/bits/stat.h: #define st_dev st_fsid
-fsid_to_dev=
 if grep 'define st_dev st_fsid' gen-sysinfo.go > /dev/null 2>&1; then
-  fsid_to_dev="-e 's/st_fsid/Dev/'"
+  sed -i -e 's/; st_fsid/; st_dev/' gen-sysinfo.go
 fi
 
 # The stat type.
@@ -501,7 +500,6 @@ else
 fi | sed -e 's/type _stat64/type Stat_t/' \
          -e 's/type _stat/type Stat_t/' \
          -e 's/st_dev/Dev/' \
-         ${fsid_to_dev} \
          -e 's/st_ino/Ino/g' \
          -e 's/st_nlink/Nlink/' \
          -e 's/st_mode/Mode/' \
libgo/ChangeLog

2018-10-20  Svante Signell <svante.signell@gmail.com>
  * libgo/testsuite/gotest: Remove ps -o comm option for GNU/Hurd.

Index: gcc-9-9-20190208/src/libgo/testsuite/gotest
===================================================================
--- gcc-9-9-20190208.orig/src/libgo/testsuite/gotest
+++ gcc-9-9-20190208/src/libgo/testsuite/gotest
@@ -650,7 +650,11 @@ xno)
 		wait $pid
 		status=$?
 		if ! test -f gotest-timeout; then
-		    sleeppid=`ps -o pid,ppid,comm | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		    if test "$goos" = "hurd"; then
+			sleeppid=`ps -o pid,ppid | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		    else
+			sleeppid=`ps -o pid,ppid,comm | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		    fi
 		    kill $alarmpid
 		    wait $alarmpid
 		    if test "$sleeppid" != ""; then
Ian Lance Taylor Feb. 11, 2019, 6:08 a.m. UTC | #6
On Sun, Feb 10, 2019 at 3:41 AM Svante Signell <svante.signell@gmail.com> wrote:
>
> On Sat, 2019-02-09 at 23:57 +0100, Svante Signell wrote:
> > On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> > > On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose <doko@debian.org> wrote:
> > > > On 07.02.19 06:04, Ian Lance Taylor wrote:
> > > What are the lines before that in the log?  For some reason libtool is
> > > being invoke with no source files.  The lines before the failing line
> > > should show an invocation of match.sh that determines the source
> > > files.
> >
> > Thanks for your job upstreaming the patches!
> >
> > I've found some problems. Current problem is with the mksysinfo.sh patch. But
> > there are some other things missing. New patches will be submitted tomorrow.
>
> Attached are three additional patches needed to build libgo on GNU/Hurd:
> src_libgo_mksysinfo.sh.diff
> src_libgo_go_syscall_wait.c.diff
> src_libgo_testsuite_gotest.diff
>
> For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to the old
> version, using sed -i -e. As written now ${fsid_to_dev} expands to
> fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e expression #4,
> char 1: unknown command: `''". Unfortunately, I have not yet been able to modify
> the expansion omitting the single qoutes around the shell variable.

I'm sorry, I don't want to use "sed -i".  That loses the original file
and makes it harder to reconstruct what has happened.

> The second patch, src_libgo_go_syscall_wait.c.diff, is needed since WCONTINUED
> is not defined and is needed for WIFCONTINUED to be defined in wait.h.

I don't understand that.  <sys/wait.h> is a system header file.  Are
you saying that it is impossible to use <sys/wait.h> and WIFCONTINUED
unless your source code does a #define WCONTINUED before #include'ing
<sys/wait.h>?  That seems like a bug in the Hurd library code.

> The third patch, src_libgo_testsuite_gotest.diff, is not strictly needed, but
> running the tests the annoying text is displayed: "ps: comm: Unknown format
> spec"

I get that "comm" doesn't work, but the change in that patch is simply
incorrect.  If you don't pass "comm", the "grep sleep" will never
succeed.  If there is no way to support this code on Hurd then we
should skip it, not put in a command that can never work.

Ian
Svante Signell Feb. 11, 2019, 11:10 a.m. UTC | #7
On Sun, 2019-02-10 at 22:08 -0800, Ian Lance Taylor wrote:
> On Sun, Feb 10, 2019 at 3:41 AM Svante Signell <svante.signell@gmail.com>
> wrote:
> > On Sat, 2019-02-09 at 23:57 +0100, Svante Signell wrote:
> > > On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> > > > On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose <doko@debian.org> wrote:
> > > > > On 07.02.19 06:04, Ian Lance Taylor wrote:
> > > > What are the lines before that in the log?  For some reason libtool is
> > > > being invoke with no source files.  The lines before the failing line
> > > > should show an invocation of match.sh that determines the source
> > > > files.
> > > 
> > > Thanks for your job upstreaming the patches!
> > > 
> > > I've found some problems. Current problem is with the mksysinfo.sh patch.
> > > But there are some other things missing. New patches will be submitted
> > > tomorrow.
> > 
> > Attached are three additional patches needed to build libgo on GNU/Hurd:
> > src_libgo_mksysinfo.sh.diff
> > src_libgo_go_syscall_wait.c.diff
> > src_libgo_testsuite_gotest.diff
> > 
> > For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to the
> > old version, using sed -i -e. As written now ${fsid_to_dev} expands to
> > fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e expression
> > #4, char 1: unknown command: `''". Unfortunately, I have not yet been able
> > to modify the expansion omitting the single qoutes around the shell
> > variable.
> 
> I'm sorry, I don't want to use "sed -i".  That loses the original file
> and makes it harder to reconstruct what has happened.

What to do then?

> > The second patch, src_libgo_go_syscall_wait.c.diff, is needed since
> > WCONTINUED is not defined and is needed for WIFCONTINUED to be defined in
> > wait.h.
> 
> I don't understand that.  <sys/wait.h> is a system header file.  Are
> you saying that it is impossible to use <sys/wait.h> and WIFCONTINUED
> unless your source code does a #define WCONTINUED before #include'ing
> <sys/wait.h>?  That seems like a bug in the Hurd library code.

The problem is that WCONTINUED is not defined in /usr/include/i386-
gnu/bits/waitflags.h on Hurd. Only WNOHANG and WUNTRACED are. That causes
WIFCONTINUED not to be defined in /usr/include/i386-gnu/bits/waitstatus.h. As
WCONTINUED is not defined, I assume that WIFCONTINUED is not supported.

From waitpid(2):
WCONTINUED (since Linux 2.6.10)
   also return if a stopped child has been resumed by delivery of SIGCONT.

@Samuel: more info?

I think that that call to WIFCONTINUED in libgo/go/syscall/wait.c
_Bool
Continued (uint32_t *w)
{
  return WIFCONTINUED (*w) != 0;
}

has to be omitted somehow for Hurd.

> > The third patch, src_libgo_testsuite_gotest.diff, is not strictly needed,
> > but running the tests the annoying text is displayed: "ps: comm: Unknown
> > format spec"
> 
> I get that "comm" doesn't work, but the change in that patch is simply
> incorrect.  If you don't pass "comm", the "grep sleep" will never
> succeed.  If there is no way to support this code on Hurd then we
> should skip it, not put in a command that can never work.

OK, let's drop that part then.

@Samuel: more info?
Ian Lance Taylor Feb. 11, 2019, 6:27 p.m. UTC | #8
On Mon, Feb 11, 2019 at 3:10 AM Svante Signell <svante.signell@gmail.com> wrote:
>
> On Sun, 2019-02-10 at 22:08 -0800, Ian Lance Taylor wrote:
> > On Sun, Feb 10, 2019 at 3:41 AM Svante Signell <svante.signell@gmail.com>
> > wrote:
> > > On Sat, 2019-02-09 at 23:57 +0100, Svante Signell wrote:
> > > > On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> > > > > On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose <doko@debian.org> wrote:
> > > > > > On 07.02.19 06:04, Ian Lance Taylor wrote:
> > > > > What are the lines before that in the log?  For some reason libtool is
> > > > > being invoke with no source files.  The lines before the failing line
> > > > > should show an invocation of match.sh that determines the source
> > > > > files.
> > > >
> > > > Thanks for your job upstreaming the patches!
> > > >
> > > > I've found some problems. Current problem is with the mksysinfo.sh patch.
> > > > But there are some other things missing. New patches will be submitted
> > > > tomorrow.
> > >
> > > Attached are three additional patches needed to build libgo on GNU/Hurd:
> > > src_libgo_mksysinfo.sh.diff
> > > src_libgo_go_syscall_wait.c.diff
> > > src_libgo_testsuite_gotest.diff
> > >
> > > For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to the
> > > old version, using sed -i -e. As written now ${fsid_to_dev} expands to
> > > fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e expression
> > > #4, char 1: unknown command: `''". Unfortunately, I have not yet been able
> > > to modify the expansion omitting the single qoutes around the shell
> > > variable.
> >
> > I'm sorry, I don't want to use "sed -i".  That loses the original file
> > and makes it harder to reconstruct what has happened.
>
> What to do then?
>
> > > The second patch, src_libgo_go_syscall_wait.c.diff, is needed since
> > > WCONTINUED is not defined and is needed for WIFCONTINUED to be defined in
> > > wait.h.
> >
> > I don't understand that.  <sys/wait.h> is a system header file.  Are
> > you saying that it is impossible to use <sys/wait.h> and WIFCONTINUED
> > unless your source code does a #define WCONTINUED before #include'ing
> > <sys/wait.h>?  That seems like a bug in the Hurd library code.
>
> The problem is that WCONTINUED is not defined in /usr/include/i386-
> gnu/bits/waitflags.h on Hurd. Only WNOHANG and WUNTRACED are. That causes
> WIFCONTINUED not to be defined in /usr/include/i386-gnu/bits/waitstatus.h. As
> WCONTINUED is not defined, I assume that WIFCONTINUED is not supported.
>
> From waitpid(2):
> WCONTINUED (since Linux 2.6.10)
>    also return if a stopped child has been resumed by delivery of SIGCONT.
>
> @Samuel: more info?
>
> I think that that call to WIFCONTINUED in libgo/go/syscall/wait.c
> _Bool
> Continued (uint32_t *w)
> {
>   return WIFCONTINUED (*w) != 0;
> }
>
> has to be omitted somehow for Hurd.

It sound like the right fix is to use #ifdef WIFCONTINUED in
syscall/wait.c.  If WIFCONTINUED is not defined, the Continued
function should always return 0.

Ian
Samuel Thibault Feb. 11, 2019, 6:38 p.m. UTC | #9
Svante Signell, le lun. 11 févr. 2019 12:10:21 +0100, a ecrit:
> WCONTINUED is not defined, I assume that WIFCONTINUED is not supported.
> 
> From waitpid(2):
> WCONTINUED (since Linux 2.6.10)
>    also return if a stopped child has been resumed by delivery of SIGCONT.
> 
> @Samuel: more info?

git grep WCONTINUED .
yields nothing in hurd/proc, so it's probably just not supported yet
indeed.

> > > The third patch, src_libgo_testsuite_gotest.diff, is not strictly needed,
> > > but running the tests the annoying text is displayed: "ps: comm: Unknown
> > > format spec"
> > 
> > I get that "comm" doesn't work, but the change in that patch is simply
> > incorrect.  If you don't pass "comm", the "grep sleep" will never
> > succeed.  If there is no way to support this code on Hurd then we
> > should skip it, not put in a command that can never work.
> 
> OK, let's drop that part then.
> 
> @Samuel: more info?

arg0 can be used instead.

That said, we should implement comm since it's defined by posix, it's
probably a matter of duplicating the line "Arg0" in hurd/libps/spec.c

Samuel
Svante Signell Feb. 11, 2019, 9:38 p.m. UTC | #10
On Mon, 2019-02-11 at 10:27 -0800, Ian Lance Taylor wrote:
> On Mon, Feb 11, 2019 at 3:10 AM Svante Signell <svante.signell@gmail.com>
> wrote:
> > On Sun, 2019-02-10 at 22:08 -0800, Ian Lance Taylor wrote:
> > > On Sun, Feb 10, 2019 at 3:41 AM Svante Signell <svante.signell@gmail.com>
> > > wrote:
> > > > On Sat, 2019-02-09 at 23:57 +0100, Svante Signell wrote:
> > > > > On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> > > > > > On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose <doko@debian.org>
> > > > > > wrote:
> > > > > > > On 07.02.19 06:04, Ian Lance Taylor wrote:
> > > > > > What are the lines before that in the log?  For some reason libtool
> > > > > > is
> > > > > > being invoke with no source files.  The lines before the failing
> > > > > > line
> > > > > > should show an invocation of match.sh that determines the source
> > > > > > files.
> > > > > 
> > > > > Thanks for your job upstreaming the patches!
> > > > > 
> > > > > I've found some problems. Current problem is with the mksysinfo.sh
> > > > > patch.
> > > > > But there are some other things missing. New patches will be submitted
> > > > > tomorrow.
> > > > 
> > > > Attached are three additional patches needed to build libgo on GNU/Hurd:
> > > > src_libgo_mksysinfo.sh.diff
> > > > src_libgo_go_syscall_wait.c.diff
> > > > src_libgo_testsuite_gotest.diff
> > > > 
> > > > For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to
> > > > the
> > > > old version, using sed -i -e. As written now ${fsid_to_dev} expands to
> > > > fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e
> > > > expression
> > > > #4, char 1: unknown command: `''". Unfortunately, I have not yet been
> > > > able
> > > > to modify the expansion omitting the single qoutes around the shell
> > > > variable.
> > > 
> > > I'm sorry, I don't want to use "sed -i".  That loses the original file
> > > and makes it harder to reconstruct what has happened.
> > 
> > What to do then?
> > 
> > > > The second patch, src_libgo_go_syscall_wait.c.diff, is needed since
> > > > WCONTINUED is not defined and is needed for WIFCONTINUED to be defined
> > > > in
> > > > wait.h.
> > > 
> > > I don't understand that.  <sys/wait.h> is a system header file.  Are
> > > you saying that it is impossible to use <sys/wait.h> and WIFCONTINUED
> > > unless your source code does a #define WCONTINUED before #include'ing
> > > <sys/wait.h>?  That seems like a bug in the Hurd library code.
> > 
> > The problem is that WCONTINUED is not defined in /usr/include/i386-
> > gnu/bits/waitflags.h on Hurd. Only WNOHANG and WUNTRACED are. That causes
> > WIFCONTINUED not to be defined in /usr/include/i386-gnu/bits/waitstatus.h.
> > As
> > WCONTINUED is not defined, I assume that WIFCONTINUED is not supported.
> > 
> > From waitpid(2):
> > WCONTINUED (since Linux 2.6.10)
> >    also return if a stopped child has been resumed by delivery of SIGCONT.
> > 
> > @Samuel: more info?
> > 
> > I think that that call to WIFCONTINUED in libgo/go/syscall/wait.c
> > _Bool
> > Continued (uint32_t *w)
> > {
> >   return WIFCONTINUED (*w) != 0;
> > }
> > 
> > has to be omitted somehow for Hurd.
> 
> It sound like the right fix is to use #ifdef WIFCONTINUED in
> syscall/wait.c.  If WIFCONTINUED is not defined, the Continued
> function should always return 0.

I've got some ideas on how to solve the mksysinfo.sh problem. I just don't have
time to try it out now. The idea is:
fsid_to_dev='s/st_dev/Dev/'
if grep 'define st_dev st_fsid' gen-sysinfo.go > /dev/null 2>&1; then
fsid_to_dev='s/st_fsid/Dev/'
...
remove: -e 's/st_dev/Dev/' \
add:    -e ${fsid_to_dev} \


I can also easily submit a patch for WIFCONTINUED returning 0. Problem is I'll
be AFK for the next week. Maybe this can wait, or you find a solution? Regardinga comm opttion for ps Samuel is the best source. 

Thanks!
Ian Lance Taylor Feb. 12, 2019, 12:15 a.m. UTC | #11
On Sun, Feb 10, 2019 at 3:40 AM Svante Signell <svante.signell@gmail.com> wrote:
>
> > I've found some problems. Current problem is with the mksysinfo.sh patch. But
> > there are some other things missing. New patches will be submitted tomorrow.
>
> Attached are three additional patches needed to build libgo on GNU/Hurd:
> src_libgo_mksysinfo.sh.diff
> src_libgo_go_syscall_wait.c.diff
> src_libgo_testsuite_gotest.diff
>
> For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to the old
> version, using sed -i -e. As written now ${fsid_to_dev} expands to
> fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e expression #4,
> char 1: unknown command: `''". Unfortunately, I have not yet been able to modify
> the expansion omitting the single qoutes around the shell variable.

I fixed this a slightly different way, as attached.  Bootstrapped and
ran Go testsuite on x86_64-pc-linux-gnu.  Committed to mainline.


Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 268605)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-9b66264ed6adcf3fd215dbfd125c12b022b7280e
+fc8aa5a46433d6ecba9fd1cd0bee4290c314ca06
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/mksysinfo.sh
===================================================================
--- libgo/mksysinfo.sh	(revision 268461)
+++ libgo/mksysinfo.sh	(working copy)
@@ -486,9 +486,9 @@ grep '^type _st_timespec ' gen-sysinfo.g
 
 # Special treatment of struct stat st_dev for GNU/Hurd
 # /usr/include/i386-gnu/bits/stat.h: #define st_dev st_fsid
-fsid_to_dev=
+st_dev='-e s/st_dev/Dev/'
 if grep 'define st_dev st_fsid' gen-sysinfo.go > /dev/null 2>&1; then
-  fsid_to_dev="-e 's/st_fsid/Dev/'"
+  st_dev='-e s/st_fsid/Dev/'
 fi
 
 # The stat type.
@@ -500,8 +500,7 @@ else
   grep '^type _stat ' gen-sysinfo.go
 fi | sed -e 's/type _stat64/type Stat_t/' \
          -e 's/type _stat/type Stat_t/' \
-         -e 's/st_dev/Dev/' \
-         ${fsid_to_dev} \
+         ${st_dev} \
          -e 's/st_ino/Ino/g' \
          -e 's/st_nlink/Nlink/' \
          -e 's/st_mode/Mode/' \
Ian Lance Taylor Feb. 12, 2019, 9:29 p.m. UTC | #12
On Mon, Feb 11, 2019 at 1:38 PM Svante Signell <svante.signell@gmail.com> wrote:
>
> On Mon, 2019-02-11 at 10:27 -0800, Ian Lance Taylor wrote:
>
> > It sound like the right fix is to use #ifdef WIFCONTINUED in
> > syscall/wait.c.  If WIFCONTINUED is not defined, the Continued
> > function should always return 0.

> I can also easily submit a patch for WIFCONTINUED returning 0. Problem is I'll
> be AFK for the next week. Maybe this can wait, or you find a solution? Regardinga comm opttion for ps Samuel is the best source.

I've committed this patch that should fix this problem.  Bootstrapped
and tested on x86_64-pc-linux-gnu.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 268785)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-fc8aa5a46433d6ecba9fd1cd0bee4290c314ca06
+6d03c4c8ca320042bd550d44c0f25575c5311ac2
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/go/syscall/wait.c
===================================================================
--- libgo/go/syscall/wait.c	(revision 268369)
+++ libgo/go/syscall/wait.c	(working copy)
@@ -16,6 +16,10 @@
 #define WCOREDUMP(status) (((status) & 0200) != 0)
 #endif
 
+#ifndef WIFCONTINUED
+#define WIFCONTINUED(x) 0
+#endif
+
 extern _Bool Exited (uint32_t *w)
   __asm__ (GOSYM_PREFIX "syscall.WaitStatus.Exited");
diff mbox series

Patch

libgo/ChangeLog

2018-10-20  Svante Signell <svante.signell@gmail.com>
  * libgo/testsuite/gotest: Remove ps -o comm option for GNU/Hurd.

Index: gcc-9-9-20190125-2.1/src/libgo/testsuite/gotest
===================================================================
--- gcc-9-9-20190125-2.1.orig/src/libgo/testsuite/gotest
+++ gcc-9-9-20190125-2.1/src/libgo/testsuite/gotest
@@ -650,7 +650,11 @@  xno)
 		wait $pid
 		status=$?
 		if ! test -f gotest-timeout; then
-		    sleeppid=`ps -o pid,ppid,comm | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		    if test "$goos" = "hurd"; then
+			sleeppid=`ps -o pid,ppid | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		    else
+			sleeppid=`ps -o pid,ppid,comm | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		    fi
 		    kill $alarmpid
 		    wait $alarmpid
 		    if test "$sleeppid" != ""; then