Bug 237540 - Add early return for empty path in makeAllDirectories
Summary: Add early return for empty path in makeAllDirectories
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sihui Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-07 10:53 PST by Sihui Liu
Modified: 2022-03-08 00:07 PST (History)
6 users (show)

See Also:


Attachments
Patch (1.30 KB, patch)
2022-03-07 10:58 PST, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (2.54 KB, patch)
2022-03-07 11:19 PST, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (2.62 KB, patch)
2022-03-07 12:59 PST, Sihui Liu
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (2.64 KB, patch)
2022-03-07 14:00 PST, Sihui Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sihui Liu 2022-03-07 10:53:17 PST
...
Comment 1 Sihui Liu 2022-03-07 10:58:12 PST
Created attachment 454002 [details]
Patch
Comment 2 Sihui Liu 2022-03-07 10:59:15 PST
rdar://89901536
Comment 3 Chris Dumez 2022-03-07 11:08:40 PST
Comment on attachment 454002 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454002&action=review

> Source/WTF/ChangeLog:8
> +        * wtf/posix/FileSystemPOSIX.cpp:

Why no API test?
Comment 4 Sihui Liu 2022-03-07 11:19:35 PST
Created attachment 454005 [details]
Patch
Comment 5 Sihui Liu 2022-03-07 11:21:41 PST
(In reply to Chris Dumez from comment #3)
> Comment on attachment 454002 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=454002&action=review
> 
> > Source/WTF/ChangeLog:8
> > +        * wtf/posix/FileSystemPOSIX.cpp:
> 
> Why no API test?

Added
Comment 6 Chris Dumez 2022-03-07 12:31:34 PST
Comment on attachment 454005 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454005&action=review

> Source/WTF/wtf/posix/FileSystemPOSIX.cpp:280
> +    if (!length)

Why aren't we replacing the `fullPath.isNull()` early return above with a `fullPath.isEmpty()` instead? Is there a reason we want to do the access() call in between?
Comment 7 Sihui Liu 2022-03-07 12:55:26 PST
(In reply to Chris Dumez from comment #6)
> Comment on attachment 454005 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=454005&action=review
> 
> > Source/WTF/wtf/posix/FileSystemPOSIX.cpp:280
> > +    if (!length)
> 
> Why aren't we replacing the `fullPath.isNull()` early return above with a
> `fullPath.isEmpty()` instead? Is there a reason we want to do the access()
> call in between?

We can replace it there; this is safety net before accessing fullPath's content, so I added it here
Comment 8 Chris Dumez 2022-03-07 12:56:17 PST
Comment on attachment 454005 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454005&action=review

>>> Source/WTF/wtf/posix/FileSystemPOSIX.cpp:280
>>> +    if (!length)
>> 
>> Why aren't we replacing the `fullPath.isNull()` early return above with a `fullPath.isEmpty()` instead? Is there a reason we want to do the access() call in between?
> 
> We can replace it there; this is safety net before accessing fullPath's content, so I added it here

Ok, then I'd prefer we do the check earlier like I suggested. r=me with that change.
Comment 9 Sihui Liu 2022-03-07 12:59:09 PST
Created attachment 454018 [details]
Patch
Comment 10 Sihui Liu 2022-03-07 14:00:04 PST
Created attachment 454030 [details]
Patch
Comment 11 EWS 2022-03-08 00:07:21 PST
Committed r290978 (248156@main): <https://commits.webkit.org/248156@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454030 [details].