Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Aug 2013 20:28:11 +0200
From:      Matthias Andree <mandree@FreeBSD.org>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        Clement Laforet <clement@FreeBSD.org>, "George V. Neville-Neil" <gnn@FreeBSD.org>, portmgr@FreeBSD.org
Subject:   ports/181271: [PATCH] let bsd.port.mk's makepatch support spaces in filenames
Message-ID:  <E1V9JKF-000Bkh-LQ@apollo.emma.line.org>
Resent-Message-ID: <201308131830.r7DIU0Ov077008@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         181271
>Category:       ports
>Synopsis:       [PATCH] let bsd.port.mk's makepatch support spaces in filenames
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 13 18:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Matthias Andree
>Release:        FreeBSD 9.1-RELEASE-p5 amd64
>Organization:
>Environment:
System: FreeBSD apollo.emma.line.org 9.1-RELEASE-p5 FreeBSD 9.1-RELEASE-p5 #0: Sat Jul 27 01:14:23 UTC 2013 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64


	
>Description:
GNN discovered that "make makepatch" fails when encountering file or
path names with spaces in them (for instance, ".../Eclipse UI/...").
See http://pastebin.com/BWfC3XNF - we see that the path names get
broken into two where the blank is.

| /usr/bin/diff -ud ./build/eclipse-4.2.0-I20120608-1400-src/plugins/org.eclipse.ui.workbench/Eclipse ./build/eclipse-4.2.0-I20120608-1400-src/plugins/org.eclipse.ui.workbench/Eclipse > /usr/home/gnn/svn/head-ports/java/eclipse-devel/files/patch-build__eclipse-4.2.0-I20120608-1400-src__plugins__org.eclipse.ui.workbench__Eclipse
| /usr/bin/diff: ./build/eclipse-4.2.0-I20120608-1400-src/plugins/org.eclipse.ui.workbench/Eclipse: No such file or directory
| /usr/bin/diff: ./build/eclipse-4.2.0-I20120608-1400-src/plugins/org.eclipse.ui.workbench/Eclipse: No such file or directory
| /usr/bin/diff -ud UI/org/eclipse/ui/internal/keys/model/BindingModel.java.orig UI/org/eclipse/ui/internal/keys/model/BindingModel.java > /usr/home/gnn/svn/head-ports/java/eclipse-devel/filesUI__org__eclipse__ui__internal__keys__model__BindingModel.java
| /usr/bin/diff: UI/org/eclipse/ui/internal/keys/model/BindingModel.java.orig: No such file or directory
| /usr/bin/diff: UI/org/eclipse/ui/internal/keys/model/BindingModel.java: No such file or directory

The patch enclosed below proofs "make makepatch" against spaces in
filenames, by properly quoting shell variables, stripping space from the
shell's $IFS special variable, and escaping blanks to double underscores
in patch file names.

GNN has tested this, it appears to be working for eclipse 4.2.

Clement copied as last committer of the affected code so he can learn
from our pain :-)

Please either commit or approve of my committing the patch.

A copy of the patch is available at
http://people.freebsd.org/~mandree/b.p.m.makepatch-v2.patch

To be applied in ports' head/Mk directory.

	
>How-To-Repeat:
	
>Fix:
Index: bsd.port.mk
===================================================================
--- bsd.port.mk	(Revision 324676)
+++ bsd.port.mk	(Arbeitskopie)
@@ -1134,15 +1134,16 @@
 .if !target(makepatch)
 makepatch:
 	@${MKDIR} ${FILESDIR}
-	@(cd ${PATCH_WRKSRC}; \
+	@(cd ${PATCH_WRKSRC} && \
+		IFS="`printf '\n\t'`" && \
 		for i in `find . -type f -name '*.orig'`; do \
-			ORG=$$i; \
-			NEW=$${i%.orig}; \
-			OUT=${FILESDIR}`${ECHO} $${NEW} | \
-				${SED} -e 's|/|__|g' \
-					-e 's|^\.__|/patch-|'`; \
-			${ECHO} ${DIFF} -ud $${ORG} $${NEW} '>' $${OUT}; \
-			${DIFF} -ud $${ORG} $${NEW} > $${OUT} || ${TRUE}; \
+			ORG="$$i"; \
+			NEW="$${i%.orig}"; \
+			OUT="${FILESDIR}`${ECHO} $${NEW} | \
+				${SED} -e 's|[/ ]|__|g' \
+					-e 's|^\.__|/patch-|'`"; \
+			${ECHO} ${DIFF} -ud "$${ORG}" "$${NEW}" '>' "$${OUT}"; \
+			${DIFF} -ud "$${ORG}" "$${NEW}" > "$${OUT}" || ${TRUE}; \
 		done \
 	)
 .endif
===================================================================
	


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1V9JKF-000Bkh-LQ>