0x09 / hfsfuse

FUSE driver for HFS+ filesystems
Other
77 stars 13 forks source link

Garbled, varying text after symlink destinations #30

Closed sbond75 closed 4 months ago

sbond75 commented 4 months ago

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?

sbond75 commented 4 months ago

Also I am on the latest commit, 295e58a

0x09 commented 4 months ago

Hi, thanks a lot for opening this. I pushed a fix to master just now at https://github.com/0x09/hfsfuse/commit/529cb8b37f6305cc3719822aba687b59c27df822 which resolves it. I'll publish a release with this shortly. Let me know if you try this out and run into any issues.

edit: release with these changes added at https://github.com/0x09/hfsfuse/releases/tag/0.214

sbond75 commented 4 months ago

Nice, that fixed it. I have another slight issue which I think I will make a new issue for.