Giter Club home page Giter Club logo

hfsfuse's People

Contributors

0x09 avatar dhowett avatar morgant avatar phcoder avatar pteromys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hfsfuse's Issues

Releases?

My apologies in advance if this is not the appropriate place to ask this. Do you plan to tag releases at any point?

I'd like to create and maintain an OpenBSD port of hfsfuse, but would realistically need tagged versions to do so.

Regardless, thanks for the excellent project!

Argument list too long

First of all, many thanks for this awesome driver!

I am currently trying to recover a few thousand font files using Linux from a HFS+ disk. This requires me to read the resource fork.

However for a number of files (~15%) I get the following error when reading the resource fork attribute Argument list too long:

[jreimann@localhost /]$ getfattr -d  "/media/Users/abc/Font Library/A/Avant Garde Gothic URW/Avant Garde Gothic URW"
getfattr: Removing leading '/' from absolute path names
# file: media/Users/abc/Font Library/A/Avant Garde Gothic URW/Avant Garde Gothic URW
user.com.apple.FinderInfo=0sRkZJTERNT1YAAP////8AAAAAAAAAAAAAAAAAAAAAAAA=
/media/Users/abc/Font Library/A/Avant Garde Gothic URW/Avant Garde Gothic URW: user.com.apple.ResourceFork: Argument list too long
user.hfsfuse.record.date_created=0sMjAwMS0wMy0wMlQwOTozNjowMCsAAAAA

I did compile on Fedora 26 with the following options:

CC=cc
CONFIG_CFLAGS=-O3 -std=gnu11
WITH_UBLIO=none
WITH_UTF8PROC=none

Error mounting on GNU/Linux: all records greater than key / could not find root parent

Hi, I ran into an error using this in GNU/Linux, saying "all records greater than key" and "could not find root parent" when mounting a disk. The disk mounts OK using the Linux kernel driver. (I was trying this program to try to get around a character encoding issue with the Linux driver, but the Linux driver mostly works. Hfsexplorer is able to read the drive without any character encoding issues, but I want to mount it as a directory, which hfsexplorer can't do.)

I built hfsfuse from commit 70e2afe.

I'd appreciate any help with getting it working if possible! Thank you.

Here are the errorred output of hfsfuse, mounting it successfully with mount, the uname -a of the system I'm using, and output of hfsdump for the disk:

elegiac / # /home/kyan/hfsfuse/hfsfuse -o noublio /dev/sdc2 /redacted
all records greater than key
could not find root parent
elegiac / # ls !$
ls /redacted
ls: cannot access '/redacted': No such file or directory
-bash
failed with the error on /usr/bin/error-notify line 28 in / at 20211201232138914501699U2d303530300a:
An error was reported on  line 95 in / at 20211201232138870343719U2d303530300a.
elegiac / # umount /redacted 
elegiac / # mount -o ro,decompose  /dev/sdc2 /redacted
elegiac / # ls /redacted/.DS_Store
/redacted/.DS_Store
elegiac / # uname -a
Linux elegiac 5.4.72-gentoo-x86_64 #1 SMP PREEMPT Tue Nov 10 01:25:59 EST 2020 x86_64 Intel(R) Core(TM) i7-6560U CPU @ 2.20GHz GenuineIntel GNU/Linux
elegiac / # /home/kyan/hfsfuse/hfsdump /dev/sdc2
all records greater than key
could not find root parent
Volume name: 
Journaled? 1
Readonly? 1
Offset: 0
volume header:
signature: H+
version: 4
attributes: hwlock 0 unmounted 1 badblocks 0 nocache 0 dirty 0 cnids recycled 0 journaled 1 swlock 0
last_mounting_version: HFSJ
journal_info_block: 14905
date_created: Fri Nov  3 16:21:38 2017
date_modified: Fri Nov 12 16:01:47 2021
date_backedup: Wed Dec 31 19:00:00 1969
date_checked: Fri Nov  3 20:21:38 2017
file_count: 15500081
folder_count: 870963
block_size: 8192
total_blocks: 976711291
free_blocks: 107528638
next_alloc_block: 791701316
rsrc_clump_size: 65536
data_clump_size: 65536
next_cnid: 216797604
write_count: 166153162
encodings: 35651839
finderinfo:
        Boot directory ID: 0
        Startup parent directory ID: 0
        Display directory ID: 0
        OS classic system directory ID: 0
        OS X system directory ID: 0
        Volume unique ID: b315a2c4ef8331bd
elegiac / # 

Doesn't find system libutf8proc on OpenBSD 6.8

OpenBSD 6.8 has libutf8proc in ports, but when building with gmake WITH_UTF8PROC=system, it fails with the following error:

In file included from features.c:25:                                                                                                                           
/home/linetrace/Projects/hfsfuse/lib/libhfsuser/features.h:5:10: fatal error: 'utf8proc.h' file not found
#include "utf8proc.h"
         ^~~~~~~~~~~~

ld: library not found for -lutf8proc

Mac OS Catalina 10.15.7

Following the instructions on the front page.

make config WITH_UBILIO=none WITH_UTF8PROC=system
Makefile:87: Warning: git repo nor prepackaged version.h found, hfsfuse will be built without version information
echo "$CONFIG" > config.mak
user@iMac ~/D/hfsfuse-master> make 
Makefile:87: Warning: git repo nor prepackaged version.h found, hfsfuse will be built without version information
cc -Wall -Wextra -pedantic -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-parameter -Wno-missing-field-initializers -Wno-missing-braces -DFUSE_USE_VERSION=28 -I/usr/local/include/osxfuse -I /Users/user/Downloads/hfsfuse-master/lib -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11   -DHFSFUSE_VERSION_STRING=\"omitted\" -c -o src/hfsfuse.o src/hfsfuse.c
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C lib/libhfsuser/
cc -Wall -Wextra -pedantic -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-parameter -Wno-missing-field-initializers -Wno-missing-braces -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11   -DHFSFUSE_VERSION_STRING=\"omitted\" -DHAVE_BIRTHTIME -DHAVE_UBLIO -DHAVE_UTF8PROC -I /Users/user/Downloads/hfsfuse-master/lib -c -o cache.o cache.c
cc -Wall -Wextra -pedantic -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-parameter -Wno-missing-field-initializers -Wno-missing-braces -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11   -DHFSFUSE_VERSION_STRING=\"omitted\" -DHAVE_BIRTHTIME -DHAVE_UBLIO -DHAVE_UTF8PROC -I /Users/user/Downloads/hfsfuse-master/lib -c -o features.o features.c
cc -Wall -Wextra -pedantic -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-parameter -Wno-missing-field-initializers -Wno-missing-braces -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11   -DHFSFUSE_VERSION_STRING=\"omitted\" -DHAVE_BIRTHTIME -DHAVE_UBLIO -DHAVE_UTF8PROC -I /Users/user/Downloads/hfsfuse-master/lib -c -o hfsuser.o hfsuser.c
ar rcs libhfsuser.a cache.o features.o hfsuser.o
ranlib libhfsuser.a
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C lib/libhfs/
cc -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11   -DHFSFUSE_VERSION_STRING=\"omitted\" -c -o endian.o endian.c
cc -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11   -DHFSFUSE_VERSION_STRING=\"omitted\" -c -o libhfs.o libhfs.c
cc -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11   -DHFSFUSE_VERSION_STRING=\"omitted\" -c -o unicode.o unicode.c
ar rcs libhfs.a endian.o libhfs.o unicode.o
ranlib libhfs.a
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C lib/ublio/
cc -g -O2 -Wall -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11   -DHFSFUSE_VERSION_STRING=\"omitted\" -c ublio.c -o ublio.o
ar rcs libublio.a ublio.o
cc -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11   -DHFSFUSE_VERSION_STRING=\"omitted\" -lutf8proc -o hfsfuse src/hfsfuse.o lib/libhfsuser/libhfsuser.a lib/libhfs/libhfs.a lib/ublio/libublio.a -losxfuse -lpthread
ld: library not found for -lutf8proc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [hfsfuse] Error 1

kext load failed

The program threw an error when I tried to run it:

$ sudo ./hfsfuse --force -o noatime /dev/disk2s2 ~/iPod
kext load failed: -603947007
mount_osxfuse: the file system is not available (255)

Here's the result of make config:

HAVE_BEXXTOH_ENDIAN_H: no
HAVE_BEXXTOH_SYS_ENDIAN_H: no
HAVE_OSBYTEORDER_H: yes
HAVE_BIRTHTIME: yes
HAVE_STAT_FLAGS: yes
HAVE_STAT_BLKSIZE: yes
HAVE_STAT_BLOCKS: yes
HAVE_VSYSLOG: yes
HAVE_PREAD: yes

There was one warning in the make output, though I'm not sure if it's relevant:

/Library/Developer/CommandLineTools/usr/bin/make -C lib/utf8proc/
cc  -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11   -DHAVE_OSBYTEORDER_H -DHAVE_BIRTHTIME -DHAVE_STAT_FLAGS -DHAVE_STAT_BLKSIZE -DHAVE_STAT_BLOCKS -DHAVE_VSYSLOG -DHAVE_PREAD -DUTF8PROC_EXPORTS -DHFSFUSE_VERSION_STRING=\"0.153-0c63f43\" -fPIC -std=c99 -Wsign-conversion -Wall -Wextra -pedantic -DUTF8PROC_EXPORTS  -c -o utf8proc.o utf8proc.c
utf8proc.c:413:36: warning: implicit conversion changes signedness: 'const utf8proc_propval_t' (aka 'const short') to 'utf8proc_category_t' [-Wsign-conversion]
  return utf8proc_get_property(c)->category;

Let me know if you might need any other info to diagnose.

FreeBSD port

Thank you for hfsfuse, it is so useful to be able to read directly HFS+ drives.
Would it be possible to have a FreeBSD port for hfsfuse?
It would help a lot inexperienced users (like myself) to install it.

make install fails

make install files on Big Sur:

Makefile:155: Warning: git repo nor prepackaged version.h found, hfsfuse will be built without version information
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C lib/libhfsuser/
make[1]: Nothing to be done for all'. /Applications/Xcode.app/Contents/Developer/usr/bin/make -C lib/libhfs/ make[1]: Nothing to be done for all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C lib/ublio/
make[1]: libublio.a' is up to date. /Applications/Xcode.app/Contents/Developer/usr/bin/make -C lib/utf8proc/ make[1]: Nothing to be done for all'.
install hfsfuse hfsdump /usr/local/bin/
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 file2
install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 ... fileN directory
install -d [-v] [-g group] [-m mode] [-o owner] directory ...
make: *** [install] Error 64

make config fails with errors under macOS Big Sur

Trying to make and install hfsfuse under macOS Big Sur 11.0 (Beta 20A5395g) fails:

  • Executing…
make config WITH_UBILIO=local WITH_UTF8PROC=localmakemake install
  • …fails with the following errors
Undefined symbols for architecture x86_64:
  "_utf8proc_decompose_char", referenced from:
      _hfs_pathname_from_unix in libhfsuser.a(hfsuser.o)
  "_utf8proc_get_property", referenced from:
      _hfs_pathname_from_unix in libhfsuser.a(hfsuser.o)
  "_utf8proc_iterate", referenced from:
      _hfs_pathname_from_unix in libhfsuser.a(hfsuser.o)
  "_utf8proc_reencode", referenced from:
      _hfs_pathname_from_unix in libhfsuser.a(hfsuser.o)
  "_utf8proc_version", referenced from:
      _hfs_lib_utf8proc_version in libhfsuser.a(features.o)
     (maybe you meant: _hfs_lib_utf8proc_version)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [hfsfuse] Error 1

Any ideas if this can be fixed within the current release, or needs an update to work under macOS Big Sur explicitely?

Thanks!

Slow rsync speed on USB3 device mounted via USB3 port

Hello,
I am now testing hfsfuse, rsync'ing a large iso file, and I m getting a speed of about 3.8 MB/s:

# rsync -avP -stats /media/hd/FreeBSD-11-RELEASE-x64-USB.iso /tmp
FreeBSD-11-RELEASE-x64-USB.iso
     88,113,152   2%    3.81MB/s    0:18:14

I am also trying on a different server, still with USB 3 device, connected to USB 3 port, with same kind of speed.

I can see the drive as da0: 400.000MB/s transfers:

ugen0.5: <Seagate BUP Slim BK> at usbus0
umass0 numa-domain 0 on uhub1
umass0: <Seagate BUP Slim BK, class 0/0, rev 3.00/1.00, addr 4> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x0100
umass0:10:0: Attached to scbus10
da0 at umass-sim0 bus 0 scbus10 target 0 lun 0
da0: <Seagate BUP Slim BK 0302> Fixed Direct Access SPC-4 SCSI device
da0: Serial Number NA7K63XX
da0: 400.000MB/s transfers
da0: 1907729MB (3907029167 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>

Is that a current limit of hfsfuse, or is there perhaps a switch to activate?

Thank you again.

Garbled, varying text after symlink destinations

Hello,

After using hfsfuse to transfer some files from an HFS+ drive with rsync, I noticed that running ls on some symlinks shows random bytes appearing, appended at the end of the actual destination. For example:

$ ls -la 'node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Versions/'
total 4
drwxr-xr-x 1 99 99  36 May 11  2021 .
drwxr-xr-x 1 99 99 158 May 11  2021 ..
drwxr-xr-x 1 99 99 142 May 11  2021 91.0.4469.0
lrwxrwxrwx 1 99 99  14 May 11  2021 Current -> '91.0.4469.0'$'\324\374\177'

A few more examples can be seen in this rsync output from when I was copying from the HFS+ drive:

sending incremental file list
download -> /Volumes/Seagate/Downloads/
UserData/RunningChromeVersion -> 91.0.4469.0\#324\#374^?
UserData/SingletonCookie -> 14662535177158702104\#374^?
UserData/SingletonLock -> Sebastians-MacBook-Pro.local-13512w\#324\#374^?
UserData/SingletonSocket -> /var/folders/yg/9244vmfs33v7l8m1wm7glkp40000gn/T/.org.chromium.Chromium.xBO8KQ/SingletonSocket
node_modules/.bin/extract-zip -> ../extract-zip/cli.js^?
node_modules/.bin/rimraf -> ../rimraf/bin.jsli.js^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Chromium Framework -> Versions/Current/Chromium Framework\#324\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Helpers -> Versions/Current/Helpersm Framework\#324\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Internet Plug-Ins -> Versions/Current/Internet Plug-Insk\#324\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Libraries -> Versions/Current/LibrariesPlug-Insk\#324\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Resources -> Versions/Current/ResourcesPlug-Insk\#324\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/XPCServices -> Versions/Current/XPCServicesug-Insk\#324\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Versions/Current -> 91.0.4469.0\#324\#374^?

Strangely, after remounting, the issue sometimes goes away when using ls -la to see what the symlinks point to, but re-running rsync shows that rsync is detecting differnces in what the symlinks point to:

sending incremental file list
UserData/RunningChromeVersion -> 91.0.4469.0!\#374^?
UserData/SingletonLock -> Sebastians-MacBook-Pro.local-13512\#340!\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Chromium Framework -> Versions/Current/Chromium Framework!\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Helpers -> Versions/Current/Helpersm Framework!\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Internet Plug-Ins -> Versions/Current/Internet Plug-Insk!\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Libraries -> Versions/Current/LibrariesPlug-Insk!\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Resources -> Versions/Current/ResourcesPlug-Insk!\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/XPCServices -> Versions/Current/XPCServicesug-Insk!\#374^?
node_modules/puppeteer/.local-chromium/mac-869685/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Versions/Current -> 91.0.4469.0!\#374^?

This seems like it might be a reading out-of-bounds type of issue - maybe somewhere in the code it reads outside the string or doesn't put a null terminator early enough. Where could this problem be in the code - maybe where link resolution happens like in hfsfuse_readlink or hfsfuse_opendir?

FreeBSD: 'fuse/fuse.h' file not found

Please forgive my ignorance of gmake compilation.

I am trying to compile this on FreeBSD 11.1-RELEASE-p4.

I seem to have fuse.h already on my system:

# locate fuse.h
/usr/local/include/fuse/fuse.h
/usr/local/include/fuse.h
/usr/src/sys/arm/nvidia/tegra_efuse.h
/usr/src/sys/fs/fuse/fuse.h

But when I run gmake right after gmake config I get

~/src/hfsfuse # gmake config
echo CC=cc > config.mak
echo CONFIG_CFLAGS=-O3 -std=gnu11  >> config.mak
echo WITH_UBLIO=local >> config.mak
echo WITH_UTF8PROC=local >> config.mak
root@store:~/src/hfsfuse # gmake 
cc -O3 -std=gnu11  -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -I /root/src/hfsfuse/lib -c -o src/hfsfuse.o src/hfsfuse.c
src/hfsfuse.c:31:10: fatal error: 'fuse/fuse.h' file not found
#include <fuse/fuse.h>
         ^~~~~~~~~~~~~
1 error generated.
gmake: *** [Makefile:60: src/hfsfuse.o] Error 1

How can I make it work?

32-bit build fails to open large dmgs

Hi there! I managed to do a 32-bit build by passing CFLAGS=-m32 LDFLAGS=-m32 to make (with some warnings), but the final binaries seem to fail to open a dmg that can be opened fine by the 64-bit build.

root@5e9f2b8bc94f:/build# ./hfsdump /src/tests/data/100MB.dmg
Volume name: Empty
Journaled? 1
Readonly? 1
Offset: 0
volume header:
signature: H+
version: 4
attributes: hwlock 0 unmounted 0 badblocks 0 nocache 0 dirty 0 cnids recycled 0 journaled 1 swlock 0
last_mounting_version: HFSJ
journal_info_block: 2
date_created: Mon Sep 17 11:00:53 2018
date_modified: Mon Sep 17 09:00:55 2018
date_backedup: Thu Jan  1 00:00:00 1970
date_checked: Mon Sep 17 09:00:53 2018
file_count: 3
folder_count: 3
block_size: 4096
total_blocks: 24414
free_blocks: 23711
next_alloc_block: 4501
rsrc_clump_size: 65536
data_clump_size: 65536
next_cnid: 22
write_count: 3
encodings: 1
finderinfo:
	Boot directory ID: 0
	Startup parent directory ID: 0
	Display directory ID: 0
	OS classic system directory ID: 0
	OS X system directory ID: 0
	Volume unique ID: 6ffde41b5034bf29

root@5e9f2b8bc94f:/build# ./hfsdump /src/tests/data/8GB.dmg
could not open device
Couldn't open volume

Any ideas? has this been tested?

cc -m32 -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -I /build/hfsfhuse/lib -c -o src/hfsfuse.o src/hfsfuse.c
src/hfsfuse.c: In function 'hfsfuse_open':
src/hfsfuse.c:68:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  info->fh = (uint64_t)f;
             ^
src/hfsfuse.c: In function 'hfsfuse_release':
src/hfsfuse.c:74:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  struct hf_file* f = (struct hf_file*)info->fh;
                      ^
src/hfsfuse.c: In function 'hfsfuse_read':
src/hfsfuse.c:82:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  struct hf_file* f = (struct hf_file*)info->fh;
                      ^
src/hfsfuse.c: In function 'hfsfuse_fgetattr':
src/hfsfuse.c:112:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  struct hf_file* f = (struct hf_file*)info->fh;
                      ^
src/hfsfuse.c: In function 'hfsfuse_opendir':
src/hfsfuse.c:151:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  info->fh = (uint64_t)d;
             ^
src/hfsfuse.c: In function 'hfsfuse_releasedir':
src/hfsfuse.c:156:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  struct hf_dir* d = (struct hf_dir*)info->fh;
                     ^
src/hfsfuse.c: In function 'hfsfuse_readdir':
src/hfsfuse.c:167:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  struct hf_dir* d = (struct hf_dir*)info->fh;
                     ^
src/hfsfuse.c: In function 'hfsfuse_readdir2':
src/hfsfuse.c:190:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  struct hf_dir* d = (struct hf_dir*)info->fh;
                     ^

"could not read catalogue header node" when opening a Time Machine Volume

Used hfsfuse for backing up a Time Machine backup to AWS.
Until recently, this was running fine in most cases with a buidl somewhere around Oct 2019. After having issues with accessing the "Latest" backup directory (recursive loop) I built the latest version, resulting in above error.

Setup:
TimeMachine --> NFS --> Raspbian --> sparsebundlefs --> losetup --> hfsfuse
Linux RASPI3 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux

parted on dmg created by sparsebundlefs shows proper Disk:
Number Start End Size File system Name Flags
1 20,5kB 210MB 210MB fat32 EFI System Partition boot, esp
2 210MB 2951GB 2951GB hfsx disk image

parted on loop device seems to find a proper file system:
Number Start End Size File system Flags
1 0,00B 2951GB 2951GB hfsx

hfsfuse call:
sudo hfsfuse "$LO" "$TM_MNT" --force -o ro,uid=$(id -u $USER),gid=$(id -g $USER),allow_other,rsrc_ext=.rsrc

hfsfuse throws "could not read catalogue header node"

Fails to compile under ubuntu 16.04

I cannot compile this on a vanilla ubuntu 16.04. I'm getting the following errors:

cc -O3 -std=gnu11 -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -DHAVE_UBLIO -DHAVE_UTF8PROC -Ilib/libhfs/ -Ilib/ublio -I/usr/include/fuse -c -o src/hfsfuse.o src/hfsfuse.c
cc -O3 -std=gnu11 -lfuse -lrt -ldl -o hfsfuse lib/libhfs/*.o lib/libhfs/libhfs.a lib/ublio/ublio.o lib/utf8proc/utf8proc.o src/hfslib.o src/hfsfuse.o -lpthread
src/hfshuse.o: In function hfsfuse_statfs:
hfsfuse.c:(.text+0x5): undefined reference to fuse_get_context

and also in main, undefined reference to fuse-_main_real

adding more libs and include paths didn't help, as you can see.

rc/hfsfuse.c:34:10: fatal error: 'version.h' file not found

Trying to install hfsfuse on Mac OS catalina 10.15.5 and I get the following results:

$ make config WITH_UBLIO=local WITH_UTF8PROC=local
echo CC=cc > config.mak
echo CONFIG_CFLAGS=-O3 -std=gnu11 >> config.mak
echo WITH_UBLIO=local >> config.mak
echo WITH_UTF8PROC=local >> config.mak
$ make
cc -Wall -Wextra -pedantic -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-parameter -Wno-missing-field-initializers -Wno-missing-braces -DFUSE_USE_VERSION=28 -D_FILE_OFFSET_BITS=64 -I/usr/local/include/osxfuse -I /Users/MyUsername/Downloads/hfsfuse-master/lib -O3 -std=gnu11 -c -o src/hfsfuse.o src/hfsfuse.c
src/hfsfuse.c:34:10: fatal error: 'version.h' file not found
#include "version.h"
^~~~~~~~~~~
1 error generated.
make: *** [src/hfsfuse.o] Error 1

Extended attributes of symlinks

Running getfattr --no-dereference -d -m '' -- file, where file is the symlink to test and it has no attributes, will output the following:

file: user.com.apple.FinderInfo: No such attribute
file: user.hfsfuse.record.date_created: No such attribute

I think the correct behavior should be no output. Symlinks are allowed to have extended attributes (I used xattr on macOS to test this), but this particular symlink doesn't have the above attributes. Maybe these attribute names are somehow built into hfsfuse as attribute names it checks for, like in hfsfuse_getxattr_offset. Looking at the code for getfattr, hfsfuse might be returning these attributes as built-in attribute names, but they return ENODATA when queried for an attribute value. lgetxattr, when called on user.com.apple.FinderInfo, returns ENODATA since there is no such attribute on the symlink anyway, but llistxattr is returning those two attributes extraneously.

Makefile appears to not be compatible with FreeBSD base make

freebsd-version

11.0-RELEASE-p7

make config

make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 10: Variable/Value missing from "export"
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 11: Variable/Value missing from "export"
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 16: Missing dependency operator
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 19: Missing dependency operator
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 20: warning: duplicate script for target "ifeq" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 18: warning: using previous script for "ifeq" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 20: warning: duplicate script for target "(,)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 18: warning: using previous script for "(,)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 21: warning: duplicate script for target "ifeq" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 18: warning: using previous script for "ifeq" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 21: warning: duplicate script for target "(,)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 18: warning: using previous script for "(,)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 22: Need an operator
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 31: Missing dependency operator
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 38: Need an operator
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 39: Missing dependency operator
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 40: warning: duplicate script for target "ifneq" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "ifneq" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 40: warning: duplicate script for target "(local,)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(local,)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 40: warning: duplicate script for target "(none)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(none)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 41: warning: duplicate script for target "ifneq" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "ifneq" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 41: warning: duplicate script for target "(local,)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(local,)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 41: warning: duplicate script for target "(none)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(none)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 42: warning: duplicate script for target "ifneq" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "ifneq" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 42: warning: duplicate script for target "(local,)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(local,)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 42: warning: duplicate script for target "(none)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(none)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 43: warning: duplicate script for target "ifneq" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "ifneq" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 43: warning: duplicate script for target "(local,)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(local,)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 43: warning: duplicate script for target "(none)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(none)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 44: warning: duplicate script for target "ifneq" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "ifneq" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 44: warning: duplicate script for target "(local,)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(local,)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 44: warning: duplicate script for target "(none)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(none)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 45: warning: duplicate script for target "ifneq" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "ifneq" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 45: warning: duplicate script for target "(local,)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(local,)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 45: warning: duplicate script for target "(none)" ignored
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 37: warning: using previous script for "(none)" defined here
make: "/usr/home/erikn/src/github.com/0x09/hfsfuse/Makefile" line 46: Need an operator
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/home/erikn/src/github.com/0x09/hfsfuse

gmake config

echo CC=cc > config.mak
echo CONFIG_CFLAGS=-O3 -std=gnu11  >> config.mak
echo WITH_UBLIO=local >> config.mak
echo WITH_UTF8PROC=local >> config.mak

/hfsfuse-master/lib/libhfsuser/features.h:5:10: fatal error: 'utf8proc.h' file not found

HI there,

I follow the commands here for my Macbook Pro 16, MacOS 11.3.1. First I did a brew update && brew upgrade. Then I downloaded the hfsfuse via the <> Code section, click Code > Download zip file > unpack it and then tried to install and get the following error message that a file is not found.

username@Macbook hfsfuse-master % sudo make config WITH_UBILIO=none WITH_UTF8PROC=system Makefile:103: Warning: git repo nor prepackaged version.h found, hfsfuse will be built without version information echo "$CONFIG" > config.mak username@Macbook hfsfuse-master % sudo make Makefile:103: Warning: git repo nor prepackaged version.h found, hfsfuse will be built without version information cc -Wall -Wextra -pedantic -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-parameter -Wno-missing-field-initializers -Wno-missing-braces -DFUSE_USE_VERSION=28 -I/usr/local/include -iquote /Users/username/Downloads/hfsfuse-master/lib/libhfsuser -iquote /Users/username/Downloads/hfsfuse-master/lib/libhfs -iquote /Users/username/Downloads/hfsfuse-master/lib/ublio -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11 -DHFSFUSE_VERSION_STRING=\"omitted\" -c -o src/hfsfuse.o src/hfsfuse.c /Library/Developer/CommandLineTools/usr/bin/make -C lib/libhfsuser/ cc -Wall -Wextra -pedantic -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-parameter -Wno-missing-field-initializers -Wno-missing-braces -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11 -DHFSFUSE_VERSION_STRING=\"omitted\" -iquote /Users/username/Downloads/hfsfuse-master/lib/libhfsuser -iquote /Users/username/Downloads/hfsfuse-master/lib/libhfs -iquote /Users/username/Downloads/hfsfuse-master/lib/ublio -I/usr/local/include -DHAVE_BIRTHTIME -DHAVE_UBLIO -DHAVE_UTF8PROC -c -o cache.o cache.c cc -Wall -Wextra -pedantic -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-parameter -Wno-missing-field-initializers -Wno-missing-braces -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11 -DHFSFUSE_VERSION_STRING=\"omitted\" -iquote /Users/username/Downloads/hfsfuse-master/lib/libhfsuser -iquote /Users/username/Downloads/hfsfuse-master/lib/libhfs -iquote /Users/username/Downloads/hfsfuse-master/lib/ublio -I/usr/local/include -DHAVE_BIRTHTIME -DHAVE_UBLIO -DHAVE_UTF8PROC -c -o features.o features.c In file included from features.c:25: /Users/username/Downloads/hfsfuse-master/lib/libhfsuser/features.h:5:10: fatal error: 'utf8proc.h' file not found #include "utf8proc.h" ^~~~~~~~~~~~ 1 error generated. make[1]: *** [features.o] Error 1 make: *** [lib/libhfsuser/libhfsuser.a] Error 2 username@Macbook hfsfuse-master %

Operation not permitted (EPERM) on some files

For some .DS_Store files and a zip file on an HFS+ drive I've been copying from, the read syscall fails with EPERM:

]$ sudo strace xxd /mnt/SeagateFireCuda/Downloads/.DS_Store
execve("/run/current-system/sw/bin/xxd", ["xxd", "/mnt/SeagateFireCuda/Downloads/."...], 0x7ffcea971df8 /* 27 vars */) = 0
brk(NULL)                               = 0x1f39000
access("/etc/ld-nix.so.preload", R_OK)  = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/glibc-hwcaps/x86-64-v3/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/glibc-hwcaps/x86-64-v3", 0x7fffc18d8570, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/glibc-hwcaps/x86-64-v2/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/glibc-hwcaps/x86-64-v2", 0x7fffc18d8570, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/tls/x86_64/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/tls/x86_64/x86_64", 0x7fffc18d8570, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/tls/x86_64", 0x7fffc18d8570, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/tls/x86_64", 0x7fffc18d8570, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/tls", 0x7fffc18d8570, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/x86_64/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/x86_64/x86_64", 0x7fffc18d8570, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/x86_64", 0x7fffc18d8570, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/x86_64", 0x7fffc18d8570, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/65hafbsx91127farbmyyv4r5ifgjdg43-glibc-2.33-117/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320x\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\200\0\300\4\0\0\0\1\0\0\0\0\0\0\0", 32, 848) = 32
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\232\17\220\304\277(;P\314\302\373R\250lL\236"..., 68, 880) = 68
newfstatat(3, "", {st_mode=S_IFREG|0555, st_size=2141272, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f293de9a000
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
mmap(NULL, 1917264, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f293dcc5000
mmap(0x7f293dceb000, 1384448, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7f293dceb000
mmap(0x7f293de3d000, 319488, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x178000) = 0x7f293de3d000
mmap(0x7f293de8b000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c5000) = 0x7f293de8b000
mmap(0x7f293de91000, 33104, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f293de91000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f293dcc3000
arch_prctl(ARCH_SET_FS, 0x7f293de9b5c0) = 0
mprotect(0x7f293de8b000, 12288, PROT_READ) = 0
mprotect(0x404000, 4096, PROT_READ)     = 0
mprotect(0x7f293decb000, 8192, PROT_READ) = 0
brk(NULL)                               = 0x1f39000
brk(0x1f5a000)                          = 0x1f5a000
openat(AT_FDCWD, "/mnt/SeagateFireCuda/Downloads/.DS_Store", O_RDONLY) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=8196, ...}, AT_EMPTY_PATH) = 0
read(3, 0x1f39480, 4096)                = -1 EPERM (Operation not permitted)
write(2, "xxd: ", 5xxd: )                    = 5
write(2, "Operation not permitted\n", 24Operation not permitted
) = 24
exit_group(2)                           = ?
+++ exited with 2 +++

This file is readable when using the hfsplus driver on Linux and has some binary content, so it seems to be an hfsfuse issue. Upon checking with hfsdump with sudo ./hfsdump /dev/sdf2 read /Downloads/.DS_Store, it returns exit code 255. I used gdb on it and found that hfslib_get_file_extents was returning 0, meaning there are no extents for the file but there should probably be extents?

How can this be debugged further?

Support for compressed files?

Hi,

A quick search of the repo didn't turn up any suggestions that hfsfuse currently supports accessing hfs-compressed files. Are there plans to add that?

Failure in ARM platform - solved.

Hi. Thank you for creating hfsfuse, it is really useful - but I wanted to share an issue I had and how I solved it, when I needed to compile the code under an ARM board (a Rock-PI-S running Armbian).

Using make led to this:

(master)$ make |& head
cc -Wall -Wextra -pedantic -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-parameter -Wno-missing-field-initializers -Wno-missing-braces -DFUSE_USE_VERSION=28 -I/home/ttsiod/GitHub/hfsfuse/lib/libhfsuser -I/home/ttsiod/GitHub/hfsfuse/lib/libhfs -I/home/ttsiod/GitHub/hfsfuse/lib/ublio -I/home/ttsiod/GitHub/hfsfuse/lib/utf8proc -D_FILE_OFFSET_BITS=64 -O3 -std=gnu11  -DHFSFUSE_VERSION_STRING=\"0.120-a089632\" -c -o src/hfsfuse.o src/hfsfuse.c
In file included from /home/ttsiod/GitHub/hfsfuse/lib/libhfsuser/hfsuser.h:29,
                 from src/hfsfuse.c:25:
/usr/include/aarch64-linux-gnu/sys/stat.h:99:14: error: expected ‘;’ before ‘struct’
 __BEGIN_DECLS
              ^
              ;

...which looked weird - why does this code work in other platforms?

Looking things up, I realised I had to #include "features.h" - so I did...

--- a/lib/libhfsuser/hfsuser.h
+++ b/lib/libhfsuser/hfsuser.h
@@ -25,6 +25,7 @@
 #ifndef HFSUSER_H
 #define HFSUSER_H

+#include <features.h>
 #include <sys/stat.h>

 #include "libhfs.h"

...only to find that the compilation still fails with the same error. After some more head-scratching, and adding "-save-temps" to see exactly what happens during preprocessing, I realized why this patch failed...

There's a "features.h" in our own code - that somehow takes precedence! (even though I used angle brackets - that should prioritize the system-provided header instead of the one under lib/libhfsuser/features.h )

So, as a quick hack, I changed the #include to ...

#include </usr/include/features.h>

...and after doing this patch in one more place, everything worked perfectly.

I am not sure how this can be addressed. I thought of preparing a PR where I rename this code's "features.h" to a filename that doesn't clash with mainstream OSes default header files, but realised you may very well object to this - so I instead opened this issue. For completeness, these are the two patches I had to make for the code to compile:

(master)$ git diff 
diff --git a/lib/libhfsuser/features.c b/lib/libhfsuser/features.c
index 53aabfb..03f55a7 100644
--- a/lib/libhfsuser/features.c
+++ b/lib/libhfsuser/features.c
@@ -22,6 +22,7 @@
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include "/usr/include/features.h"
 #include "features.h"
 #include "hfsuser.h"
 
diff --git a/lib/libhfsuser/hfsuser.h b/lib/libhfsuser/hfsuser.h
index 532c49c..a9b1f32 100644
--- a/lib/libhfsuser/hfsuser.h
+++ b/lib/libhfsuser/hfsuser.h
@@ -25,6 +25,7 @@
 #ifndef HFSUSER_H
 #define HFSUSER_H
 
+#include </usr/include/features.h>
 #include <sys/stat.h>
 
 #include "libhfs.h"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.