pradeepgn / s3fs

Automatically exported from code.google.com/p/s3fs
GNU General Public License v2.0
0 stars 0 forks source link

php file_put_contents and fwrite not truncating properly. #391

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I know this is php specific but I hope this will shed some light of issues I'm 
seeing.

If you try to overwrite a file that changes the length of the file using  
file_put_contents and fwrite (the two I tested), the file does not truncate 
properly. Instead the remaining size is filled with nul (0X00) characters

Example file contents before change 123456789 
Write ABC
File contents after change ABCnulnulnulnulnulnul

ftruncate did not truncate the file.

This behavior is also seen if writing session files $_SESSION

File before 

email|s:12:"my@email.com";first_name|s:4:"Jane";last_name|s:3:"Doe";

File after changing first name to testtesttest

email|s:12:"my@email.com";first_name|s:12:"testtesttest";|s:3:"Doe";

It overwrites the remaining data instead of inserting it correctly.

All of these issues work fine locally, just not through the s3fs mount.

===================================================================
The following information is very important in order to help us to help
you.  Omission of the following details may delay your support request or
receive no attention at all.
===================================================================
Version of s3fs being used (s3fs --version): 1.73

Version of fuse being used (pkg-config --modversion fuse): 2.8.6

System information (uname -a): AWS EC2 Ubuntu 

Original issue reported on code.google.com by baaro...@gmail.com on 19 Nov 2013 at 6:14

GoogleCodeExporter commented 8 years ago
Hi,

I tested with latest revision for this problem, but s3fs worked with no problem.
I have a question, what revision did you use?

I'm sorry for that s3fs latest version 1.73 has some bug about truncate.
If you does not use latest revision(now r498), please checkout latest revision 
and try to check it.

Thanks in advance for your help.

Original comment by ggta...@gmail.com on 19 Nov 2013 at 8:08

GoogleCodeExporter commented 8 years ago
sorry, rather new to this but how do you tell which revision your on? I don't 
see it listed in the --version and if I'm behind do you simply install the 
newest ontop? whats the upgrade path?

Original comment by baaro...@gmail.com on 19 Nov 2013 at 3:46

GoogleCodeExporter commented 8 years ago
Hi,

You can see s3fs revision in /var/log/messages after you run s3fs.
it is example:
  "Nov 19 01:23:47 ip-172-31-17-195 s3fs: init $Rev: 497 $"

And you can check out latest revision as anonymously from this s3fs project on 
googlecode.com by svn.
See: http://code.google.com/p/s3fs/source/checkout

Now s3fs v1.73 has problems about truncate, please checkout and use new 
revision, or wait for next version(v1.74).

Thaks a lot.

Original comment by ggta...@gmail.com on 20 Nov 2013 at 6:04

GoogleCodeExporter commented 8 years ago
Hi,

This issue is left for a long term, and s3fs project moved on 
Github(https://github.com/s3fs-fuse/s3fs-fuse).
So I closed this issue.

If you have a problem yet, please post new issue.

Regards,

Original comment by ggta...@gmail.com on 23 Dec 2013 at 3:29