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
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira ( If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1310704 - %autosetup -pN parsing doesn't terminate at EOL
Summary: %autosetup -pN parsing doesn't terminate at EOL
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rpm
Version: 6.7
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Packaging Maintenance Team
QA Contact: BaseOS QE Security Team
Depends On:
Blocks: 1355985 1373252
TreeView+ depends on / blocked
Reported: 2016-02-22 14:45 UTC by Karel Srot
Modified: 2018-08-30 08:48 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1045723
Last Closed: 2017-10-10 14:01:55 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Karel Srot 2016-02-22 14:45:13 UTC
This is present in RHEL-6 too.
In RHEL-7 it has been fixes as bug 1225118

+++ This bug was initially created as a clone of Bug #1045723 +++

%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.

--- Additional comment from Panu Matilainen on 2013-12-27 06:51:34 EST ---

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)

--- Additional comment from Ville Skyttä on 2013-12-27 12:13:35 EST ---

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.

--- Additional comment from Panu Matilainen on 2014-01-02 08:41:13 EST ---

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.

--- Additional comment from Panu Matilainen on 2014-02-19 07:31:35 EST ---

Fixed upstream now:;a=commitdiff;h=1bdcd0500865efd3566efd7f951228f69b58e755

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

--- Additional comment from Panu Matilainen on 2014-03-26 07:11:53 EDT ---

FYI, this just went into rawhide as of rpm-4.11.2-3, lets see what (if anything) happens...

--- Additional comment from Mikolaj Izdebski on 2014-03-27 03:57:04 EDT ---

(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.


--- Additional comment from Panu Matilainen on 2014-03-27 05:48:17 EDT ---

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.

--- Additional comment from Hedayat Vatankhah on 2014-06-12 09:23:50 EDT ---

I also faced this bug when trying to use %autosetup -S git. :P

--- Additional comment from Panu Matilainen on 2014-08-19 05:29:55 EDT ---

FWIW this should be now fixed in F21 + rawhide, in a way that doesn't break the Java macros.

--- Additional comment from Fedora End Of Life on 2015-01-09 17:23:05 EST ---

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.

--- Additional comment from Jaroslav Reznik on 2015-03-03 11:57:43 EST ---

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:

Comment 1 Karel Srot 2016-02-22 14:52:24 UTC
As no one was complaining about this bug before and making the fix now would put some builds in risk of breakage I am postponing it for 6.9 for now.

Comment 2 Orion Poplawski 2016-11-16 20:56:38 UTC
%autosetup -p appears to be completely broken in EL6 - patches are not applied and I get:

$ fedpkg local
Could not execute local: Could not get n-v-r-e from '\n\n/bin/cat /home/orion/fedora/python3-pycurl/python3-pycurl-py3.patch | \n/usr/bin/patch -p1 -s\npython3-pycurl (none) 7.43.0 5.el6'

Comment 3 Florian Festi 2017-10-10 14:01:51 UTC
Proposing for closing.

Comment 4 Red Hat Bugzilla Rules Engine 2017-10-10 14:01:55 UTC
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.

Comment 5 Pavel Raiskup 2018-08-30 08:48:57 UTC

  %autosetup -p1 -n %{pypi_name}-%{version}
  # Remove bundled egg-info
  rm -rf %{pypi_name}.egg-info

I've got something like this:

  + /bin/cat /builddir/build/SOURCES/0002-make-the-progress-bar-more-stable.patch
  + /usr/bin/patch -p1 -s# Remove bundled egg-in

So %autosetup seems to work at the time of writing this comment in epel-6,
but as a workaround one has to add additional new-line after %autosetup:

  %autosetup -p1 -n %{pypi_name}-%{version}
  # Remove bundled egg-info
  rm -rf %{pypi_name}.egg-info

Note You need to log in before you can comment on or make changes to this bug.