hasse69 / rar2fs

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

Cannot build `rar2fs` with `unrar` 7.0.7 #186

Closed fdegros closed 3 months ago

fdegros commented 5 months ago

It looks like the field FileHeader::RedirName has changed its type from wchar_t* to std::wstring, which prevents the compilation of rar2fs with unrar 7.0.7:

See https://bugs.gentoo.org/931078

dllext.cpp: In function ‘int RARListArchiveEx(void*, RARArchiveDataEx**)’:
dllext.cpp:174:46: error: cannot convert ‘std::wstring’ {aka ‘std::__cxx11::basic_string<wchar_t>’} to ‘const wchar_t*’
  174 |           wcscpy(N->LinkTargetW,Arc.FileHead.RedirName);
      |                                 ~~~~~~~~~~~~~^~~~~~~~~
      |                                              |
      |                                              std::wstring {aka std::__cxx11::basic_string<wchar_t>}

The constant NM seems to have been removed as well:

See https://bugs.gentoo.org/930341

dllext.cpp: In function void RARNextVolumeName(char*, bool):
dllext.cpp:214:18: error: NM was not declared in this scope
  214 |   wchar NextName[NM];
      |                  ^~
hasse69 commented 5 months ago

Thanks for the issue report. Is it possible for you to make a patch for this as I am currently not able to look into this build problem.

correabuscar commented 4 months ago

so, is anyone working on a patch for this? trying to avoid the possibility of duplicating work here

**EDIT:** hmmm, this seems to require quite some consideration to get right, and beforehand knowledge of string formats and how to c++. And some `#if RARVER_MAJOR < 7` to keep the previous behavior... But I'm kinda curious how it looks like if i halfass it(like redefining `NM`) - ok, it can't be halfassed. I don't know enough c++ to be confident I won't mess it up. I see for example `char FileNameUtf[NM]` (in `rar2fs-1.29.6/src/dllext.cpp`) and I wonder if it shouldn't have been `char FileNameUtf[NM*4]` all along, for the worst case scenario, and this is before even attempting to make it work for the >=7 version. And maybe some size checks about `MAXPATHSIZE` ...

I leave this to the pros.

hasse69 commented 4 months ago

Looking at the UnRAR source code usually provides enough details to complete the small extension(s) in rar2fs. The extensions are simply variants of already existing functions.