<?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>39283</bug_id>
          
          <creation_ts>2010-05-18 04:03:46 -0700</creation_ts>
          <short_desc>Port SharedBuffer to POSIX.</short_desc>
          <delta_ts>2010-05-20 18:19:55 -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>Platform</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Other</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>
          <dependson>39348</dependson>
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Young Han Lee">joybro201</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>skyul</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>227245</commentid>
    <comment_count>0</comment_count>
    <who name="Young Han Lee">joybro201</who>
    <bug_when>2010-05-18 04:03:46 -0700</bug_when>
    <thetext>Implement SharedBuffer::createWithContentsOfFile with POSIX functions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>227248</commentid>
    <comment_count>1</comment_count>
      <attachid>56356</attachid>
    <who name="Young Han Lee">joybro201</who>
    <bug_when>2010-05-18 04:07:01 -0700</bug_when>
    <thetext>Created attachment 56356
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>227333</commentid>
    <comment_count>2</comment_count>
      <attachid>56356</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-05-18 09:19:33 -0700</bug_when>
    <thetext>Comment on attachment 56356
patch

&gt; +    int fd = open(filePath.utf8().data(), O_RDONLY);

This is not a portable way to convert a WebCore string to a POSIX filename. See the functions named filenameFromString in the various FileSystem source files to see how it&apos;s done on various platforms. We may need to add something to FileSystem.h so we can do this in a way that works across platforms.

&gt; +    size_t bytesToRead = fileStat.st_size;

If the file size is greater than what can fit in size_t, this assignment will truncate the size. The type of st_size is off_t, and there&apos;s no guarantee it can fit in a size_t. We should include some sort of check here to make sure the function returns 0 in a case like that instead of reading only part of the file.

&gt; +    RefPtr&lt;SharedBuffer&gt; result = SharedBuffer::create();

Here in the SharedBuffer class, this function should just be called create(). See examples in other member functions.

&gt; +    result-&gt;m_buffer.resize(bytesToRead);

It&apos;s slightly better to use the grow function here instead of the resize function, since it won&apos;t do unnecessary checks related to shrinking a buffer and here we know we are either growing it or leaving it as-is.

&gt; +    if (result-&gt;m_buffer.size() != bytesToRead) {
&gt; +        close(fd);
&gt; +        return 0;
&gt; +    }

This code path contains dead code and thus can&apos;t be tested. The resize function can&apos;t fail. The size is guaranteed to be equal to bytesToRead. The resize function will call CRASH if it can&apos;t allocate memory. If we want a code path that will return 0 if we are out of memory then we need to make use of the tryReserveCapacity function, a function that can fail without calling CRASH. Then check for failure, and then call the grow function.

&gt; +    ssize_t bytesRead = 0;

There&apos;s no reason to initialize this to zero. I also suggest defining it after defining totalBytesToRead.

review- because at least some of the issues I mention above should be resolved</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>227729</commentid>
    <comment_count>3</comment_count>
    <who name="Young Han Lee">joybro201</who>
    <bug_when>2010-05-19 00:39:53 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 56356 [details])
&gt; &gt; +    int fd = open(filePath.utf8().data(), O_RDONLY);
&gt; 
&gt; This is not a portable way to convert a WebCore string to a POSIX filename. See the functions named filenameFromString in the various FileSystem source files to see how it&apos;s done on various platforms. We may need to add something to FileSystem.h so we can do this in a way that works across platforms.

OK. I&apos;ve done this by new patch (https://bugs.webkit.org/show_bug.cgi?id=39348).
So now, this depends on 39348.

&gt; 
&gt; &gt; +    size_t bytesToRead = fileStat.st_size;
&gt; 
&gt; If the file size is greater than what can fit in size_t, this assignment will truncate the size. The type of st_size is off_t, and there&apos;s no guarantee it can fit in a size_t. We should include some sort of check here to make sure the function returns 0 in a case like that instead of reading only part of the file.
&gt; 
&gt; &gt; +    RefPtr&lt;SharedBuffer&gt; result = SharedBuffer::create();
&gt; 
&gt; Here in the SharedBuffer class, this function should just be called create(). See examples in other member functions.
&gt; 
&gt; &gt; +    result-&gt;m_buffer.resize(bytesToRead);
&gt; 
&gt; It&apos;s slightly better to use the grow function here instead of the resize function, since it won&apos;t do unnecessary checks related to shrinking a buffer and here we know we are either growing it or leaving it as-is.

I&apos;ve fixed all above.

&gt; 
&gt; &gt; +    if (result-&gt;m_buffer.size() != bytesToRead) {
&gt; &gt; +        close(fd);
&gt; &gt; +        return 0;
&gt; &gt; +    }
&gt; 
&gt; This code path contains dead code and thus can&apos;t be tested. The resize function can&apos;t fail. The size is guaranteed to be equal to bytesToRead. The resize function will call CRASH if it can&apos;t allocate memory. If we want a code path that will return 0 if we are out of memory then we need to make use of the tryReserveCapacity function, a function that can fail without calling CRASH. Then check for failure, and then call the grow function.

Oops, I&apos;ve removed this but don&apos;t add other out of memory check. It seems overwork.

&gt; 
&gt; &gt; +    ssize_t bytesRead = 0;
&gt; 
&gt; There&apos;s no reason to initialize this to zero. I also suggest defining it after defining totalBytesToRead.

fixed also.

&gt; 
&gt; review- because at least some of the issues I mention above should be resolved

Thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>227731</commentid>
    <comment_count>4</comment_count>
      <attachid>56471</attachid>
    <who name="Young Han Lee">joybro201</who>
    <bug_when>2010-05-19 00:41:47 -0700</bug_when>
    <thetext>Created attachment 56471
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>227847</commentid>
    <comment_count>5</comment_count>
      <attachid>56471</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-05-19 09:10:49 -0700</bug_when>
    <thetext>Comment on attachment 56471
patch

&gt; +#include &quot;FileSystem.h&quot;
&gt; +
&gt; +#include &lt;fcntl.h&gt;
&gt; +#include &lt;sys/stat.h&gt;
&gt; +#include &lt;unistd.h&gt;
&gt; +#include &lt;wtf/text/CString.h&gt;

We put includes in a single paragraph. Not one for &quot;&quot; and a separate one for &lt;&gt;.

&gt; +    char* filename = filenameFromString(filePath);

Can this function ever fail? If so, then I think we need code to handle that case.

&gt; +    size_t totalBytesRead = 0;
&gt; +    ssize_t bytesRead;
&gt; +    while ((bytesRead = read(fd, result-&gt;m_buffer.data() + totalBytesRead, bytesToRead - totalBytesRead)) &gt; 0)
&gt; +        totalBytesRead += bytesRead;

If the length of the file increases due to another process writing to it while this function is running, then this will end up calling read with a size of 0. I suppose that&apos;s OK and how you&apos;re supposed to use the read call.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>228669</commentid>
    <comment_count>6</comment_count>
      <attachid>56471</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-05-20 18:19:50 -0700</bug_when>
    <thetext>Comment on attachment 56471
patch

Clearing flags on attachment: 56471

Committed r59890: &lt;http://trac.webkit.org/changeset/59890&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>228670</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-05-20 18:19:55 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>56356</attachid>
            <date>2010-05-18 04:07:01 -0700</date>
            <delta_ts>2010-05-18 09:19:33 -0700</delta_ts>
            <desc>patch</desc>
            <filename>patchFor39283</filename>
            <type>text/plain</type>
            <size>3297</size>
            <attacher name="Young Han Lee">joybro201</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA1OTY2NikKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTMgQEAKKzIwMTAtMDUtMTggIFlvdW5nIEhhbiBMZWUgIDxqb3licm9AY29tcGFu
eTEwMC5uZXQ+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAg
ICAgUG9ydCBTaGFyZWRCdWZmZXIgdG8gUE9TSVguCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJr
aXQub3JnL3Nob3dfYnVnLmNnaT9pZD0zOTI4MworCisgICAgICAgICogcGxhdGZvcm0vcG9zaXgv
U2hhcmVkQnVmZmVyUE9TSVguY3BwOiBBZGRlZC4KKyAgICAgICAgKFdlYkNvcmU6OlNoYXJlZEJ1
ZmZlcjo6Y3JlYXRlV2l0aENvbnRlbnRzT2ZGaWxlKToKKwogMjAxMC0wNS0xOCAgRXJpYyBTZWlk
ZWwgIDxlcmljQHdlYmtpdC5vcmc+CiAKICAgICAgICAgVW5yZXZpZXdlZCBidWlsZCBmaXguCklu
ZGV4OiBXZWJDb3JlL3BsYXRmb3JtL3Bvc2l4L1NoYXJlZEJ1ZmZlclBPU0lYLmNwcAo9PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09Ci0tLSBXZWJDb3JlL3BsYXRmb3JtL3Bvc2l4L1NoYXJlZEJ1ZmZlclBPU0lYLmNwcAkocmV2
aXNpb24gMCkKKysrIFdlYkNvcmUvcGxhdGZvcm0vcG9zaXgvU2hhcmVkQnVmZmVyUE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oZmQpOworCisgICAgcmV0dXJuIHRvdGFsQnl0ZXNSZWFkID09IGJ5dGVzVG9SZWFkID8gcmVz
dWx0LnJlbGVhc2UoKSA6IDA7Cit9CisKK30gLy8gbmFtZXNwYWNlIFdlYkNvcmUK
</data>
<flag name="review"
          id="40754"
          type_id="1"
          status="-"
          setter="darin"
    />
    <flag name="commit-queue"
          id="40755"
          type_id="3"
          status="-"
          setter="darin"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>56471</attachid>
            <date>2010-05-19 00:41:47 -0700</date>
            <delta_ts>2010-05-20 18:19:50 -0700</delta_ts>
            <desc>patch</desc>
            <filename>patchFor39283_0</filename>
            <type>text/plain</type>
            <size>3371</size>
            <attacher name="Young Han Lee">joybro201</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA1OTc0OSkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTMgQEAKKzIwMTAtMDUtMTggIFlvdW5nIEhhbiBMZWUgIDxqb3licm9AY29tcGFu
eTEwMC5uZXQ+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAg
ICAgUG9ydCBTaGFyZWRCdWZmZXIgdG8gUE9TSVguCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJr
aXQub3JnL3Nob3dfYnVnLmNnaT9pZD0zOTI4MworCisgICAgICAgICogcGxhdGZvcm0vcG9zaXgv
U2hhcmVkQnVmZmVyUE9TSVguY3BwOiBBZGRlZC4KKyAgICAgICAgKFdlYkNvcmU6OlNoYXJlZEJ1
ZmZlcjo6Y3JlYXRlV2l0aENvbnRlb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