Closed Bug 1711331 Opened 4 years ago Closed 4 years ago

getenforce test fails when /usr/sbin is not in user $PATH

Categories

(Core :: Widget: Gtk, defect)

Firefox 88
All
Linux
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: dmckeon, Unassigned)

References

Details

Summary: getenforce test fails when /usr/sbin is not in user $PATH
Component: General
Version: 88.0 (64-bit) / Mozilla Firefox for Fedora / fedora - 1.0
OS: Linux Fedora 5.11.19-100.fc32.x86_64

Description:

/usr/bin/firefox: line 196: getenforce: command not found
/usr/bin/firefox: line 196: [: !=: unary operator expected

Overview:

In /usr/bin/firefox are the following lines:

 68  GETENFORCE_FILE="/usr/sbin/getenforce"
...
192
193  # When Firefox is not running, restore SELinux labels for profile files
194  # (rhbz#1731371)
195  if [ $MOZILLA_DOWN -ne 0 ]; then
196    if [ -x $GETENFORCE_FILE ] && [ `getenforce` != "Disabled" ]; then
197      (restorecon -vr ~/.mozilla/firefox/* &)
198    fi
199  fi

If the Firefox user does not have /usr/sbin in their $PATH,
the getenforce command is not found,
and thus `getenforce` produces no output on STDOUT,
and the following errors are issued:

/usr/bin/firefox: line 196: getenforce: command not found
/usr/bin/firefox: line 196: [: !=: unary operator expected

Suggested fix:

196    if [ -x $GETENFORCE_FILE ] && [ $($GETENFORCE_FILE)  != "Disabled" ]; then

which is similar to a fix for Firefox 82.x suggested in:

https://bugzilla.redhat.com/show_bug.cgi?id=1891194 Executing /bin/firefox results in error message "[Enforcing: command not found"

Build Id:

Name                Firefox
Version             88.0
Build ID            20210504144832
Distribution ID     fedora
User Agent          Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0
OS                  Linux 5.11.19-100.fc32.x86_64 #1 SMP Fri May 7 21:52:03 UTC 2021

Additional Builds and Platforms:

unknown, but issue is likely to exist on other Unix/Linux platforms

Steps to Reproduce:

1) As needed, configure Firefox to report or log errors.
2) Remove /usr/sbin from user's $PATH
3) Start a new instance of Firefox
4) Confirm error messages are present

Actual Results:

    /usr/bin/firefox: line 196: getenforce: command not found
    /usr/bin/firefox: line 196: [: !=: unary operator expected

Expected Results:

    a profound lack of error messages

Setting a component for this issue in order to get the dev team involved.
If you feel it's an incorrect one please feel free to change it to a more appropriate one.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

That code is not in the Mozilla repo afaict, probably should be reported to Fedora.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.