[ 
https://issues.apache.org/jira/browse/CB-10164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shuqian Ying updated CB-10164:
------------------------------
    Description: 
The plugin does not allow seeking beyond the current length of a file using the 
following code to enforce it:

if (offset > this.length) {
    this.position = this.length;
}

in the FileWriter.js file. 

We found this to cause a lot of issues in random access concurrent write 
application scenarios since it modifies the semantics of seek silently that may 
cause file corruption without informing the client what went wrong. Our 
application behaves correctly after removing such a restriction. 

We belief that such a restriction should be removed since file systems in most 
underlying OSs allow seeking beyond the current data end of a file (like 
Windows and *nix family of OSs), it's a POSIX.1 standard, adding a restriction 
on top of them does not make sense. If such a restriction is required, it maybe 
is better to throw an exception instead of "decide what to do for the client".

  was:
The plugin does not allow seeking beyond the current length of a file using the 
following code the enforce it:

if (offset > this.length) {
    this.position = this.length;
}

in the FileWriter.js file. 

We found this to cause a lot of issues in random access concurrent write 
application scenarios since it modifies the semantics of seek silently that may 
cause file corruption without informing the client what went wrong. Our 
application behaves correctly after removing such a restriction. 

We belief that such a restriction should be removed since file systems in most 
underlying OSs allow seeking beyond the current data end of a file (like 
Windows and *nix family of OSs), it's a POSIX.1 standard, adding a restriction 
on top of them does not make sense. If such a restriction is required, it maybe 
is better to throw an exception instead of "decide what to do for the client".


> Allow seeking beyond current data end of a file
> -----------------------------------------------
>
>                 Key: CB-10164
>                 URL: https://issues.apache.org/jira/browse/CB-10164
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Plugin File
>            Reporter: Shuqian Ying
>
> The plugin does not allow seeking beyond the current length of a file using 
> the following code to enforce it:
> if (offset > this.length) {
>     this.position = this.length;
> }
> in the FileWriter.js file. 
> We found this to cause a lot of issues in random access concurrent write 
> application scenarios since it modifies the semantics of seek silently that 
> may cause file corruption without informing the client what went wrong. Our 
> application behaves correctly after removing such a restriction. 
> We belief that such a restriction should be removed since file systems in 
> most underlying OSs allow seeking beyond the current data end of a file (like 
> Windows and *nix family of OSs), it's a POSIX.1 standard, adding a 
> restriction on top of them does not make sense. If such a restriction is 
> required, it maybe is better to throw an exception instead of "decide what to 
> do for the client".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to