Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at

Bug 1045723

Summary: %autosetup -pN parsing doesn't terminate at EOL
Product: [Fedora] Fedora Reporter: Ville Skyttä <ville.skytta>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact: Panu Matilainen <pmatilai>
Priority: unspecified    
Version: 22CC: ffesti, hedayatv, jzeleny, mizdebsk, msrb, novyjindrich, packaging-team-maint, pmatilai, rvokal
Target Milestone: ---Keywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1310704 (view as bug list) Environment:
Last Closed: 2015-03-27 14:50:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
Reproducer srpm none

Description Ville Skyttä 2013-12-21 14:08:37 UTC
Created attachment 840028 [details]
Reproducer srpm

%autosetup -pN parsing doesn't terminate at EOL but continues to read the next line. For example this and foo.patch:

    %autosetup -p1
    echo hello

...results in this rpmbuild error:

    + /usr/bin/cat [...]/foo.patch
    + /usr/bin/patch -p1 -secho hello
    /usr/bin/patch: invalid option -- 'h'

Reproducer srpm attached.

Comment 1 Panu Matilainen 2013-12-27 11:51:34 UTC
Right, this looks like an off-by-one'ish thing with parametrized macros. The effect is reproducable with just this:

%define foo(x) echo "FOO"

%foo -x
echo hello

If %foo is "called" with -x, "hello" ends up on the same line, otherwise it goes on a line of its own. I'll have a closer look when back at work next week, but the behavior seems to be ages old (present in rpm 4.4.x too)

Comment 2 Ville Skyttä 2013-12-27 17:13:35 UTC
IIRC I've always ended parametrized macro definitions with %{nil}, don't remember exactly why but I suppose it could have been in order to avoid this very issue.

Comment 3 Panu Matilainen 2014-01-02 13:41:13 UTC
Yeah, %{nil} at end avoids the issue, and given all the quirks in macro processing people just tend to use whatever gets the job done, whether the whatever makes sense or not.

For added fun, merely adding a trailing space is enough to trigger this "behavior" too, ie '%foo ' will also cause the newline to be silently eaten away. I've a preliminary fix for it, the remaining question is whether there are people actually relying on that longstanding quirk.

Comment 4 Panu Matilainen 2014-02-19 12:31:35 UTC
Fixed upstream now:;a=commitdiff;h=1bdcd0500865efd3566efd7f951228f69b58e755

I guess I'd better stick that into rawhide rpm and see what blows up :)

Comment 5 Panu Matilainen 2014-03-26 11:11:53 UTC
FYI, this just went into rawhide as of rpm-4.11.2-3, lets see what (if anything) happens...

Comment 6 Mikolaj Izdebski 2014-03-27 07:57:04 UTC
(In reply to Panu Matilainen from comment #5)
> FYI, this just went into rawhide as of rpm-4.11.2-3, lets see what (if
> anything) happens...

This change breaks many macros used by Java packages

Macro definition (see also [1]):

%pom_xpath_inject()   %{expand: %{__pom_call}xpath_inject   %*

Macro call (see also [2]):

# use java 5 generics in modello plugin
%pom_xpath_inject "pom:plugin[pom:artifactId[text()='modello-maven-plugin']]"\
"/pom:executions/pom:execution/pom:configuration" \
"<useJava5>true</useJava5>" doxia-modules/doxia-module-fml/pom.xml

macro expansion diff between rpm 4.11.2-2 and 4.11.2-3:

--- old	2014-03-27 08:49:54.262248366 +0100
+++ new	2014-03-27 08:40:54.969246312 +0100
@@ -1,4 +1,5 @@
 # use java 5 generics in modello plugin
  python /usr/share/java-utils/ pom_xpath_inject   "pom:plugin[pom:artifactId[text()='modello-maven-plugin']]"\
 "/pom:executions/pom:execution/pom:configuration" \
 "<useJava5>true</useJava5>" doxia-modules/doxia-module-fml/pom.xml

There's new line added which breaks the code.


Comment 7 Panu Matilainen 2014-03-27 09:48:17 UTC
So, that'd be ... a macro argument with a literal line-continuation in it, or something like that. Eep.

I've reverted the change while I scratch my with this.

Comment 8 Hedayat Vatankhah 2014-06-12 13:23:50 UTC
I also faced this bug when trying to use %autosetup -S git. :P

Comment 9 Panu Matilainen 2014-08-19 09:29:55 UTC
FWIW this should be now fixed in F21 + rawhide, in a way that doesn't break the Java macros.

Comment 10 Fedora End Of Life 2015-01-09 22:23:05 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 Jaroslav Reznik 2015-03-03 16:57:43 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here: