<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>39882</bug_id>
          
          <creation_ts>2010-05-28 10:05:57 -0700</creation_ts>
          <short_desc>openFile(...) in FIleSystemPOSIX does not call fileSystemRepresentation</short_desc>
          <delta_ts>2010-05-28 13:08:24 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Android</rep_platform>
          <op_sys>Android</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ben Murdoch">benm</reporter>
          <assigned_to name="Ben Murdoch">benm</assigned_to>
          <cc>android-webkit-unforking</cc>
    
    <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>231754</commentid>
    <comment_count>0</comment_count>
    <who name="Ben Murdoch">benm</who>
    <bug_when>2010-05-28 10:05:57 -0700</bug_when>
    <thetext>In WebCore/platform/posix/FileSystemPOSIX.cpp all the functions that access the filesystem (e.g. fileExists, deleteFile) and take a WebCore::String representing the file path run that string through fileSystemRepresentation() before using it, except for openFile(). This causes openFile to fail on Android, where the call to fileSystemRepresentation is very important.

I&apos;d like to change openFile() to make this call. I think the existing FileReader tests in LayoutTests/fast/files should suffice here.

Patch to follow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>231762</commentid>
    <comment_count>1</comment_count>
      <attachid>57338</attachid>
    <who name="Ben Murdoch">benm</who>
    <bug_when>2010-05-28 10:15:04 -0700</bug_when>
    <thetext>Created attachment 57338
Patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>231771</commentid>
    <comment_count>2</comment_count>
      <attachid>57338</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-05-28 10:26:34 -0700</bug_when>
    <thetext>Comment on attachment 57338
Patch.

&gt; +    if (!fsRep.data() || fsRep.data()[0] == &apos;\0&apos;)
&gt; +        return invalidPlatformFileHandle;

I understand the check for null here, but:

   1) I suggest using the isNull function instead.
   2) Why the check for the empty string? I don&apos;t think there&apos;s a need to optimize that case, and I expect open to give an error.

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>231862</commentid>
    <comment_count>3</comment_count>
    <who name="Ben Murdoch">benm</who>
    <bug_when>2010-05-28 12:16:41 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 57338 [details])
&gt; &gt; +    if (!fsRep.data() || fsRep.data()[0] == &apos;\0&apos;)
&gt; &gt; +        return invalidPlatformFileHandle;
&gt; 
&gt; I understand the check for null here, but:
&gt; 
&gt;    1) I suggest using the isNull function instead.
&gt;    2) Why the check for the empty string? I don&apos;t think there&apos;s a need to optimize that case, and I expect open to give an error.
&gt; 
&gt; r=me

Thanks for the review Darin! When checking the value of the return of the fileSystemRepresentation function I was following the standard pattern of other functions in the file - they all perform a null and empty string check in this way.

Having said that, I think you&apos;re correct - isNull() is better and open should be able to handle the empty string. I&apos;ll make your suggested changes and land this patch manually.

Cheers, Ben</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>231893</commentid>
    <comment_count>4</comment_count>
    <who name="Ben Murdoch">benm</who>
    <bug_when>2010-05-28 13:08:24 -0700</bug_when>
    <thetext>Sending        WebCore/ChangeLog
Sending        WebCore/platform/posix/FileSystemPOSIX.cpp
Transmitting file data ..
Committed revision 60374.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>57338</attachid>
            <date>2010-05-28 10:15:04 -0700</date>
            <delta_ts>2010-05-28 10:26:33 -0700</delta_ts>
            <desc>Patch.</desc>
            <filename>39882.txt</filename>
            <type>text/plain</type>
            <size>1580</size>
            <attacher name="Ben Murdoch">benm</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA2MDM2NCkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTUgQEAKKzIwMTAtMDUtMjggIEJlbiBNdXJkb2NoICA8YmVubUBnb29nbGUuY29t
PgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIG9wZW5G
aWxlKC4uLikgaW4gRklsZVN5c3RlbVBPU0lYIGRvZXMgbm90IGNhbGwgZmlsZVN5c3RlbVJlcHJl
c2VudGF0aW9uCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9p
ZD0zOTg4MgorCisgICAgICAgIE5vIG5ldyB0ZXN0cy4gRXhpc3RpbmcgdGVzdHMgaW4gZmFzdC9m
aWxlcyBzaG91bGQgc3VmZmljZS4KKworICAgICAgICAqIHBsYXRmb3JtL3Bvc2l4L0ZpbGVTeXN0
ZW1QT1NJWC5jcHA6CisgICAgICAgIChXZWJDb3JlOjpvcGVuRmlsZSk6IHBhc3MgdGhlIHBhdGgg
cGFyYW1ldGVyIHRocm91Z2ggZmlsZVN5c3RlbVJlcHJlc2VudGF0aW9uIGJlZm9yZSB1c2luZyBp
dC4KKwogMjAxMC0wNS0yNyAgRGFyaW4gQWRsZXIgI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m1GbGFnLCAwNjY2KTsKKyAg
ICByZXR1cm4gb3Blbihmc1JlcC5kYXRhKCksIHBsYXRmb3JtRmxhZywgMDY2Nik7CiB9CiAKIHZv
aWQgY2xvc2VGaWxlKFBsYXRmb3JtRmlsZUhhbmRsZSYgaGFuZGxlKQo=
</data>
<flag name="review"
          id="41899"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>