Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 803395

Summary: app-crypt/hashcat compilation fails with zlib-ng
Product: Gentoo Linux Reporter: Bogdan <bogdan.pylypenko107>
Component: Current packagesAssignee: Rick Farina (Zero_Chaos) <zerochaos>
Status: UNCONFIRMED ---    
Severity: normal CC: ionen, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=792720
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch for app-crypt/hashcat-6.2.1-r1.ebuild.patch to improve system-zlib use flag
Improve system-zlib use flag
Ebuild for sys-libs/minizip-ng-3.0.2.ebuild
Ebuild for sys-libs/minizip-ng-3.0.2.ebuild
Patch for hashcat-6.2.1-r1, which improve system-zlib and system-unzip use flags
hashcat-6.2.1-r1.ebuild.patch

Description Bogdan 2021-07-22 16:22:18 UTC
I change zlib to zlib-ng.
In this case hashcat compilation fails with an error "minizip/ioapi.h: File not found".

Reproducible: Always

Steps to Reproduce:
1. Install zlib-ng:
  USE="-compat" emerge sys-apps/zlib-ng
  emerge -C sys-apps/zlib
  USE="compat" emerge -1 sys-apps/zlib-ng
  echo "*sys-apps/zlib-ng" >> /etc/portage/profile/packages
  echo "sys-libs/zlib-1.2.11-r4" >> /etc/portage/profile/package.provided
2. Recompile hashcat:
  emerge -1 hascat
Actual Results:  
Got an errors like:
  include/ext_lzma.h:12:10: Fatal error: minizip/ioapi.h: File not found


Problem in hardcoded variable "USE_SYSTEM_ZLIB=0" at "src_compile" stage.
Comment 1 Ionen Wolkens gentoo-dev 2021-07-22 16:28:58 UTC
zlib-ng doesn't have minizip support, so it's not a drop-in replacement for anything needing zlib[minizip]

there's minizip-ng (not in tree) but it was kind of messy last time I looked at it
Comment 2 Ionen Wolkens gentoo-dev 2021-07-22 16:32:26 UTC
Either way, since you're essentially using package.provided to remove the minizip dep that hashcat is requesting, I can't really consider this a bug.
Comment 3 Bogdan 2021-07-22 16:33:36 UTC
Created attachment 725878 [details, diff]
Patch for app-crypt/hashcat-6.2.1-r1.ebuild.patch to improve system-zlib use flag

system-zlib use flag needs to compile hashcat with sys-libs/zlib-ng.

Normally, zlib[minizip] library hardcoded in hashcat. And hashcat can not be compiled. if system-wide library zlib changed to zlib-ng.
Comment 4 Bogdan 2021-07-22 16:35:32 UTC
minizip use flag is hardcoded in hashcat ebuild.
Switching it off in zlib package does not resolve problem.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-07-22 16:47:56 UTC
I’m not convinced that’s a fix. The real “fix” is we package the ng version of minizip.
Comment 6 Bogdan 2021-07-22 16:48:43 UTC
Created attachment 725881 [details, diff]
Improve system-zlib use flag

Patch improve system-zlib use flag, which allow to compile hashcat with zlib-ng.

Hashcat hardcoded with minizip feature from zlib library (https://github.com/hashcat/hashcat/issues/2895).

Hashcat always compiled with system-wide zlib library, as configured in ebuild in USE_SYSTEM_ZLIB=1 variable at src_compile stage.

If zlib changed to zlib-ng, than hashcat compilation fails without minizip features, which not supported in zlib-ng. But hashcat may be compiled with inbound zlib library, which support minizip features. "system-zlib" use flag allow to control this behaviour.
Comment 7 Bogdan 2021-07-22 16:53:13 UTC
> I’m not convinced that’s a fix. The real “fix” is we package the ng version of minizip.

minizip-ng has no "ioapi.h" file and can not be replacement for zlib[minizip] in easy way.

But "system-zlib" use flag - is easy way to allow hashcat compilation with both sys-libs/zlib and sys-libs/zlib-ng.
Comment 8 Ionen Wolkens gentoo-dev 2021-07-22 17:09:14 UTC
Then an option could be to have zlib provide only minizip and be made to coexist with zlib-ng.

There are a lot of packages that need minizip, and making them use bundled deps is going backward with this, hashcat shouldn't do this.
Comment 9 Bogdan 2021-07-22 17:24:02 UTC
Created attachment 725884 [details]
Ebuild for sys-libs/minizip-ng-3.0.2.ebuild
Comment 10 Bogdan 2021-07-22 17:51:25 UTC
> There are a lot of packages that need minizip

At thist time, no minizip neither minizip-ng package even not exists in portage.
But zlib-ng is package for real usage.

So, I need to choise something one: use zlib-ng or use hashcat.

I want to use all: zlib-ng and hashcat.
And I need to use them now - not in the future, when minizip/minizip-ng appears in portage and hashcat can be compiled with them in combination with zlib-ng.

Use zlib-ng as system-wide zlib library, and hashcat with inbound copliled zlib[minizip] library - is way for me at now.

I agree, that separate minizip/minizip-ng library - is more efficiency way to resolve such source code conflicts. But in some case usage zlib-ng as system wide library and zlib[minizip] compiled into an application - is a feature. And hardcoded USE_SYSTEM_ZLIB=0 disable this feature.

If you have an alternative solution to compile hashcat simulteniously with system-wide zlib-ng library - please, give me it.
Comment 11 Bogdan 2021-07-22 17:53:23 UTC
* Chage: And hardcoded USE_SYSTEM_ZLIB=1 disable this feature.
Comment 12 Bogdan 2021-07-22 17:55:47 UTC
Created attachment 725887 [details]
Ebuild for sys-libs/minizip-ng-3.0.2.ebuild
Comment 13 Bogdan 2021-07-23 04:19:02 UTC
Created attachment 725950 [details, diff]
Patch for hashcat-6.2.1-r1, which improve system-zlib and system-unzip use flags
Comment 14 Bogdan 2021-07-26 03:58:40 UTC
Created attachment 727026 [details, diff]
hashcat-6.2.1-r1.ebuild.patch

Improve "system-zlib" use flag.

hashcat can't be compiled with zlib-ng library.
This flag allow do use zlib library from hashcat source code in systems, which use sys-libs/zlib-ng, instead of sys-libs/zlib.

Please, update ebuild in portage.
Comment 15 Bogdan 2021-08-09 13:48:24 UTC
New minizip-ng library does not contains ioapi interface, which used in hashcat code.
Details at https://github.com/zlib-ng/minizip-ng/issues/447

Installed minizip-ng package can not help to resolve bug.
At now, the single way to compile hashcat with system-wide zlib-ng library - by using local zlib library.

So, untill authors of hascat code do not implement supporting of zlib-ng/minizip-ng libraries, then system-zlib use flag must be realized in hashcat ebuild.