When trying to upload a module, I got the following error message:

  • File Transfer failed, reason: Unable to remove to file /var/www/drupal/modules/webform/.gitignore

It should say 'Unable to remove THE file'.

The offending files are below:

/var/www/drupal/core/lib/Drupal/Core/FileTransfer/FTPExtension.php:
   75    protected function removeFileJailed($destination) {
   76      if (!ftp_delete($this->connection, $destination)) {
   77:       throw new FileTransferException("Unable to remove to file @file", NULL, array('@file' => $destination));
   78      }
   79    }

/var/www/drupal/core/modules/system/src/Tests/FileTransfer/TestFileTransfer.php:
   47    function removeFileJailed($destination) {
   48      if (!ftp_delete($this->connection, $item)) {
   49:       throw new FileTransferException('Unable to remove to file @file.', NULL, array('@file' => $item));
   50      }
   51    }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

CatsFromStonehenge created an issue. See original summary.

mayank_kaushik’s picture

Here is attached patch for Grammar issue with FTP error message.

mayank_kaushik’s picture

Status: Active » Needs review
FileSize
1.36 KB

RE-attaching the patch with status update.

cilefen’s picture

Version: 8.2.x-dev » 8.3.x-dev
Issue tags: -error message, -ftp

Read the issue tag guidelines: https://www.drupal.org/node/1023102

mayank_kaushik’s picture

Issue tag updated. As version Changed to 8.3.x-dev for issue, Updated has been attached. In 8.3.x-dev version TestFileTransfer.php has been removed.

manojbisht_drupal’s picture

Hi,

Please find attached patch, It has been generated with respect to 8.4.x, as new commit will be related to this branch.

Thanks,
Manoj Bisht

prash_98’s picture

Version: 8.3.x-dev » 8.4.x-dev
Status: Needs review » Reviewed & tested by the community

The required changes happen and also the patch applies well with 8.4.x.
So changing to RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

It looks as if this was intended and not a mistake - ie it is trying to say the "to" file - as in destination. We also have the following exception messages in the same class.

throw new FileTransferException("Unable to change to directory @directory", NULL, ['@directory' => $directory]);
throw new FileTransferException("Unable to remove to directory @directory", NULL, ['@directory' => $directory]);

In all cases it looks like the error would be improved by changing the to to a the because the directory / file is also specified in the message.

Pavan B S’s picture

Status: Needs work » Needs review
FileSize
2.34 KB
1.06 KB

Applying the patch, please review

joe_carvajal’s picture

Status: Needs review » Reviewed & tested by the community

It seems to be OK according to the comment #8.

joe_carvajal’s picture

Issue tags: +DevDaysSeville

Update issue with the event tag.

cilefen’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/lib/Drupal/Core/FileTransfer/FTPExtension.php
@@ -45,7 +45,7 @@ protected function createDirectoryJailed($directory) {
-      throw new FileTransferException("Unable to change to directory @directory", NULL, ['@directory' => $directory]);
+      throw new FileTransferException("Unable to change the directory @directory", NULL, ['@directory' => $directory]);

Isn't this one actually "change to"?

Haza’s picture

I agree with that. I think the "to directory" should stay the same, and only the one (the file related error) might be changed.

ajmantis’s picture

Assigned: Unassigned » ajmantis

I will work on this.

ajmantis’s picture

Status: Needs work » Needs review
FileSize
1.4 KB
1.2 KB

I have make changes according to #13

darius.restivan’s picture

Status: Needs review » Reviewed & tested by the community

Fixed

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Re #12 and #13.... nope it is not "change to" here "to" means destination in same way it is being used in the file example.

I'm wrong if (!ftp_chdir($this->connection, $directory)) {

alexpott’s picture

But still we have this later...

    if (!ftp_rmdir($this->connection, $directory)) {
      throw new FileTransferException("Unable to remove to directory @directory", NULL, ['@directory' => $directory]);
    }
alexpott’s picture

Also for

throw new FileTransferException("Unable to change to directory @directory", NULL, ['@directory' => $directory]);

To actually be clear we should change it to:

throw new FileTransferException("Unable to change current directory to @directory", NULL, ['@directory' => $directory]);
joe_carvajal’s picture

OK! Thank you Alexpott, I'll do it then.

joe_carvajal’s picture

joe_carvajal’s picture

Status: Needs work » Needs review
Dinesh18’s picture

Reviewed the patch mentioned in comment #21 and it is working as expected.

joe_carvajal’s picture

So, should we change the issue to RTBC?

sahilsharma011’s picture

@joe_carvajal I reviewed the patch mentioned in #21 on 8.4.x branch. It works as expected. It can be changed to RTBC as it fixes all the grammar issues for aforementioned error messages.

juanjesustrigo’s picture

Status: Needs review » Reviewed & tested by the community

According to comments #23 and #25 change issue to RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed a908c19 and pushed to 8.4.x. Thanks!

8.3.x is now in a freeze I'm not sure we should backport to 8.3.1 because something in contrib or custom might be testing against these exception messages and it is not worth breaking that in a patch release.

  • alexpott committed a908c19 on 8.4.x
    Issue #2859029 by maya96, ajmantis, Pavan B S, joe_carvajal,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.