[wp-trac] [WordPress Trac] #35536: WP_Upgrader goes too far up when enumerating parent paths on a network share

WordPress Trac noreply at wordpress.org
Tue Jan 19 22:43:30 UTC 2016


#35536: WP_Upgrader goes too far up when enumerating parent paths on a network
share
-----------------------------+-----------------------------
 Reporter:  vfs_hobbes       |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Upgrade/Install  |    Version:  trunk
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 In `/wp-admin/includes/class-wp-upgrader.php`:

 When `is_vcs_checkout()` is walking up parent folders, the behavior of
 `dirname()` causes WordPress to check for folders that couldn't possibly
 exist.  For example, if "inetpub-share" was the name of a share on machine
 "myserver", the following folders might be searched for source control
 folders:

 * `\\myserver\inetpub-share\wwwroot\.git`
 * `\\myserver\inetpub-share\.git`
 * `\\myserver\.git`
 * `\.git`

 Note that the last two are not even subfolders of `"inetpub-share".`  That
 is, the search should stop at `"\\myserver\inetpub-share\.git"` because
 `"inetpub-share"` should be considered a top-level folder.

 Even more concerning is that checking for `"\\myserver\.git"` and
 `"\.git"` are very expensive operations in a network environment, which
 means that the upgrade logic takes a very long time or will time out.

 My proposed remedy is to change this line:
 {{{#!php
 if ( $context_dir == dirname( $context_dir ) )
 }}}

 to

 {{{#!php
 if ( $context_dir == dirname( $context_dir )
     || (substr($context_dir , 0, 2)=='\\\\' && strpos(dirname(
 $context_dir ), '\\', 2)===false)
 }}}


 Thoughts?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35536>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list