Fedora Account System
Red Hat Associate
Red Hat Customer
Created attachment 637242 [details] Candidate patch to fix the problem Description of problem: I'm attempting to package JHotDraw, which produces jars with names such as "JHotDraw Draw.jar", "JHotDraw Teddy.jar", and "JHotDraw SVG.jar". The output from rpmbuild shows that brp-java-repack-jars is not handling the spaces well: + /usr/lib/rpm/redhat/brp-java-repack-jars unzip: cannot find or open /home/jamesjer/rpmbuild/BUILDROOT/jhotdraw-7.6-1.fc17.x86_64/usr/share/java/JHotDraw, /home/jamesjer/rpmbuild/BUILDROOT/jhotdraw-7.6-1.fc17.x86_64/usr/share/java/JHotDraw.zip or /home/jamesjer/rpmbuild/BUILDROOT/jhotdraw-7.6-1.fc17.x86_64/usr/share/java/JHotDraw.ZIP. unzip: cannot find or open Draw.jar, Draw.jar.zip or Draw.jar.ZIP. [/home/jamesjer/rpmbuild/BUILDROOT/jhotdraw-7.6-1.fc17.x86_64/usr/share/java/JHotDraw] End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. unzip: cannot find zipfile directory in one of /home/jamesjer/rpmbuild/BUILDROOT/jhotdraw-7.6-1.fc17.x86_64/usr/share/java/JHotDraw or /home/jamesjer/rpmbuild/BUILDROOT/jhotdraw-7.6-1.fc17.x86_64/usr/share/java/JHotDraw.zip, and cannot find /home/jamesjer/rpmbuild/BUILDROOT/jhotdraw-7.6-1.fc17.x86_64/usr/share/java/JHotDraw.ZIP, period. unzip: cannot find or open Teddy.jar, Teddy.jar.zip or Teddy.jar.ZIP. [/home/jamesjer/rpmbuild/BUILDROOT/jhotdraw-7.6-1.fc17.x86_64/usr/share/java/JHotDraw] End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. The RPM is still produced successfully, even though the JARs are not repacked. Version-Release number of selected component (if applicable): redhat-rpm-config-9.1.0-28.fc17.noarch How reproducible: Always Steps to Reproduce: 1. Build a Java package that produces a JAR with a space in its name 2. 3. Actual results: brp-java-repack-jars breaks the name at the space and tries to repack the two parts, neither of which is a valid filename. Expected results: brp-java-repack-jars should quote its arguments sufficiently to avoid this problem Additional info: I have attached a patch that shows one way in which the problem could be addressed. It makes the script be bash-specific, but given its limited field of use (RPM builds), I don't think that is really a problem.
Created attachment 641786 [details] Alternate fix that avoids bash-specifics I've not concentrated on honing my shell scripting skills in many, many years so I could be missing something but I think I got this right. Would this patch work and avoid bash specifics? Caveats: * It only fixes embedded spaces. Your patch handles newlines and tabs as well. Is this a problem, though? * Untested -- I figure you have an srpm to try it out on and I'd have to create one from scratch :-) Notes: * This patch also double quotes one instance of $j that wasn't caught in yours. * This patch applies on top of the current patchset in the srpm (which has added one patch to brp-java-repack-jars recently).
(In reply to comment #1) > I've not concentrated on honing my shell scripting skills in many, many > years so I could be missing something but I think I got this right. Would > this patch work and avoid bash specifics? Yes, this is great. I tried playing with IFS first and couldn't figure out how to get the right characters into it. Using printf never occurred to me. I like it. > Caveats: > * It only fixes embedded spaces. Your patch handles newlines and tabs as > well. Is this a problem, though? If we ever encounter a filename with embedded newlines or tabs, let's just shoot the developer who thought that was a good idea. > * Untested -- I figure you have an srpm to try it out on and I'd have to > create one from scratch :-) Yes, and your patch worked well. Consider it tested.
redhat-rpm-config-9.1.0-37.fc18 has been submitted as an update for Fedora 18. https://admin.fedoraproject.org/updates/redhat-rpm-config-9.1.0-37.fc18
Package redhat-rpm-config-9.1.0-37.fc18: * should fix your issue, * was pushed to the Fedora 18 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing redhat-rpm-config-9.1.0-37.fc18' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2012-17945/redhat-rpm-config-9.1.0-37.fc18 then log in and leave karma (feedback).
redhat-rpm-config-9.1.0-37.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report.