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

Compilation fails on OSX 10.9, OSXFuse 2.6.2 and bindfs 1.12.3 #6

Closed
gcrofils opened this issue Nov 28, 2013 · 13 comments
Closed

Compilation fails on OSX 10.9, OSXFuse 2.6.2 and bindfs 1.12.3 #6

gcrofils opened this issue Nov 28, 2013 · 13 comments

Comments

@gcrofils
Copy link

After a fresh install of OSXFuse, I tried to install the latest version of bindfs. Unfortunately compilation is failing with 3 warnings and 1 error generated.

gcc -DHAVE_CONFIG_H -I. -I..  -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -I/usr/local/include/osxfuse/fuse   -O2 -Wall -g -O2 -MT bindfs.o -MD -MP -MF .deps/bindfs.Tpo -c -o bindfs.o bindfs.c

bindfs.c:699:11: warning: implicit declaration of function 'utimensat' is
      invalid in C99 [-Wimplicit-function-declaration]
    res = utimensat(settings.mntsrc_fd, path, tv, AT_SYMLINK_NOFOLLOW);
          ^

bindfs.c:699:51: error: use of undeclared identifier 'AT_SYMLINK_NOFOLLOW'
    res = utimensat(settings.mntsrc_fd, path, tv, AT_SYMLINK_NOFOLLOW);
                                                  ^

bindfs.c:918:19: warning: incompatible pointer types initializing 'int (*)(const
      char *, const char *, const char *, size_t, int, uint32_t)' with an
      expression of type 'int (const char *, const char *, const char *, size_t,
      int)' [-Wincompatible-pointer-types]
    .setxattr   = bindfs_setxattr,
                  ^~~~~~~~~~~~~~~

bindfs.c:919:19: warning: incompatible pointer types initializing 'int (*)(const
      char *, const char *, char *, size_t, uint32_t)' with an expression of
      type 'int (const char *, const char *, char *, size_t)'
      [-Wincompatible-pointer-types]
    .getxattr   = bindfs_getxattr,
                  ^~~~~~~~~~~~~~~

Any idea?

@gcrofils
Copy link
Author

Compilation succeeded with 1.12.2.
Nevertheless 3 warnings generated.

bindfs.c:310:21: warning: implicitly declaring library function 'strdup' with type   'char *(const char *)'
        path_copy = strdup(path);
                    ^

bindfs.c:310:21: note: please include the header <string.h> or explicitly provide a declaration for 'strdup'

bindfs.c:390:11: warning: implicit declaration of function 'readlink' is invalid in C99 [-Wimplicit-function-declaration]
    res = readlink(path, buf, size - 1);
          ^

bindfs.c:541:11: warning: implicit declaration of function 'symlink' is invalid in C99 [-Wimplicit-function-declaration]
    res = symlink(from, to);
          ^

@mpartel
Copy link
Owner

mpartel commented Nov 28, 2013

1.12.2 will most likely work fine despite those warnings. I'll fix these the next time I have access to a mac and some free time, which is probably in a month or so.

Looks mostly like missing headers. A quick google suggests OS X doesn't have utimensat, so will have to find a replacement or workaround.

Thanks for reporting!

@jamo
Copy link

jamo commented Nov 28, 2013

btw. I have successfully installed bindfs 1.12 with http://brew.sh
I have OSX mavericks.

@Noctem
Copy link

Noctem commented May 2, 2014

Same issue for me, 1.12.3 compilation fails on OS X 10.9.2; but 1.12.2 works fine.

@hanxue
Copy link
Contributor

hanxue commented May 8, 2014

I may have found out the cause, but don't know how best to fix it. Specifically the error is due to missing symbol AT_SYMLINK_NOFOLLOW which is available in fcntl.h in Linux but not in OSX (I believe for other *BSDs too). The change was introduced via this commit

189a8d5

I can confirm the problem is solved by reverting this commit. Should anyone wish to verify on OSX, use this branch of my fork hanxue@88024be

Avoiding utimens for *BSDs

This issue is not unique to bindfs, see for example https://blog.breadncup.com/files/fuse/0001-Patches-for-Mac-OS-X-Mountain-Lion-for-unionfs-fuse-0.26.patch

+#ifndef __FreeBSD__
    int res = utimensat(0, p, ts, AT_SYMLINK_NOFOLLOW);
+#else
+    struct timeval tv[2];
+    tv[0].tv_sec = ts[0].tv_sec;
+    tv[0].tv_usec = ts[0].tv_nsec*1000;
+    tv[1].tv_sec = ts[1].tv_sec;
+    tv[1].tv_usec = ts[1].tv_nsec*1000;
+    int res= utimes(p,tv);
+#endif

Another example is from the Gluster project

https://bugzilla.redhat.com/show_bug.cgi?id=919916

Suggested Solutions

Either

  1. Avoid using fuse_utimens altogether, or
  2. Use macros (ifdef) to avoid utimens on *BSD systems

I cannot figure out the reason for switching to fuse_utimens from the git commits; the maintainer(s) will be better positioned to decide which solution.

@hanxue
Copy link
Contributor

hanxue commented May 9, 2014

I have written a patch to remove fuse utimens dependency for OSX hanxue@e130b9a

Do you want to give it a try @gcrofils @Noctem ?

The patch will also need to be tested on no-OSX platforms (e.g. Linux)

@mpartel
Copy link
Owner

mpartel commented May 10, 2014

Thanks @hanxue for the investigation and patches. Could you (or someone) please test the latest master on OS X?

@Noctem
Copy link

Noctem commented May 11, 2014

The current git master compiles for me without issue on OS X 10.9.2 with OSXFuse 2.6.4. Thanks @hanxue and @mpartel!

@mpartel
Copy link
Owner

mpartel commented May 11, 2014

Excellent!

Running the test suite sudo make check (requires Ruby 1.9+) as well might be informative. It's been a long while since I've seen it run under OS X, so there may well be test bugs. I'll wait a few days in case anyone feels like looking into it and then upload a new release.

@jamo
Copy link

jamo commented May 13, 2014

I tried running tests and there are some failures, I'll take a look if I can fix those.

@Noctem
Copy link

Noctem commented Jun 5, 2014

sudo make check fails for me very early on.

PASS: test_internals_valgrind.sh
make[5]: Entering directory '/Users/David/GitHub/bindfs/tests/internals'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/Users/David/GitHub/bindfs/tests/internals'
============================================================================
Testsuite summary for bindfs 1.12.3
============================================================================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[4]: Leaving directory '/Users/David/GitHub/bindfs/tests/internals'
make[3]: Leaving directory '/Users/David/GitHub/bindfs/tests/internals'
make[2]: Leaving directory '/Users/David/GitHub/bindfs/tests/internals'
make[2]: Entering directory '/Users/David/GitHub/bindfs/tests'
make  check-TESTS
make[3]: Entering directory '/Users/David/GitHub/bindfs/tests'
make[4]: Entering directory '/Users/David/GitHub/bindfs/tests'
FAIL: test_bindfs.rb
make[5]: Entering directory '/Users/David/GitHub/bindfs/tests'
Making all in internals
make[6]: Entering directory '/Users/David/GitHub/bindfs/tests/internals'
make[6]: Nothing to be done for 'all'.
make[6]: Leaving directory '/Users/David/GitHub/bindfs/tests/internals'
make[6]: Entering directory '/Users/David/GitHub/bindfs/tests'
make[6]: Nothing to be done for 'all-am'.
make[6]: Leaving directory '/Users/David/GitHub/bindfs/tests'
make[5]: Leaving directory '/Users/David/GitHub/bindfs/tests'
============================================================================
Testsuite summary for bindfs 1.12.3
============================================================================
# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See tests/test-suite.log
Please report to martin.partel@gmail.com
============================================================================
Makefile:739: recipe for target 'test-suite.log' failed
make[4]: *** [test-suite.log] Error 1
make[4]: Leaving directory '/Users/David/GitHub/bindfs/tests'
Makefile:845: recipe for target 'check-TESTS' failed
make[3]: *** [check-TESTS] Error 2
make[3]: Leaving directory '/Users/David/GitHub/bindfs/tests'
Makefile:943: recipe for target 'check-am' failed
make[2]: *** [check-am] Error 2
make[2]: Leaving directory '/Users/David/GitHub/bindfs/tests'
Makefile:632: recipe for target 'check-recursive' failed
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory '/Users/David/GitHub/bindfs/tests'
Makefile:387: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1

Here are the contents of test-suite log:

=========================================
   bindfs 1.12.3: tests/test-suite.log
=========================================

# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: test_bindfs.rb
====================

---  ---
[    ]
OK
--- -u nobody -g nogroup ---
[  -u nobody -g nogroup  ]
ERROR: testcase `-u nobody -g nogroup' failed
test failed
  /Users/David/GitHub/bindfs/tests/common.rb:190:in `assert'
  ./test_bindfs.rb:52:in `block in <main>'
  /Users/David/GitHub/bindfs/tests/common.rb:129:in `call'
  /Users/David/GitHub/bindfs/tests/common.rb:129:in `testenv'
  ./test_bindfs.rb:48:in `<main>'

However, over the past month that I've been using the master version I haven't had any issues using or compiling this.

Also, I backported the patches to make 1.12.3 compile in Homebrew here: Homebrew/legacy-homebrew@67288d0. And I'll remove that when a new release is made.

@mpartel
Copy link
Owner

mpartel commented Jun 5, 2014

Thanks, I released 1.12.4 for now and left myself a note about investigating Travis's OS X VMs

@mpartel mpartel closed this as completed Jun 5, 2014
@Noctem
Copy link

Noctem commented Jun 5, 2014

Great, thank you. I cleaned up that Homebrew formula accordingly. (Homebrew/legacy-homebrew#29893)

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

No branches or pull requests

5 participants