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

fuse_parse_cmdline issues on NetBSD #18

Open
krytarowski opened this issue Mar 10, 2017 · 12 comments
Open

fuse_parse_cmdline issues on NetBSD #18

krytarowski opened this issue Mar 10, 2017 · 12 comments
Labels

Comments

@krytarowski
Copy link

I'm getting crashes with squashfuse on NetBSD. I narrowed it down to prototype mismatch between fuse_parse_cmdline() in this package and in system.

During build:

--- libfuseprivate_la-fuseprivate.lo ---
fuseprivate.c: In function 'sqfs_usage':
fuseprivate.c:105:3: warning: implicit declaration of function 'fuse_parse_cmdline' [-Wimplicit-function-declaration]
   fuse_parse_cmdline(&args, NULL, NULL, NULL);

Backtrace

$ gdb --args squashfuse -v                                                                                                                                    
GNU gdb (GDB) 7.12
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64--netbsd".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from squashfuse...done.
(gdb) r
Starting program: /usr/pkg/bin/squashfuse -v
squashfuse 0.1.100 (c) 2012 Dave Vasilevsky

Usage: /usr/pkg/bin/squashfuse [options] ARCHIVE MOUNTPOINT


Program received signal SIGSEGV, Segmentation fault.
fuse_parse_cmdline (args=0x7f7fff446c90, opts=0x0) at /usr/src/lib/librefuse/refuse_lowlevel.c:125
125		memset(opts, 0, sizeof(*opts));
(gdb) bt
#0  fuse_parse_cmdline (args=0x7f7fff446c90, opts=0x0) at /usr/src/lib/librefuse/refuse_lowlevel.c:125
#1  0x000000000040628e in sqfs_usage (progname=0x7f7fff447470 "/usr/pkg/bin/squashfuse", fuse_usage=true) at fuseprivate.c:105
#2  0x00000000004018da in main (argc=2, argv=0x7f7fff446eb0) at hl.c:305

Browsing libfuse examples they confirm that the function prototype is different out there - with two arguments.

@vasi
Copy link
Owner

vasi commented Feb 10, 2020

I can't reproduce this. What version of NetBSD is it?

@krytarowski
Copy link
Author

Back in 2017 it was probably pre-NetBSD-8.

@krytarowski
Copy link
Author

NetBSD/src/lib/librefuse/fuse_lowlevel.h int fuse_parse_cmdline(struct fuse_args *args, struct fuse_cmdline_opts *opts);

fuseprivate.c fuse_parse_cmdline(&args, NULL, NULL, NULL);

@vasi
Copy link
Owner

vasi commented Feb 19, 2020

Great, thanks! I'll look into it.

@vasi
Copy link
Owner

vasi commented Feb 19, 2020

On NetBSD 8.1, I have fuse-2.9.3 installed with pkgin, and everything Just Works™️. The header you mentioned (which lives in /usr/include/fuse_lowlevel.h) doesn't include fuse_lowlevel_new, so it's odd that configure found it. It's really barely a stub, I don't know if any real lowlevel FUSE FS can compile against that.

Any more clues to reproducing this?

@krytarowski
Copy link
Author

I checked squashfuse-0.1.103 and the problem is resolved in this version.

@krytarowski
Copy link
Author

Opps. It still builds but still breaks in runtime.

--- squashfuse_extract-extract.o ---
extract.c: In function 'sqfs_stat':
extract.c:51:17: warning: implicit declaration of function 'sqfs_makedev'; did you mean 'sqfs_mode'? [-Wimplicit-function-declaration]
   st->st_rdev = sqfs_makedev(inode->xtra.dev.major,
                 ^~~~~~~~~~~~
                 sqfs_mode
--- libsquashfuse_la-table.lo ---
  CC       libsquashfuse_la-table.lo
--- libfuseprivate_la-fuseprivate.lo ---
fuseprivate.c: In function 'sqfs_usage':
fuseprivate.c:105:3: warning: implicit declaration of function 'fuse_parse_cmdline'; did you mean 'fuse_daemonize'? [-Wimplicit-function-declaration]
   fuse_parse_cmdline(&args, NULL, NULL, NULL);
   ^~~~~~~~~~~~~~~~~~
   fuse_daemonize
--- libsquashfuse_la-dir.lo ---
(No debugging symbols found in squashfuse)
(gdb) r
Starting program: /usr/pkg/bin/squashfuse 
squashfuse 0.1.103 (c) 2012 Dave Vasilevsky

Usage: /usr/pkg/bin/squashfuse [options] ARCHIVE MOUNTPOINT


Program received signal SIGSEGV, Segmentation fault.
fuse_parse_cmdline (args=0x7f7fffffe4f0, opts=0x0) at /usr/src/lib/librefuse/refuse_lowlevel.c:125
125             memset(opts, 0, sizeof(*opts));
(gdb) bt
#0  fuse_parse_cmdline (args=0x7f7fffffe4f0, opts=0x0) at /usr/src/lib/librefuse/refuse_lowlevel.c:125
#1  0x00007f7ff7400c16 in sqfs_usage () from /usr/pkg/lib/libfuseprivate.so.0
#2  0x0000000000401c4c in ?? ()
#3  0x000000000040143b in ?? ()
#4  0x00007f7ff7c0c178 in ?? () from /usr/libexec/ld.elf_so
#5  0x0000000000000001 in ?? ()
#6  0x00007f7fffffed00 in ?? ()
#7  0x0000000000000000 in ?? ()

NetBSD chieftec 9.99.46 NetBSD 9.99.46 (GENERIC) #2: Wed Feb 12 11:41:14 CET 2020 root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64

@krytarowski krytarowski reopened this Feb 19, 2020
@vasi
Copy link
Owner

vasi commented Feb 19, 2020

Oooh nice, more data! Can you send the config.log please?

@krytarowski
Copy link
Author

The bug is obvious that there is mismatch in function prototypes.

If you already have 8.1, you can try to debug it yourself.

@vasi
Copy link
Owner

vasi commented Feb 19, 2020

Like I said, I have 8.1 and I can't reproduce that. I see these results using squashfuse master:

  • With fuse installed via pkgin, the configure script detects that. The fuse package includes a header with the expected fuse_parse_cmdline. Everything builds and runs fine with git clean -fxd :/ && ./autogen.sh && ./configure && make && mkdir mnt && sudo ./squashfuse_ll ../test.squashfs mnt
  • Without fuse installed via pkgin, no FUSE library is detected. There's no libfuse.so anywhere on my filesystem.

So clearly there's something else going on in your case. Did you provide arguments to configure? Did you get libfuse from somewhere else? Is there some installation set that contains libfuse?

@krytarowski
Copy link
Author

I have packaged it as fuse-squashfuse in pkgsrc-wip.

https://github.com/NetBSD/pkgsrc-wip/tree/master/fuse-squashfuse

https://pkgsrc.org/wip/

@vasi vasi added the bug label Feb 29, 2020
@wbender-wurl
Copy link

wbender-wurl commented Nov 10, 2021

I got a similar error on Ubuntu 20 following these instructions https://engineering.fb.com/2018/07/13/data-infrastructure/xars-a-more-efficient-open-source-system-for-self-contained-executables/
warning: implicit declaration of function ‘sqfs_makedev’; did you mean ‘sqfs_mode’? [-Wimplicit-function-declaration]

Oddly enough, running ./autogen.sh before ./configure fixed it.

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

No branches or pull requests

3 participants