debiansoftware-packaging

dh_md5sums: Argument list too long


I am using debuild to build my debian packages. When building one of them (which contains quite a lot of php files), I get the following error:

   dh_installdocs
   dh_installchangelogs
   dh_perl
   dh_link
   dh_compress
   dh_fixperms
   dh_installdeb
   dh_gencontrol
dpkg-gencontrol: warning: package amazing-php: unused substitution variable ${perl:Depends}
   dh_md5sums
Can't exec "/bin/sh": Argument list too long at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 241.
dh_md5sums: (cd debian/amazing-php >/dev/null ; find . -type f ! -path "./etc/apache2/sites-available/amazing-php.conf" ! -path "./etc/amazing-php/extensions/Arrays/arrayLoopsInteractionParserTests.txt" ! < A LONG LIST OF FILES >

When looking at the file using vi /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm +241 you can find

system(join(" ", @_)) == 0

which launches a subshell with a list of files (which is too long). This seems like a bug to me?

Is there a workaround or something?


Solution

  • Edit: So apparently this was a bug in the debhelper package until (excluding) 11.4. So in anything >=11.4 this should no longer be an issue.

    Thanks @axel-beckert for mentioning it.


    I fixed it by adding dh_override_md5sums to our debian/rules file:

    #!/usr/bin/make -f
    
    # Empty target: https://www.gnu.org/software/make/manual/html_node/Empty-Recipes.html
    override_dh_md5sums: ;
    
    %:
        dh $@