hasse69 / rar2fs

FUSE file system for reading RAR archives
https://hasse69.github.io/rar2fs/
GNU General Public License v3.0
279 stars 27 forks source link

Clean compile of rar2fs and dokan in Cygwin 64 bit/Windows 10 64 bit causes segmentation fault #82

Closed janosek closed 7 years ago

janosek commented 7 years ago

Hello,

This is more of a question than a defect, as you were able to get rar2fs to work with Dokan. I am trying it out now but after cleanly compiling, I get a segmentation fault even when running rar2fs -h Here are my steps:

  1. Download DOKAN installer here: https://github.com/dokan-dev/dokany/releases/download/v1.0.3/Dokan_x64.msi
  2. Install DOKAN
  3. Cd /
  4. git clone https://github.com/hasse69/rar2fs.git
  5. cd rar2fs
  6. wget http://www.rarlab.com/rar/unrarsrc-5.5.8.tar.gz
  7. tar -zxvf unrarsrc-5.5.8.tar.gz
  8. sed s/-fPIC//g -i unrar/makefile
  9. make -C unrar lib
  10. git clone https://github.com/dokan-dev/dokany.git
  11. cp /cygdrive/c/Program Files/Dokan/DokanLibrary-1.0.2/* /rar2fs/dokany/dokan_fuse/include
  12. autoreconf -fi
  13. ./configure --with-fuse=/rar2fs/dokany/dokan_fuse/include/ --with-fuse-lib=/rar2fs/dokany/dokan_fuse/include/
  14. make
  15. make install

I run: rar2fs -h

Exception: STATUS_ACCESS_VIOLATION at rip=7FFE7DF66A60 rax=0000000000000012 rbx=000000018030F7C0 rcx=0000000000000056 rdx=000000018030F7C0 rsi=0000000000000000 rdi=00000000FFFFC920 r8 =000000000000002D r9 =0000000100404C00 r10=000000010043A470 r11=00000000FFFFC910 r12=00000000FFFFCA80 r13=0000000100404C00 r14=0000000529653040 r15=0000000000000000 rbp=00000000FFFFC971 rsp=00000000FFFFC868 program=C:\cygwin\usr\local\bin\rar2fs.exe, pid 10960, thread main cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B Stack trace: Frame Function Args 000FFFFC971 7FFE7DF66A60 (00100404C00, 00000000000, 006000128AA, 00000000000) 000FFFFC971 7FFE7DF671D6 (00000000000, 00000000000, 00100404C00, 0018030F7C0) 000FFFFC971 7FFE7DF67625 (00100000000, 00000000000, 000FFFFCDF0, 00100000000) 000FFFFCA50 005296514DE (00000000000, 0010043A460, 00100404C00, 001801C26A0) 000FFFFCAA0 00100438BF2 (00000000020, 30001000000FF00, 001800477A1, 001800468D0) 000FFFFCCC0 00180047812 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 001800455E3 (00000000000, 00000000000, 00000000000, 00000000000) 000FFFFFFF0 00180045694 (00000000000, 00000000000, 00000000000, 00000000000) End of stack trace

How do I run this afterwards? Will the same command below still work? rar2fs --seek-length=1 -d -f /cygdrive/d/files/seed -o uid=-1,gid=-1 -o 'VolumePrefix=\Janosek-pc\x' X:

hasse69 commented 7 years ago

How do I run this afterwards? Will the same command below still work?

No, it will not work because the arguments supported by dokan is different to WinFSP.

hasse69 commented 7 years ago

I see a few caveats in your described procedure. Lets fix that first and then see what happens.

The first thing you need to do is to make sure there are no traces left of some other fuse package on your Cygwin file system (any files/folders containing fuse something in /usr/include and /usr/lib). WinFSP and Dokany fuse libraries can coexist, but rar2fs looks for one before the other so it is better to remove one of them completely. Also the header files will clash, same name but not the same contents. Again, they can coexist but then you should place them in separate folders like /usr/include/winfsp-fuse and /usr/include/dokan-fuse and then point configure to which ever you wish to compile against. Same can be done for the libraries but then you need to make sure sub-folders under /usr/lib are searched for by the run-time linker. Below are some updates to the procedure you applied above, everything assuming a clean Cygwin file system.

In step 8) you do not need to replace anything in the makefile. Instead edit the makefile and comment out the default Linux target and enable the provided Cygwin target instead (only available on later version of the unrarsrc package).

Skip step 10) and 11) , you do not really need to clone the Dokan repo unless you wish to build the entire package yourself. Instead download this https://github.com/dokan-dev/dokany/releases/download/v1.0.3/dokan.zip and open it up in your (un)archiver of choice. Then enter your specific target folder, like x64 and go into the Cygwin folder. Now everything in include should be extracted to /usr/include on your Cygwin file system. Everything in lib should be extracted to /usr/lib. The cygdokanfuse1.dll should be copied to /usr/bin, or some other location properly being pointed out by your PATH for executables. Now the last step is to rename (or copy) the library in /usr/lib named libdokanfuse.dll.a to libcygdokanfuse1.a. I just realized that either they changed the name of it or I did some mistake when adding support for this in configure.ac. I will fix this in an upcoming patch to look for the name as distributed by the Dokany project. But for now simply rename it or patch configure.ac yourself.

In step 13) (if everything is setup properly in the previous steps) you should only need to run ./configure, no more no less.

I did exactly what I describe above and rar2fs runs just fine. You can probably play with the options to dokan-fuse but in its simplest form this is what I did to mount to a drive letter (and -h works too :)

$ ./rar2fs.exe -f /cygdrive/x Y:
janosek commented 7 years ago

I deleted my previous comment, since I solved the problem (permission issue). Here are the steps.

  1. Download DOKAN installer here: https://github.com/dokan-dev/dokany/releases/download/v1.0.3/DokanSetup.exe
  2. Install DOKAN In Cygwin terminal:
  3. Cd /
  4. git clone https://github.com/hasse69/rar2fs.git
  5. cd rar2fs
  6. wget http://www.rarlab.com/rar/unrarsrc-5.5.8.tar.gz
  7. tar -zxvf unrarsrc-5.5.8.tar.gz
  8. sed s/-fPIC//g -i unrar/makefile
  9. make -C unrar lib
  10. wget https://github.com/dokan-dev/dokany/releases/download/v1.0.3/dokan.zip
  11. unzip dokan.zip
  12. chmod -R 777 x64
  13. cp /rar2fs/x64/Cygwin/cygdokanfuse1.dll /usr/bin
  14. cp -R /rar2fs/x64/Cygwin/lib/* /usr/lib
  15. cp -R /rar2fs/x64/Cygwin/include/* /usr/include

[No longer necessary after commit 38628b2] 16. mv /usr/lib/libdokanfuse1.dll.a /usr/lib/libcygdokanfuse1.a

  1. autoreconf -fi
  2. ./configure
  3. make
  4. make install

Example usage: rar2fs.exe -f /cygdrive/d/files/seed X: -o umask=777 -o volname=RAR2FS_DRIVE -o uncname=\PC\x

janosek commented 7 years ago

Serviio is indexing. So far so good. Let me know if you have any more git patches you want me to try.

hasse69 commented 7 years ago

Please report back in issue #81 since it is easier to track. I will close this one.

eskimos20 commented 7 years ago

I´ve tried this install and got it to work, however I think Dokan is a bit unstable and the mounted rar2fs share was unmounted from time to time, usually after a couple of hours or a day at tops.

I am also running rar2fs on a Linux Mint virtual machine and in that enviroment it works great.

Is there a simple 1,2,3,4... guide like the one above for WINFSP, Cygwin and rar2fs ?

/Eskimos20

hasse69 commented 7 years ago

If you follow this thread (be aware it is a lot) https://github.com/hasse69/rar2fs/issues/75 I think you have what you need. The process of installing Cygwin and rar2fs is the same, it is the back-end that is different only. I will lock this thread now and if you have further questions or issues please file a new issue report.

Btw, you should probably try to dig down a bit to exactly why Dokan seems to fail for you, Is it rar2fs that is crashing or is it simply unmounted? Otherwise there is not much I can do about this.