Bug 867073 - TMPDIR is hardcoded for firefox
TMPDIR is hardcoded for firefox
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: firefox (Show other bugs)
17
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Jan Horak
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks: 1161110
  Show dependency treegraph
 
Reported: 2012-10-16 13:18 EDT by Andrew Travneff
Modified: 2014-11-06 07:01 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-01 13:13:13 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
proposed patch for /usr/bin/firefox (495 bytes, patch)
2012-10-16 13:18 EDT, Andrew Travneff
no flags Details | Diff

  None (edit)
Description Andrew Travneff 2012-10-16 13:18:07 EDT
Created attachment 628293 [details]
proposed patch for /usr/bin/firefox

Temporary download dir for Firefox is specified in /usr/bin/firefox script as following:

## Use /var/tmp instead of /tmp because of 1GB /tmp limit in  Fedora 18 and later
TMPDIR="/var/tmp"
export TMPDIR

This way gives no choice to change it. A relevant option in user preferences is absent too, as far as I understand.
As for me, I have /tmp/ at tmpfs and /var/tmp/ at disk storage and I'd like to keep FF temp dir still in /tmp/. The reasons to have such a value by default are strong enough, but it would be better to have an option to override it.

Proposed patch uses MOZ_TMPDIR for TMPDIR if the former one is set. Such a name shouldn't intersect with anything other.
Otherwise it doesn't change the current behaviour.

FF version: firefox-16.0.1-1.fc17.x86_64
Comment 1 Jan Horak 2012-10-17 03:57:24 EDT
Okay, this sounds reasonable.
Comment 2 Jan Horak 2012-11-08 07:59:13 EST
This fix/feature will be part of next security update which should be available around November 20.
Comment 3 Michael Schwendt 2013-05-22 16:14:37 EDT
The fix is bad, IMO.

Why is a user-defined $TMPDIR ignored?
Why does the /usr/bin/firefox script override it with a hardcoded /var/tmp?

This has broken Claws Mail, which tries to prevent multiple instances from being started: bug 956390 - When started via Firefox mailto handling, Claws Mail ends up with a different temp dir compared with when started within GNOME Shell (or the user's session).
Comment 4 Michael Schwendt 2013-05-22 17:10:08 EDT
> Source21:       firefox.sh.in

What is the current upstream status with regard to that file? I have downloaded upstream's firefox-21.0.tar.bz2 archive, and it does not include a script that overrides TMPDIR. run-mozilla.sh doesn't mess with TMPDIR.
Comment 5 Michael Schwendt 2013-05-23 02:40:23 EDT
correct Claws Mail ticket: bug 956380
Comment 6 Jan Horak 2013-05-23 04:35:22 EDT
Fedora decided to use tmpfs for /tmp (tmp in memory). When opening big files this could lead to filling all available space in /tmp easily (and also occupy half of system memory). We've decided to use /var/tmp which is by default on root partition. The TMPDIR was hardcoded in /usr/bin/firefox script, then MOZ_TMPDIR has been introduced to override it. 

I agree that overriding user defined TMPDIR isn't correct. I'll fix that by avoiding to set TMPDIR to /var/tmp when it was already defined as environment variable. You will have to set TMPDIR variable before you run Claws anyway.

About firefox.sh - this file is not from upstream, because upstream does not cover distribution specific issues.
Comment 7 Michael Schwendt 2013-05-23 07:26:23 EDT
The solution I'd favour is to have /usr/bin/firefox evaluate TMPDIR and use it for setting a private MOZ_TMPDIR used within Firefox. If TMPDIR and perhaps TMP and TEMP (in that order) are not set, have MOZ_TMPDIR default to /var/tmp, but not override the empty TMPDIR in the env of launched programs. That way, launched programs can keep their own defaults, e.g. glib2 defaults to /tmp if no env var is set.


> You will have to set TMPDIR variable before you run Claws anyway.

Only since the firefox script has introduced a hardcoded /var/tmp, which isn't in sync with the default path of other temp dir methods.

Quoting from bug 956380 comment 5:
|
| Claws Mail on the other hand relies on g_get_tmp_dir(),
| which reads the env vars TMPDIR, TMP, TEMP (in that order),
| and if none is defined, defaults to /tmp.
Comment 8 Jan Horak 2013-05-23 09:07:09 EDT
(In reply to Michael Schwendt from comment #7)
> The solution I'd favour is to have /usr/bin/firefox evaluate TMPDIR and use
> it for setting a private MOZ_TMPDIR used within Firefox. If TMPDIR and
> perhaps TMP and TEMP (in that order) are not set, have MOZ_TMPDIR default to
> /var/tmp, but not override the empty TMPDIR in the env of launched programs.
> That way, launched programs can keep their own defaults, e.g. glib2 defaults
> to /tmp if no env var is set.

I'm afraid that's not possible. A MOZ_TMPDIR was introduced to allow override TEMPDIR to content MOZ_TMPDIR content. Firefox binary doesn't read MOZ_TMPDIR variable, it reads TMPDIR as any other application.

> 
> 
> > You will have to set TMPDIR variable before you run Claws anyway.
> 
> Only since the firefox script has introduced a hardcoded /var/tmp, which
> isn't in sync with the default path of other temp dir methods.
Do you explicitly set TMPDIR variable on your system? If so with next update the Firefox will honour this preference, but if TMPDIR isn't defined we'll set default tmp dir to /var/tmp.

> Quoting from bug 956380 comment 5:
> |
> | Claws Mail on the other hand relies on g_get_tmp_dir(),
> | which reads the env vars TMPDIR, TMP, TEMP (in that order),
> | and if none is defined, defaults to /tmp.
Comment 9 Michael Schwendt 2013-05-24 01:53:20 EDT
> Do you explicitly set TMPDIR variable on your system?

Occasionally. That means, for some accounts. It isn't required by Claws Mail, however. It will be required when some parts of Fedora default to /tmp and others default to /var/tmp.

> If so with next update the Firefox will honour this preference,
> but if TMPDIR isn't defined we'll set default tmp dir to /var/tmp.

Better than nothing. Thanks!
Comment 10 Fedora End Of Life 2013-07-04 01:55:11 EDT
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 11 Fedora End Of Life 2013-08-01 13:13:19 EDT
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.