[wp-trac] [WordPress Trac] #54477: wp-cli vague: "Warning: Could not create directory."

WordPress Trac noreply at wordpress.org
Sun Apr 17 22:06:20 UTC 2022


#54477: wp-cli vague: "Warning: Could not create directory."
--------------------------------------+---------------------
 Reporter:  gunterer                  |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  6.0
Component:  Upgrade/Install           |     Version:  5.8
 Severity:  minor                     |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:
--------------------------------------+---------------------
Changes (by rsiddharth):

 * keywords:  needs-patch good-first-bug => good-first-bug has-patch


Comment:

 On `wp plugin install gutenberg`, `_unzip_file_ziparchive`, which gets
 indirectly called, has `$to` set to
 `/var/www/src/wp-content/upgrade/gutenberg.13.0.0-ox0GNI/`.

 And `$needed_dirs` just before the `mkdir` call looks like:

 {{{
 Array (
             [0] => /var/www/src/wp-content/upgrade/gutenberg.13.0.0-ox0GNI
             [1] => /var/www/src/wp-
 content/upgrade/gutenberg.13.0.0-ox0GNI/gutenberg
             [2] => /var/www/src/wp-
 content/upgrade/gutenberg.13.0.0-ox0GNI/gutenberg/build
             .
             .
             .
 )
 }}}

 When `$_dir` is `/var/www/src/wp-content/upgrade/gutenberg.13.0.0-ox0GNI`
 (first item in `$needed_dirs`), `substr( $_dir, strlen( $to ) )`
 returns an empty string. So, I think that's the issue.

 So, if we try to pass full directory to `WP_Error` instead of the base
 directory, it should fix the issue. I've attached the initial version
 the patch. See if it looks good.

 wp plugin install without the patch:

 {{{
 $ wp plugin install gutenberg
 Installing Gutenberg (13.0.0)
 Downloading installation package from
 https://downloads.wordpress.org/plugin/gutenberg.13.0.0.zip...
 The authenticity of gutenberg.13.0.0.zip could not be verified as no
 signature was found.
 Unpacking the package...
 Warning: Could not create directory.
 Warning: The 'gutenberg' plugin could not be found.
 Error: No plugins installed.
 }}}


 wp plugin install with the patch (54477.v202204171752.patch):

 {{{
 $ /var/wp-cli/bin/wp plugin install gutenberg
 Installing Gutenberg (13.0.0)
 Downloading installation package from
 https://downloads.wordpress.org/plugin/gutenberg.13.0.0.zip...
 Using cached file '/home/wp_php/.wp-
 cli/cache/plugin/gutenberg-13.0.0.zip'...
 The authenticity of gutenberg.13.0.0.zip could not be verified as no
 signature was found.
 Unpacking the package...
 Warning: Could not create directory. "/var/www/src/wp-
 content/upgrade/gutenberg.13.0.0-ox0GNI"
 Warning: The 'gutenberg' plugin could not be found.
 Error: No plugins installed.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54477#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list