php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42741 ftruncate extended version
Submitted: 2007-09-23 15:21 UTC Modified: 2021-10-12 16:48 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: beotiger at mail dot ru Assigned: cmb (profile)
Status: Wont fix Package: Filesystem function related
PHP Version: 5.2.4 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
19 + 28 = ?
Subscribe to this entry?

 
 [2007-09-23 15:21 UTC] beotiger at mail dot ru
Description:
------------
There should be an extending version of ftruncate which allows you to truncate not the end of file but the beginning of it (to a certain size) - so if you request filesize more than the current size, the zeros would be added at the beginning of file, not to the end (on demand, of course).



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-23 15:26 UTC] beotiger at mail dot ru
There should be an extending version of ftruncate which allows you to
truncate not the end of file but the beginning of it (to a certain size)
- so if you request filesize more than the current size, the zeros would
be added at the beginning of file, not to the end (on demand, of
course).
It'd be useful for any logs, if their size shouldn't be more than the given number.
 [2011-04-08 21:14 UTC] jani@php.net
-Package: Feature/Change Request +Package: Filesystem function related -Operating System: any +Operating System: *
 [2021-10-12 16:48 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-10-12 16:48 UTC] cmb@php.net
This would be grossly unefficient, what is the reason why there is
no such variant of ftuncate() in POSIX.  If you need that, you can
implement it in PHP, and I'd presume that it'd be about as fast as
a C implementation.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC