[csw-devel] SF.net SVN: gar:[17638] csw/mgar/pkg/git/trunk/files/ 0009-Avoid-bug-in-Solaris-xpg4-sed-as-used-in-submodule.patch
bdwalton at users.sourceforge.net
bdwalton at users.sourceforge.net
Tue Apr 10 02:31:26 CEST 2012
Revision: 17638
http://gar.svn.sourceforge.net/gar/?rev=17638&view=rev
Author: bdwalton
Date: 2012-04-10 00:31:26 +0000 (Tue, 10 Apr 2012)
Log Message:
-----------
git/trunk: update sed workaround patch
Modified Paths:
--------------
csw/mgar/pkg/git/trunk/files/0009-Avoid-bug-in-Solaris-xpg4-sed-as-used-in-submodule.patch
Modified: csw/mgar/pkg/git/trunk/files/0009-Avoid-bug-in-Solaris-xpg4-sed-as-used-in-submodule.patch
===================================================================
--- csw/mgar/pkg/git/trunk/files/0009-Avoid-bug-in-Solaris-xpg4-sed-as-used-in-submodule.patch 2012-04-09 21:31:48 UTC (rev 17637)
+++ csw/mgar/pkg/git/trunk/files/0009-Avoid-bug-in-Solaris-xpg4-sed-as-used-in-submodule.patch 2012-04-10 00:31:26 UTC (rev 17638)
@@ -1,6 +1,6 @@
-From 097f067a25220fc3cc315163dfef07de6a1c5f20 Mon Sep 17 00:00:00 2001
+From 3be2e5008274f5710b61d2ac4efc35eeab014ac6 Mon Sep 17 00:00:00 2001
From: Ben Walton <bwalton at opencsw.org>
-Date: Mon, 9 Apr 2012 03:14:18 +0200
+Date: Tue, 10 Apr 2012 01:47:04 +0200
Subject: [PATCH] Avoid bug in Solaris xpg4/sed as used in submodule
The sed provided by Solaris in /usr/xpg4/bin has a bug whereby an
@@ -10,7 +10,7 @@
This is evidenced by:
$ for sed in /usr/xpg4/bin/sed /usr/bin/sed /opt/csw/gnu/sed; do \
-echo 'ab' | $sed -e 's|[a]*|X|g' \
+echo 'ab' | $sed -e 's|[a]*|X|g'; \
done
XXbX
XbX
@@ -21,33 +21,35 @@
default SANE_TOOL_PATH for Solaris. It led to paths such as
..../.. being used in the submodule .git gitdir reference.
-Using the expression 's|\([^/]*\(/*\)\)|..\2|g' provides the desired
-result with all three three tested sed implementations but is harder
-to read. Instead, use an additional -e script to clean up after the
-bug on Solaris. The second script will be a functional no-op on most
-sed implementations.
+As we do not need to handle fully qualfieid paths we can make the
+regex match 1 or more instead of 0 or more non-/ characters so use
+'s|[^/]\{1,\}|..|g' instead, which is correctly handled by all tested
+sed implementations. This expression is semantically different than
+the original one. It will not place leading '..' on a fully qualified
+path as the original expression did. None of the paths passed to the
+regex relied on this behaviour so changing it shouldn't have negative
+impact.
-Signed-off-by: Ben Walton <bwalton at opencsw.org>
+Signed-off-by: Ben Walton <bwalton at artsci.utoronto.ca>
---
- git-submodule.sh | 6 ++++--
- 1 files changed, 4 insertions(+), 2 deletions(-)
+ git-submodule.sh | 5 +++--
+ 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
-index efc86ad..0adad22 100755
+index efc86ad..2c18e0c 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
-@@ -167,10 +167,12 @@ module_clone()
+@@ -167,10 +167,11 @@ module_clone()
a=${a%/}
b=${b%/}
- rel=$(echo $b | sed -e 's|[^/]*|..|g')
-+ # Note: The second -e is to work around a bug in Solairs'
-+ # xpg4/sed. It will be a no-op in a working implementation.
-+ rel=$(echo $b | sed -e 's|[^/]*|..|g' -e 's|\.\{4\}|..|g')
++ # Turn path components into ..
++ rel=$(echo $b | sed -e 's|[^/]\{1,\}|..|g')
echo "gitdir: $rel/$a" >"$path/.git"
- rel=$(echo $a | sed -e 's|[^/]*|..|g')
-+ rel=$(echo $a | sed -e 's|[^/]*|..|g' -e 's|\.\{4\}|..|g')
++ rel=$(echo $a | sed -e 's|[^/]\{1,\}|..|g')
(clear_local_git_env; cd "$path" && GIT_WORK_TREE=. git config core.worktree "$rel/$b")
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list