Bug 229064 - Warnings from Mk/Uses/gecko.mk when creating INDEX
Summary: Warnings from Mk/Uses/gecko.mk when creating INDEX
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-gecko (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-16 03:39 UTC by Vladimir Omelchuk
Modified: 2018-06-17 18:39 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Omelchuk 2018-06-16 03:39:33 UTC
root@vladiom:/usr/ports # make index
Generating INDEX-11 - please wait..--- describe.accessibility ---
[…]
--- describe.x11 ---
--- describe.www ---
make[5]: "/usr/ports/Mk/Uses/gecko.mk" line 48: warning: "/usr/local/bin/firefox --version 2>/dev/null" returned non-zero status
make[5]: "/usr/ports/Mk/Uses/gecko.mk" line 48: warning: "/usr/local/bin/firefox --version 2>/dev/null" returned non-zero status
--- describe.x11-clocks ---
--- describe.x11-drivers ---
[…]
--- describe.x11-toolkits ---
--- describe.x11-wm ---
 Done.

# uname -srm
FreeBSD 11.1-RELEASE-p10 amd64

# pkg version -v | grep firefox
firefox-60.0.2,1                   =   up-to-date with index
Comment 1 Rainer Hurling freebsd_committer freebsd_triage 2018-06-16 13:08:22 UTC
There is a new behaviour of www/firefox, introduced since
version 60.x, see [1][2]. Running Firefox as root is not supported any more.

So, gecko.mk fails, when it tries to run 'firefox --version'. If you use the same command as a regular (non root) user, it does not fail.

I think we have to find another way to do the version check in /usr/ports/Mk/Uses/gecko.mk:48 as root. For me, the following patch helps as a workaround:

--- gecko.mk.orig	2018-05-01 08:57:58.482882000 +0200
+++ gecko.mk	2018-05-23 20:20:53.518158000 +0200
@@ -45,7 +45,7 @@
 60_DEPENDS=		${LOCALBASE}/lib/firefox/firefox:www/firefox
 
 .if exists(${LOCALBASE}/bin/firefox)
-_GECKO_INSTALLED_VER!=	${LOCALBASE}/bin/firefox --version 2>/dev/null
+_GECKO_INSTALLED_VER!=	su -m www -c '${LOCALBASE}/bin/firefox --version' 2>/dev/null
 _GECKO_INSTALLED_VER:=	${_GECKO_INSTALLED_VER:M[0-9][0-9]*:C/([0-9][0-9]).*/\1/g}
 .endif

Of course, that's not optimal and I am not sure, if it brings in new security issues(?).



[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1323302
[2] https://hg.mozilla.org/integration/autoland/rev/90a06cdcb48f
Comment 2 Vladimir Omelchuk 2018-06-16 14:01:39 UTC
(In reply to Rainer Hurling from comment #1)

I understood.
Thanks for clarifying.
Comment 3 Walter Schwarzenfeld freebsd_triage 2018-06-16 19:59:00 UTC
I think it is better to  change the line to something like (I don't look in the moment for correct syntax):

_GECKO_INSTALLED_VER!= /usr/local/sbin/pkg query  %v firefox|sed -E 's/([0-9][0-9]).*/\1/g'

This command has not the problem with root.
Comment 4 Rainer Hurling freebsd_committer freebsd_triage 2018-06-16 20:39:03 UTC
(In reply to w.schwarzenfeld from comment #3)

But this would be only for 'pkg' users and not for others, who build from sources, wouldN't it?
Comment 5 Walter Schwarzenfeld freebsd_triage 2018-06-16 21:02:33 UTC
Pkg query gives information of all installed packages, don't matter if it was compiled or installed with pkg.
Comment 6 Walter Schwarzenfeld freebsd_triage 2018-06-16 21:04:15 UTC
Look in the code of portmaster. It works with pkg commands.
Comment 7 Rainer Hurling freebsd_committer freebsd_triage 2018-06-16 21:07:35 UTC
(In reply to w.schwarzenfeld from comment #6)

Of course, you are right. Very nice solution :)
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-06-17 16:51:06 UTC
A commit references this bug:

Author: jbeich
Date: Sun Jun 17 16:50:31 UTC 2018
New revision: 472612
URL: https://svnweb.freebsd.org/changeset/ports/472612

Log:
  gecko: check app compatibility for -i18n via package registry

  make[5]: "/usr/ports/Mk/Uses/gecko.mk" line 48: warning: "/usr/local/bin/firefox --version 2>/dev/null" returned non-zero status

  $ sudo firefox --version
  Running Nightly as root in a regular user's session is not supported.  ($XAUTHORITY is /home/foo/.Xauthority which is owned by foo.)

  https://bugzilla.mozilla.org/show_bug.cgi?id=1323302

  PR:		229064
  Reported by:	Vladimir Omelchuk
  Analyzed by:	Rainer Hurling
  Submitted by:	Walter Schwarzenfeld (based on)

Changes:
  head/Mk/Uses/gecko.mk
Comment 9 Jan Beich freebsd_committer freebsd_triage 2018-06-17 16:52:38 UTC
(In reply to Rainer Hurling from comment #1)
> Running Firefox as root is not supported any more.

Works fine here. Try proper root login.

$ sudo su -l root -c '/usr/local/bin/firefox --version'
Mozilla Firefox 61.0
Comment 10 Rainer Hurling freebsd_committer freebsd_triage 2018-06-17 18:39:06 UTC
(In reply to Jan Beich from comment #9)

Yes, you are right. Firefox complains, when running it as root in user's session:

#firefox --version
Running Firefox as root in a regular user's session is not supported.  ($HOME is /home/xxx which is owned by xxx.)

Running as 'real' root works. Thanks for the clarification.