php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27867 exec(du) returns width doubled values UPDATE
Submitted: 2004-04-05 07:09 UTC Modified: 2004-04-17 18:20 UTC
From: andrej at antiszoc dot hu Assigned:
Status: Not a bug Package: Program Execution
PHP Version: 4.3.5 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: andrej at antiszoc dot hu
New email:
PHP Version: OS:

 

 [2004-04-05 07:09 UTC] andrej at antiszoc dot hu
Description:
------------
We are using a script, which looks up every directory of our webhosting customers. For some reasons we don't use quota, just looks the space, the customers use. The script executes du, width exec('du -d 0 -h /MAINDIR'.dirname); this worked just fine, for weeks. Last week we update-ed to PHP4.3.5 and after, the script emailed us very wierd numbers. Taking a closer look we saw, that with exec() du returns exactly the twice of the real du value, but everything else fine. We tested it from directly in the shell, and of coz several times, in our PHP script.

This a very simple thing, so wouldn't post any code samples.

P.S: I've just tried stat, it worked far more worse...

Thx,
Andrej


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-05 08:56 UTC] andrej at antiszoc dot hu
<?PHP
  $dirname = 'andrej'; //or the local one
  $usedspace = exec('du -d 0 -h /home/'.$dirname);
  print $usedspace;
/*check what you got for the above command in shell... not that in $usedspace*/
?>

So... but you have to try the same command from shell. I didn't post any code sample before, because it could be very system specific (e.g: dir. struct.). I hoped, you can reproduce it, from what I have posted for the first time. Of coz it's FULLY pointless to post our script, because it's system specific, and uses SQL, and mails the output...
 [2004-04-05 09:06 UTC] sniper@php.net
I can not reproduce this within Linux. (in which -d argument does not exist..) And I can't reproduce this in FreeBSD either. So it must be something wrong elsewhere in your script /system.

 [2004-04-05 09:54 UTC] andrej at antiszoc dot hu
I mailed some more info and code to sniper and derick because I don't want confidental info, to be posted here.

The posted sample code ([5 Apr 8:56am EDT]) works fine, so I did more investigations. That's mailed to sniper and derick. Looks like the exec() within a foreach and a while gets hairy.
 [2004-04-17 18:20 UTC] andrej at antiszoc dot hu
Looks like it is fixed with 4.3.6, with the VERY SAME code it works fine now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 10:01:31 2024 UTC