ports/160365: [bsd.gecko.mk]: ignore stderr while getting firefox version

Dmitry Marakasov amdmi3 at FreeBSD.org
Thu Sep 1 13:50:10 UTC 2011


>Number:         160365
>Category:       ports
>Synopsis:       [bsd.gecko.mk]: ignore stderr while getting firefox version
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 01 13:50:09 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Marakasov
>Release:        FreeBSD 8.2-RELEASE i386
>Organization:
>Environment:
System: FreeBSD hades.panopticon 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Tue Mar 8 09:48:52 MSK 2011 root at hades.panopticon:/async/obj/usr/src/sys/HADES i386


>Description:
Many firefox-related ports include bsd.gecko.mk, which calls firefox --version to obviously get its version.

firefox prints version string to stdout, but in addition it may prints untelated things to stderr (namely, there's a case with 'No protocol specified' string printed because of something X11-related), which confuses both users (as its printed even on `make checksum` or `make -VPORTNAME`) and portupgrade, which sucks stderr in along with stdout when getting make variables via make -VFOO (that is portupgrade problem though and was fixed in pkgtools git, however there's no portupgrade release with this fix yet)

That 'No protocol specified' or other possible firefox errors may need further investigation - I couldn't reproduce it, but it may happen that firefox doesn't print its version in this case. We should consider not calling huge binary like firefox from ports framework at all, because of possible sideeffects. There are more reliable sources of software version, for example package database (pkg_info -E 'firefox>0')
>How-To-Repeat:
Make firefox --version spew out any errors on stderr and try running make checksum or portupgrade on firefox-i18n.
>Fix:
--- bsd.gecko.mk.patch begins here ---
diff --git bsd.gecko.mk bsd.gecko.mk
index 338591b..4dfbc63 100644
--- bsd.gecko.mk
+++ bsd.gecko.mk
@@ -237,9 +237,9 @@ USE_FIREFOX=	${_FIREFOX_DEFAULT_VERSION}
 
 # Setting/finding Firefox version we want.
 .if exists(${LOCALBASE}/bin/firefox)
-_FIREFOX_VER!=	${LOCALBASE}/bin/firefox --version | ${SED} -e 's/Mozilla Firefox \([0-9]\)\.\([0-9]*\).*/\1\2/'
+_FIREFOX_VER!=	${LOCALBASE}/bin/firefox --version 2>/dev/null | ${SED} -e 's/Mozilla Firefox \([0-9]\)\.\([0-9]*\).*/\1\2/'
 .elif exists(${LOCALBASE}/bin/firefox3)
-_FIREFOX_VER!=	${LOCALBASE}/bin/firefox3 --version | ${SED} -e 's/Mozilla Firefox \([0-9]\)\.\([0-9]*\).*/\1\2/'
+_FIREFOX_VER!=	${LOCALBASE}/bin/firefox3 --version 2>/dev/null | ${SED} -e 's/Mozilla Firefox \([0-9]\)\.\([0-9]*\).*/\1\2/'
 .endif
 
 # Check if installed Firefox version matches the wanted one
--- bsd.gecko.mk.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list