From:             
Operating system: Linux 2.6.35
PHP version:      5.3.3
Package:          Gettext related
Bug Type:         Bug
Bug description:Gettext + NFS + atomic file replace = not handled

Description:
------------
Hi,



I'm facing a bug related to Gettext, Apache2 and mod_php, a NFS mount point
and atomic .mo file creation.



This problem doesn't occur on local file system, or while overwriting .mo
files.



How to reproduce : put your gettext files (.mo) on a NFS share, change the
translated phrase and format them using a temporary file, to be an atomic
change :

msgfmt -o /tmp/messages.mo
/var/local/medias/small/data/test_gettext/en_GB/LC_MESSAGES/messages.po &&
mv /tmp/messages.mo
/var/local/medias/small/data/test_gettext/en_GB/LC_MESSAGES/messages.mo



I have to use atomic change, cause it is a high loaded server and if I
didn't do that, the new .mo file is partially read and cached, so I got
partially translated phrases.









Test script:
---------------
<?php

$locale = 'en_GB';

$langue = substr($_GET['locale'], 0, 2);

//$bdpath = dirname($_SERVER['SCRIPT_FILENAME']);

$bdpath = '/var/local/medias/small/data/test_gettext'; // NFS mount point

bindtextdomain('messages', $bdpath);

textdomain('messages');

bind_textdomain_codeset('messages', 'UTF-8');

$local = setlocale ( LC_MESSAGES ,  $locale . '.utf8' );

putenv ( "LANG=" . $locale );

putenv ( "LANGUAGE=" . $locale );

$st = stat($bdpath."/".$locale."/LC_MESSAGES/messages.mo");

echo date("H:i:s")." inode: ".$st[1]." mtime: ".$st[8]." text: "._("bonjour
le monde")."\n";

Expected result:
----------------
HELLO WORLD



Actual result:
--------------
// if I rm the .mo files, some apache2 process display :

bonjour le monde

// else, I got the old phrase :

hello world

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53128&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53128&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53128&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53128&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53128&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53128&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53128&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53128&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53128&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53128&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53128&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53128&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53128&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53128&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53128&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53128&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53128&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53128&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53128&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53128&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53128&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53128&r=mysqlcfg

Reply via email to