[Gllug] PHP Guru's

salsaman at xs4all.nl salsaman at xs4all.nl
Mon Jul 19 19:01:37 UTC 2010


On Mon, July 19, 2010 16:56, Richard Jones wrote:
> On Mon, Jul 19, 2010 at 01:19:57PM +0200, salsaman at xs4all.nl wrote:
>> "/bin/mkdir -p" and mkdir() do two different things. As do "/bin/rm -rf"
>> and rmdir() [ok, so the latter is not really applicable here].
>
> That's not what Tet was talking about.
>
> What happens to your code:
>
>     com=g_strdup_printf("/bin/rm -rf %s",dir);
>     dummyvar=system(com);
>
> if the string dir contains a space, like dir = "/foo /"?
>

This is already checked for elsewhere in the code befor caling this
function. I suppose I should have mentioned this.

> Anyway, statvfs can be called on *any* file or directory within the
> filesystem.  It doesn't have to be called at the top level, and it's
> both crazy and dangerous for a reporting function to be creating
> directories.
>

The idea of this function is to show the user how much free space there is
in a filesystem. If they click OK then this directory will be created
anway if it does not exist. Therefore it is quite useful for this function
also to check if the directory can be created.

>> Yes, I suppose I could have done something more elegant like you
>> suggest,
>> but when singlehanedly coding 54 man years of code in just 8 years*,
>> quick
>> and ugly cut and paste often beats slower and elegant :-)
>>
>> *https://www.ohloh.net/p/lives (estimate)
>
> Ohloh's estimates are broken.  It estimates libguestfs to have taken
> 16 man-years (it was something in centuries back when we included all
> the generated code), not bad for something which has existed for a
> little over a year and certainly does not have a team of a dozen
> people behind it.
>

Ohloh's site says they use COCOMO, which is known to be more accurate for
large mature projects and less so for small young projects:

http://en.wikipedia.org/wiki/COCOMO


Regards,
Gariel.


-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list