Last modified: 2013-05-24 05:00:48 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T38475, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36475 - Generating thumbnails does not work when there is no access to /tmp
Generating thumbnails does not work when there is no access to /tmp
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.19.0
All Linux
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-reviewed
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-03 10:26 UTC by Johannes Weberhofer
Modified: 2013-05-24 05:00 UTC (History)
9 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Use upload_tmp_dir for storing temporary files (666 bytes, patch)
2012-05-03 10:29 UTC, Johannes Weberhofer
Details
Use upload_tmp_dir for storing temporary files (647 bytes, patch)
2012-05-03 10:33 UTC, Johannes Weberhofer
Details

Description Johannes Weberhofer 2012-05-03 10:26:07 UTC
In cases where a open_basedir restriction has been set, mediawiki should use the directory set in upload_tmp_dir for storing temporary files.
Comment 1 Johannes Weberhofer 2012-05-03 10:29:41 UTC
Created attachment 10503 [details]
Use upload_tmp_dir for storing temporary files
Comment 2 Johannes Weberhofer 2012-05-03 10:33:31 UTC
Created attachment 10504 [details]
Use upload_tmp_dir for storing temporary files

Sorry, have previously sent a wrong patch
Comment 3 Sumana Harihareswara 2012-05-03 18:40:13 UTC
Thanks, Johannes!  It would be great if you got developer access

https://www.mediawiki.org/wiki/Developer_access

and submitted this directly into Git/Gerrit:

https://www.mediawiki.org/wiki/Git/Workflow

Thanks.
Comment 4 Chad H. 2012-05-06 02:22:33 UTC
upload_tmp_dir() should only be used for uploads, not for any random time we want a temporary directory.

If the value of your sys_get_temp_dir() conflicts with open_basedir restrictions, I'd say that's a misconfiguration.
Comment 5 Johannes Weberhofer 2012-05-07 09:17:07 UTC
The problem is, that on servers with many virtual hosts (apache2-mod_php5), the vhost users are locked into their home-directory, using the open_basedir setting. 
To make all uploads working, upload_tmp_dir is set to the HOME/tmp directory. 

Unfortunately the sys_get_temp_dir() value always return the system's directory (e.g. /tmp) where I do not want to give the vhost-users access to (users could read/write other's files).
Comment 7 Johannes Weberhofer 2012-05-11 04:40:43 UTC
Isn't the suggested code exactly the same as the suggested patch?

In the meantime I have seen, that "file_exists()" on the not availabe global tmp-setting already causes an entry into the logs. Maybe this entry could be suppressed?
Comment 8 Chad H. 2012-05-11 11:31:16 UTC
(In reply to comment #7)
> Isn't the suggested code exactly the same as the suggested patch?
> 

No, they're subtly different (I had to look at it for a couple of minutes). The difference is swapping the order of checking upload_tmp_dir() before sys_get_temp_dir().
Comment 9 Max Semenik 2012-05-25 20:22:03 UTC
If sys_get_temp_dir() returns bogus path, there's no guarantee that upload_tmp_dir() works properly, so I think the only viable solution is to add a setting to explicitly override the tmp directory.
Comment 10 Mark A. Hershberger 2012-05-25 23:19:18 UTC
see http://www.mediawiki.org/wiki/Thread:Talk:MediaWiki_1.19/Thumbnails_didn%27t_work_since_Update_to_1.19/reply_%2810%29

Part of the problem is that wfTempDir ignores $wgTmpDirectory.  See
bug 24985 and bug 27959.
Comment 11 Chad H. 2012-05-25 23:26:58 UTC
(In reply to comment #10)
> see
> http://www.mediawiki.org/wiki/Thread:Talk:MediaWiki_1.19/Thumbnails_didn%27t_work_since_Update_to_1.19/reply_%2810%29
> 
> Part of the problem is that wfTempDir ignores $wgTmpDirectory.  See
> bug 24985 and bug 27959.

Not really a problem. This was discussed before, and $wgTmpDirectory is for a different purpose than wfTempDir().
Comment 12 Aaron Schulz 2012-05-25 23:40:21 UTC
(In reply to comment #11)lly a problem. This was discussed before, and $wgTmpDirectory is for a
> different purpose than wfTempDir().

Any link for this?
Comment 13 Chad H. 2012-05-26 00:04:09 UTC
(In reply to comment #12)
> (In reply to comment #11)lly a problem. This was discussed before, and
> $wgTmpDirectory is for a
> > different purpose than wfTempDir().
> 
> Any link for this?

It was an IRC discussion between me and Brion some time after I filed bug 24985.
Comment 14 Chad H. 2012-05-26 00:04:36 UTC
(In reply to comment #13)
> (In reply to comment #12)
> > (In reply to comment #11)lly a problem. This was discussed before, and
> > $wgTmpDirectory is for a
> > > different purpose than wfTempDir().
> > 
> > Any link for this?
> 
> It was an IRC discussion between me and Brion some time after I filed bug
> 24985.

That, and Brion's rather length comment 1 on that bug.
Comment 15 Mark A. Hershberger 2012-05-26 03:21:25 UTC
(In reply to comment #14)
> That, and Brion's rather length Bug 24985 comment 1 on that bug.

They are for different purposes, but as Brion points out in the comment:

> It looks like most code using $wgTmpDirectory doesn't actually need to keep the
> files around across requests or anything, though.
...
> Some things that it looks like *do* need/want to keep files across requests:
> * DBABagOStuff (cache implementation; meant for dev use)
> * .... I think that might be it.

In any case, I have a trial commit on Gerrit change #8996
Comment 16 Mark A. Hershberger 2012-05-26 17:33:52 UTC
(In reply to comment #11)
> Not really a problem.

It is a problem, though.  If a person doesn't want to use /tmp for whatever reason (in this case, because the provider restricts access), then they will run into problems.

Could you comment on Gerrit change #8996?
Comment 17 Sumana Harihareswara 2012-07-17 18:08:59 UTC
Gerrit change #8996 has been merged as of June 13th. Thanks for the patch.
Comment 18 Dmitriy Sintsov 2013-05-24 05:00:48 UTC
1.22wmf3 still failed with 
"Error creating thumbnail: Unable to save thumbnail to destination"

default MediaWiki config 1.22wmf3 for Ubuntu 12.04LTS until I restored "pre 1.20" $wgTmpDirectory defaults in LocalSettings.php:

$wgUploadDirectory = "{$IP}/images";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";

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


Navigation
Links