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 bugzilla.redhat.com.
Bug 1045723 - %autosetup -pN parsing doesn't terminate at EOL
Summary: %autosetup -pN parsing doesn't terminate at EOL
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
Panu Matilainen
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-21 14:08 UTC by Ville Skyttä
Modified: 2015-03-27 14:50 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1310704 (view as bug list)
Environment:
Last Closed: 2015-03-27 14:50:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Reproducer srpm (2.01 KB, application/octet-stream)
2013-12-21 14:08 UTC, Ville Skyttä
no flags Details

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: http://rpm.org/gitweb?p=rpm.git;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_editor.py 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.

[1] https://github.com/mizdebsk/javapackages/blob/master/macros.d/macros.fjava#L197-L198
[2] http://pkgs.fedoraproject.org/cgit/maven-doxia.git/tree/maven-doxia.spec#n272

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:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22


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