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

Alpine linux (musl libc) fixes #557

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

ncopa
Copy link

@ncopa ncopa commented Nov 17, 2021

I'm upstreaming a set of patches we have carried for alpine linux for a while.

I believe that buildroot, openwrt, gentoo, void linux and other musl libc based distros will benefit from those.

@johnwvmw
Copy link
Contributor

Thanks for your contribution. Your contribution will go through a review process at VMware.

The changes will probably be reviewed individually or in small groups. An update will be provided as the reviews are completed.

@nuclearfall
Copy link

What's the hold up on this?

@neheb
Copy link

neheb commented Apr 7, 2022

alternate patch for loff_t:

--- a/vmhgfs-fuse/fsutil.h
+++ b/vmhgfs-fuse/fsutil.h
@@ -29,6 +29,9 @@
 
 #include "request.h"
 #include "vm_basic_types.h"
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
 #include "hgfsProto.h"
 #include <fuse.h>

@ncopa
Copy link
Author

ncopa commented Apr 7, 2022

I don't think enabling _GNU_SOURCE for just some of the headers is a good idea. Either it needs to be enabled globally for everything or its not enabled at all.

ncopa added 10 commits April 7, 2022 12:08
Packagers will normally not want the -Werror compile option as it may
break compilation depending on the platform specific warnings.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Use __GLIBC__ when testing for GNU libc specific things instead of
assuming that __linux__ is GNU libc.

This is needed for building with musl libc.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Use the configure script to test for struct time spec instead of trying
to keep track of what platforms has it.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
The ALLPERMS and ACCESSPERMS defines are not specified in POSIX so
assume it is not there instead of testing for specific implementations.

This is needed for musl libc.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Test for various functions instead of trying to keep track of what
platform and what version of the given platform has support for what.

This should make it easier to port to currently unknown platforms and
will solve the issue if a platform add support for a missing feature in
the future.

The features we test for are:
- getifaddrs
- getauxval
- issetugid
- __secure_getenv

This is needed for musl libc.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
This is needed for musl libc.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
musl libc's system headers pulls in open-vm-tools' poll.h. To avoid this
we rename poll.h to vm_poll.h.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
@ncopa
Copy link
Author

ncopa commented Apr 7, 2022

rebased the paches to solve the conflict with almalinux introduction (63abb4f)

@neheb
Copy link

neheb commented Apr 7, 2022

for the latest version, I have some extra fixes:

--- a/lib/err/errPosix.c
+++ b/lib/err/errPosix.c
@@ -29,6 +29,7 @@
 #endif
 
 #include <errno.h>
+#include <stdio.h>
 #include <string.h>
 #include <locale.h>
 
--- a/lib/file/fileIOPosix.c
+++ b/lib/file/fileIOPosix.c
@@ -1741,7 +1741,7 @@ FileIOPreadvInternal(
        * the library horizon this can go away.
        */
       /* coverity[func_conv] */
-      if (preadv64 == NULL) {
+      if (0) {
          fret = FileIOPreadvCoalesced(fd, entries, numEntries, offset,
                                       totalSize, &bytesRead);
          break;
@@ -1882,7 +1882,7 @@ FileIOPwritevInternal(
        * the library horizon this can go away.
        */
       /* coverity[func_conv] */
-      if (pwritev64 == NULL) {
+      if (0) {
          fret = FileIOPwritevCoalesced(fd, entries, numEntries, offset,
                                        totalSize, &bytesWritten);
          break;
--- a/lib/hgfsServer/hgfsServerLinux.c
+++ b/lib/hgfsServer/hgfsServerLinux.c
@@ -32,6 +32,7 @@
 #define _DARWIN_USE_64_BIT_INODE
 #endif
 
+#include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -2573,7 +2574,7 @@ HgfsStatToFileAttr(struct stat *stats,
 #      define FMTTIMET "l"
 #   endif
 #else
-#   define FMTTIMET "l"
+#   define FMTTIMET PRId64
 #endif
    LOG(4, "access: %"FMTTIMET"d/%"FMT64"u \nwrite: %"FMTTIMET"d/%"FMT64"u \n"
        "attr: %"FMTTIMET"d/%"FMT64"u\n",
--- a/services/plugins/gdp/gdpPlugin.c
+++ b/services/plugins/gdp/gdpPlugin.c
@@ -32,7 +32,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/eventfd.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <unistd.h>
 #endif
 

@ncopa
Copy link
Author

ncopa commented Jul 13, 2022

for the latest version, I have some extra fixes:

--- a/lib/file/fileIOPosix.c
+++ b/lib/file/fileIOPosix.c
@@ -1741,7 +1741,7 @@ FileIOPreadvInternal(
        * the library horizon this can go away.
        */
       /* coverity[func_conv] */
-      if (preadv64 == NULL) {
+      if (0) {
          fret = FileIOPreadvCoalesced(fd, entries, numEntries, offset,
                                       totalSize, &bytesRead);
          break;
@@ -1882,7 +1882,7 @@ FileIOPwritevInternal(
        * the library horizon this can go away.
        */
       /* coverity[func_conv] */
-      if (pwritev64 == NULL) {
+      if (0) {
          fret = FileIOPwritevCoalesced(fd, entries, numEntries, offset,
                                        totalSize, &bytesWritten);
          break;
...

I don't think those changes are suitable for upstream.

@ncopa
Copy link
Author

ncopa commented Jul 13, 2022

Would it make it easier to review this if I created a PR for each individual patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants