[CDRIVER-870] Handle GridFS I/O operations beyond end-of-file Created: 22/Sep/15  Updated: 18/Nov/15  Resolved: 09/Oct/15

Status: Closed
Project: C Driver
Component/s: GridFS
Affects Version/s: 1.2-rc0
Fix Version/s: 1.3.0-beta0

Type: Bug Priority: Major - P3
Reporter: Kyle Suarez Assignee: Kyle Suarez
Resolution: Done Votes: 0
Labels: gridfs
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All


Issue Links:
Duplicate
duplicates CDRIVER-848 Probable readv crash when creating no... Closed
Related
is related to CDRIVER-765 Seeking issues with GridFS file Closed
is related to CDRIVER-848 Probable readv crash when creating no... Closed

 Description   

If one seeks past the end of a GridFS file, the driver should do something reasonable when an I/O operation is performed.

Documentation must be clearly updated to explain the driver's behavior with the seek/read/write behavior, especially beyond the end of the file.



 Comments   
Comment by Githook User [ 10/Oct/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}

Message: Merge pull request #290 from ksuarz/feature/extend

CDRIVER-870: sane GridFS behavior past end-of-file
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/611365fb3399e996c00094bd14117ad509c1c211

Comment by Githook User [ 10/Oct/15 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'ksuarz@gmail.com'}

Message: CDRIVER-870 update memset0 to invalidate read buf
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/e023d33be3183eddfd6c5ef8bde0c1d9856cd387

Comment by Githook User [ 10/Oct/15 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'ksuarz@gmail.com'}

Message: CDRIVER-870 write past end of gridfs file

Writing past the end of a GridFS file now extends it and fills the gap space
with zero bytes.

New functions:
_mongoc_gridfs_file_extend()
_mongoc_gridfs_file_page_memset0()

More tests added to test this behavior.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/e2c174ec427350d4440b9baa0fa3a4d66f72fb30

Comment by Githook User [ 10/Oct/15 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'ksuarz@gmail.com'}

Message: CDRIVER-870 add gridfs file extension function

You can mongoc_gridfs_file_seek() past the end of a file and call
mongoc_gridfs_file_extend() to extend the file to the new position. The
extended space is filled with zeroes with mongoc_gridfs_file_page_memset0().
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/41ff10db2340b6623f5e9743765ea7c6d0464a7b

Comment by Githook User [ 10/Oct/15 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'ksuarz@gmail.com'}

Message: CDRIVER-870 error on readv past end-of-file

Attempting to call mongoc_gridfs_file_readv() after seeking past the end of the
file now results in an error.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/277b7056e17721d894ed421cfe16b8f74f3ddff6

Generated at Wed Feb 07 21:10:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.