Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall, x/sys/unix: ustat is deprecated and has been removed from glibc #25990

Closed
fweimer opened this issue Jun 21, 2018 · 13 comments
Closed

syscall, x/sys/unix: ustat is deprecated and has been removed from glibc #25990

fweimer opened this issue Jun 21, 2018 · 13 comments

Comments

@fweimer
Copy link
Contributor

@fweimer fweimer commented Jun 21, 2018

src/syscall/types_linux.go includes <ustat.h>. The ustat system call was deprecated well before Go development started, and the ustat manual page said so since basically forever.

glibc 2.28 will remove the header file, so Go will no longer build. Seen so far with libgo on the GCC branch gcc-8-branch. Go 1.0.3 itself still appears to build. However, I think it makes sense to remove this interface upstream as well.

@ALTree ALTree changed the title ustat is deprecated and has been removed from glibc syscall: ustat is deprecated and has been removed from glibc Jun 21, 2018
@ALTree ALTree added this to the Go1.12 milestone Jun 21, 2018
@agnivade
Copy link
Contributor

@agnivade agnivade commented Jun 21, 2018

@tklauser
Copy link
Member

@tklauser tklauser commented Jun 21, 2018

<ustat.h> is included in src/syscall/types_linux.go only to generate the syscall wrapper functions, types and constants. It's not used in the build itself, so the build won't break event if glibc remove the header. But we will no longer be able to (re-)generate the wrappers.

In golang.org/x/sys/unix (which should be used instead of syscall outside the standard library anyhow) https://golang.org/cl/119655 just recently deprecated Ustat for linux/arm64 and I think we should do the same for all other GOARCHes.

About syscall I'm not sure. I think we might want to return ENOSYS, but removing the function would probably break the Go 1 compatibility promise. In any case, I'll let @ianlancetaylor decide on that one.

@tklauser
Copy link
Member

@tklauser tklauser commented Jun 21, 2018

We might even remove Ustat from golang.org/x/sys/unix altogether IMO. The Go 1 compatibility promise doesn't apply there.

@tklauser tklauser changed the title syscall: ustat is deprecated and has been removed from glibc syscall, x/sys/unix: ustat is deprecated and has been removed from glibc Jun 21, 2018
@gopherbot
Copy link

@gopherbot gopherbot commented Jun 21, 2018

Change https://golang.org/cl/120295 mentions this issue: unix: remove Ustat on Linux

@awilfox
Copy link

@awilfox awilfox commented Jun 22, 2018

Just to chime in from the musl side, musl has never shipped a <ustat.h>, which did not break the build of GCC's libgo here, but caused an error during linking:

../powerpc-foxkit-linux-musl/libgo/.libs/libgo.so: undefined reference to `ustat'

I think that if glibc actually removes the symbol, not just the header, then there will be further pain in GCC libgo.

@fweimer
Copy link
Contributor Author

@fweimer fweimer commented Jun 22, 2018

glibc 2.28 will remove the symbol in the sense that new binaries can no longer link, so there's a link failure with libgo.so as well.

gopherbot pushed a commit to golang/sys that referenced this issue Jun 22, 2018
The ustat syscall has been deprecated on Linux for a long time and the
upcoming glibc 2.28 will remove ustat.h and it can no longer be used to
to generate the Ustat_t wrapper type. Since Linux still provides the
syscall, let's not break this functionality and add a private copy of
struct ustat so Ustat_t can still be generated.

Updates golang/go#25990

Change-Id: I74cf405ce6df92da36f1ee900ab6d98997d8f994
Reviewed-on: https://go-review.googlesource.com/120295
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@gopherbot
Copy link

@gopherbot gopherbot commented Jun 22, 2018

Change https://golang.org/cl/120535 mentions this issue: syscall: remove Ustat

gopherbot pushed a commit to golang/gofrontend that referenced this issue Jun 22, 2018
glibc 2.28 removes ustat.h and the ustat function entirely, which
breaks syscall.Ustat.

Updates golang/go#25990

Change-Id: I430802c86389a02cb4a0cd6caff36fa542d98f2f
Reviewed-on: https://go-review.googlesource.com/120535
Reviewed-by: Than McIntosh <thanm@google.com>
hubot pushed a commit to gcc-mirror/gcc that referenced this issue Jun 22, 2018
    
    glibc 2.28 removes ustat.h and the ustat function entirely, which
    breaks syscall.Ustat.
    
    Updates golang/go#25990
    
    Reviewed-on: https://go-review.googlesource.com/120535


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@261895 138bc75d-0d04-0410-961f-82ee72b054a4
hubot pushed a commit to gcc-mirror/gcc that referenced this issue Jun 22, 2018
    
    glibc 2.28 removes ustat.h and the ustat function entirely, which
    breaks syscall.Ustat.
    
    Updates golang/go#25990
    
    Reviewed-on: https://go-review.googlesource.com/120535


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261896 138bc75d-0d04-0410-961f-82ee72b054a4
hubot pushed a commit to gcc-mirror/gcc that referenced this issue Jun 22, 2018
    
    glibc 2.28 removes ustat.h and the ustat function entirely, which
    breaks syscall.Ustat.
    
    Updates golang/go#25990
    
    Reviewed-on: https://go-review.googlesource.com/120535


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@261894 138bc75d-0d04-0410-961f-82ee72b054a4
@awilfox
Copy link

@awilfox awilfox commented Jun 24, 2018

Doesn't seem to remove it from Makefile.am/Makefile.in, so it just ends up with an error:

make[4]: *** No rule to make target 'go/syscall/libcall_linux_ustat.go', needed by 'syscall.lo'.  Stop.

The following patch fixes it:

--- gcc-6.4.0/libgo/Makefile.am.old     2016-02-03 15:58:02.419872000 -0600
+++ gcc-6.4.0/libgo/Makefile.am 2018-06-23 02:55:45.772611885 -0500
@@ -1,4 +1,3 @@
-# Makefile.am -- Go library Makefile.

 # Copyright 2009 The Go Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style
@@ -1989,17 +1988,6 @@
 syscall_lsf_file =
 endif

-# GNU/Linux specific ustat support.
-if LIBGO_IS_LINUX
-if LIBGO_IS_ARM64
-syscall_ustat_file =
-else
-syscall_ustat_file = go/syscall/libcall_linux_ustat.go
-endif
-else
-syscall_ustat_file =
-endif
-
 # GNU/Linux specific utimesnano support.
 if LIBGO_IS_LINUX
 syscall_utimesnano_file = go/syscall/libcall_linux_utimesnano.go
@@ -2051,7 +2039,6 @@
        $(syscall_uname_file) \
        $(syscall_netlink_file) \
        $(syscall_lsf_file) \
-       $(syscall_ustat_file) \
        $(syscall_utimesnano_file) \
        $(GO_LIBCALL_OS_FILE) \
        $(GO_LIBCALL_OS_ARCH_FILE) \
--- gcc-6.4.0/libgo/Makefile.in.old     2016-02-03 15:58:02.419872000 -0600
+++ gcc-6.4.0/libgo/Makefile.in 2018-06-23 02:56:04.842611681 -0500
@@ -2080,11 +2080,6 @@

 # GNU/Linux specific socket filters.
 @LIBGO_IS_LINUX_TRUE@syscall_lsf_file = go/syscall/lsf_linux.go
-@LIBGO_IS_ARM64_FALSE@@LIBGO_IS_LINUX_TRUE@syscall_ustat_file = go/syscall/libcall_linux_ustat.go
-
-# GNU/Linux specific ustat support.
-@LIBGO_IS_ARM64_TRUE@@LIBGO_IS_LINUX_TRUE@syscall_ustat_file = 
-@LIBGO_IS_LINUX_FALSE@syscall_ustat_file = 
 @LIBGO_IS_LINUX_FALSE@syscall_utimesnano_file = go/syscall/libcall_posix_utimesnano.go

 # GNU/Linux specific utimesnano support.
@@ -2122,7 +2117,6 @@
        $(syscall_uname_file) \
        $(syscall_netlink_file) \
        $(syscall_lsf_file) \
-       $(syscall_ustat_file) \
        $(syscall_utimesnano_file) \
        $(GO_LIBCALL_OS_FILE) \
        $(GO_LIBCALL_OS_ARCH_FILE) \
@tklauser
Copy link
Member

@tklauser tklauser commented Jun 25, 2018

@awilfox want to send the patch as a CL (https://golang.org/doc/contribute.html)?

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 25, 2018

Change https://golang.org/cl/120563 mentions this issue: syscall: use private copy of ustat_t on Linux

@awilfox
Copy link

@awilfox awilfox commented Jun 25, 2018

@tklauser I'd be happy to, but I'm going to have to actually manage to have Go binaries running properly on my development workstation before I can install git-codereview.

That might take some time; I have a friend who's already signed the CLA so I may let them submit it instead, assuming they approve of the change (it's simple, so I don't see why not).

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 25, 2018

@awilfox I'm not maintaining the GCC 6 branch any more. I'm not even sure that the branch is still open; it's been a year since the last GCC 6 release.

The Makefile patch you mention is not required on GCC 7 or newer.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 26, 2018

@awilfox Actually it turns out that there will be a 6.5 release, so I just committed the patch to the GCC 6 branch, including the Makefile change.

hubot pushed a commit to gcc-mirror/gcc that referenced this issue Jun 26, 2018
    
    glibc 2.28 removes ustat.h and the ustat function entirely, which
    breaks syscall.Ustat.
    
    Updates golang/go#25990
    
    Reviewed-on: https://go-review.googlesource.com/120535


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@262128 138bc75d-0d04-0410-961f-82ee72b054a4
@gopherbot gopherbot closed this in 88aa208 Aug 20, 2018
zchee pushed a commit to zchee/golang-gollvm that referenced this issue Aug 22, 2018
Per golang/go#25990, we no longer
need/want ustat.h.

Change-Id: I3ab44b00a46c10e087262a22476802478a11487a
Reviewed-on: https://go-review.googlesource.com/120755
Reviewed-by: Cherry Zhang <cherryyz@google.com>
@golang golang locked and limited conversation to collaborators Aug 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.