Bug 181146 - devel/qmake4: gdb_dwarf_index.prf contains gsed specific syntax
Summary: devel/qmake4: gdb_dwarf_index.prf contains gsed specific syntax
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-kde (group)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-08 16:20 UTC by Thierry Thomas
Modified: 2013-08-15 16:10 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thierry Thomas 2013-08-08 16:20:02 UTC
	qt4-qmake-4.8.4 installs the file
	$PREFIX/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf
	which contains the following lines:

    QMAKE_GDB_INDEX += \
      test \$\$(gdb --version | sed -e \'s,[^0-9]\\+\\([0-9]\\)\\.\\([0-9]\\).*,\\1\\2,;q\') -gt 72 && \
      gdb --nx --batch --quiet -ex \'set confirm off\' -ex \"save gdb-index $$QMAKE_GDB_DIR\" -ex quit \'$(TARGET)\'  && \
      test -f $(TARGET).gdb-index && \
      $$QMAKE_OBJCOPY --add-section \'.gdb_index=$(TARGET).gdb-index\' --set-section-flags \'.gdb_index=readonly\' \'$(TARGET)\' \'$
(TARGET)\' && \
      $$QMAKE_DEL_FILE $(TARGET).gdb-index || true

	Unfortunately, the regex is specific to gsed, and when the
	corresponding scriptlet

	test $(gdb --version | sed -e 's,[^0-9]\+\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72

	is run, it fails with the following error:

	test: GNU: unexpected operator

Fix: 

Either replace sed by gsed, adding the dependency, or
	translate the regex to our sed.

	Yet better, since the base GDB is older, this part might be
	ommitted?
How-To-Repeat: 	Test the line:
	test $(gdb --version | sed -e 's,[^0-9]\+\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72

	Then compare to:
	test $(gdb --version | gsed -e 's,[^0-9]\+\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-08-08 16:20:15 UTC
Responsible Changed
From-To: freebsd-ports-bugs->kde

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Raphael Kubo da Costa freebsd_committer freebsd_triage 2013-08-11 13:28:49 UTC
Interesting, it looks like this has been broken forever for our sed,
which uses basic regular expressions by default.

Simply replacing the "+" in the regexp with "{1,}", as suggested by
re_format(7), seems to do the trick. I'd rather not remove the code
altogether because it would make us needlessly deviate from upstream and
have to commit to carrying a patch forever.

I've submitted https://codereview.qt-project.org/#change,62742 to fix it
upstream (the Qt4 backport comes after it is accepted), and I'll include
the fix in the port after that.
Comment 3 dfilter service freebsd_committer freebsd_triage 2013-08-15 12:39:50 UTC
Author: rakuco
Date: Thu Aug 15 11:39:41 2013
New Revision: 324763
URL: http://svnweb.freebsd.org/changeset/ports/324763

Log:
  Make the sed(1) call to add a GDB index to generated files work with base sed.
  
  Add my upstream patch to fix it: use a POSIX-compliant call instead of one
  that only works with GNU sed.
  
  Note that it does not still work automatically because `gdb' is called, and
  the version we have in base does not support index generation.
  
  PR:		ports/181146

Added:
  head/devel/qmake4/files/patch-mkspecs__features__unix__gdb_dwarf_index.prf   (contents, props changed)
Modified:
  head/devel/qmake4/Makefile

Modified: head/devel/qmake4/Makefile
==============================================================================
--- head/devel/qmake4/Makefile	Thu Aug 15 11:37:57 2013	(r324762)
+++ head/devel/qmake4/Makefile	Thu Aug 15 11:39:41 2013	(r324763)
@@ -3,6 +3,7 @@
 
 PORTNAME=	qmake
 DISTVERSION=	${QT4_VERSION}
+PORTREVISION=	1
 CATEGORIES=	devel
 PKGNAMEPREFIX=	qt4-
 

Added: head/devel/qmake4/files/patch-mkspecs__features__unix__gdb_dwarf_index.prf
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/qmake4/files/patch-mkspecs__features__unix__gdb_dwarf_index.prf	Thu Aug 15 11:39:41 2013	(r324763)
@@ -0,0 +1,36 @@
+From fdecdc39399994d2c0309005922590e2f106bbef Mon Sep 17 00:00:00 2001
+From: Raphael Kubo da Costa <rakuco@FreeBSD.org>
+Date: Sun, 11 Aug 2013 15:08:48 +0300
+Subject: [PATCH] gdb_dwarf_index: Use a sed call that's more POSIX-compliant.
+
+sed versions other than the GNU one often default to being POSIX-compliant,
+in which case "+" (with and without escaping) is always an ordinary
+character.
+
+Achieve the same functionality in a way that works with both GNU and BSD
+seds by using "xx*" insted of "x\+".
+
+Cherry-picked from qtbase/faea8d1056e4b034404febd0ef44a00e7784018d.
+
+Change-Id: I462e070992ff214a7261d45c208f2e5f3e962e8f
+Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
+---
+ mkspecs/features/unix/gdb_dwarf_index.prf | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mkspecs/features/unix/gdb_dwarf_index.prf b/mkspecs/features/unix/gdb_dwarf_index.prf
+index e3f79cd..84b4e18 100644
+--- mkspecs/features/unix/gdb_dwarf_index.prf
++++ mkspecs/features/unix/gdb_dwarf_index.prf
+@@ -9,7 +9,7 @@
+     }
+ 
+     QMAKE_GDB_INDEX += \
+-      test \$\$(gdb --version | sed -e \'s,[^0-9]\\+\\([0-9]\\)\\.\\([0-9]\\).*,\\1\\2,;q\') -gt 72 && \
++      test \$\$(gdb --version | sed -e \'s,[^0-9][^0-9]*\\([0-9]\\)\\.\\([0-9]\\).*,\\1\\2,;q\') -gt 72 && \
+       gdb --nx --batch --quiet -ex \'set confirm off\' -ex \"save gdb-index $$QMAKE_GDB_DIR\" -ex quit \'$(TARGET)\'  && \
+       test -f $(TARGET).gdb-index && \
+       $$QMAKE_OBJCOPY --add-section \'.gdb_index=$(TARGET).gdb-index\' --set-section-flags \'.gdb_index=readonly\' \'$(TARGET)\' \'$(TARGET)\' && \
+-- 
+1.8.3.4
+
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Raphael Kubo da Costa freebsd_committer freebsd_triage 2013-08-15 12:40:54 UTC
State Changed
From-To: open->closed

Fixed, thank you.
Comment 5 dfilter service freebsd_committer freebsd_triage 2013-08-15 16:07:30 UTC
Author: rakuco
Date: Thu Aug 15 15:07:11 2013
New Revision: 324772
URL: http://svnweb.freebsd.org/changeset/ports/324772

Log:
  Fix `make patch'.
  
  I forgot WRKSRC was not the expected one in this port. Huge pointy hat to
  me.
  
  PR:		ports/181325
  PR:		ports/181326
  PR:		ports/181146

Modified:
  head/devel/qmake4/files/patch-mkspecs__features__unix__gdb_dwarf_index.prf

Modified: head/devel/qmake4/files/patch-mkspecs__features__unix__gdb_dwarf_index.prf
==============================================================================
--- head/devel/qmake4/files/patch-mkspecs__features__unix__gdb_dwarf_index.prf	Thu Aug 15 14:39:14 2013	(r324771)
+++ head/devel/qmake4/files/patch-mkspecs__features__unix__gdb_dwarf_index.prf	Thu Aug 15 15:07:11 2013	(r324772)
@@ -20,8 +20,8 @@ Reviewed-by: Oswald Buddenhagen <oswald.
 
 diff --git a/mkspecs/features/unix/gdb_dwarf_index.prf b/mkspecs/features/unix/gdb_dwarf_index.prf
 index e3f79cd..84b4e18 100644
---- mkspecs/features/unix/gdb_dwarf_index.prf
-+++ mkspecs/features/unix/gdb_dwarf_index.prf
+--- ../mkspecs/features/unix/gdb_dwarf_index.prf
++++ ../mkspecs/features/unix/gdb_dwarf_index.prf
 @@ -9,7 +9,7 @@
      }
  
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"