Download & Extend

Drush prints out HTML into terminal

Project:Drush
Version:All-versions-5.x-dev
Component:Make
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Noticed this while playing with #1268416: Destination directory .../drupal-7.9 already exists..

Drush up gives me output like this:

Checking available update data ...
Checked available update data for <em class="placeholder">Administration menu</em>.

It should look saner:

Checking available update data ...
Checked available update data for Administration menu.

Patch attached below.

Comments

#1

Patch attached.

AttachmentSize
clean_output-1354778-1.patch 916 bytes

#2

Status:needs review» needs work

Please provide more detail. Drupal7 tries not to print html in its errors. What code is doing thle placeholder?

#3

Status:needs work» needs review

Unfortunately it still does leak HTML if it's batching. Code that outputs HTML is here, %placeholder returns HTML as you can see here.

#4

Maybe we need to add strip_tags to $value in includes/batch.inc?

class DrushBatchContext extends ArrayObject {
  function offsetSet($name, $value) {
    if ($name == 'message') {
      drush_log($value, 'ok');
    }
    elseif ($name == 'error_message') {
      drush_set_error('DRUSH_BATCH_ERROR', $value);
    }
    parent::offsetSet($name, $value);
  }
}

#5

(Only add strip_tags to the parameter $value as passed to drush_log and drush_set_error; do not perturb parent:offsetSet.)

#6

Greg, you are right, this is better place to do it. Patch attached.

AttachmentSize
clean_output-1354778-6.patch 901 bytes

#7

Status:needs review» reviewed & tested by the community

Patch in #6 works :)

(Tested with drush up command).

#8

Version:All-versions-5.x-dev» All-versions-4.x-dev
Status:reviewed & tested by the community» needs work

committed to master. seems safe for 4.x but does not apply cleanly.

#9

Status:needs work» patch (to be ported)

Set status.

#10

Batching approach changed in #687724: 'multithreaded' updatedb for better memory consumption and there is no need for this patch for 4.x, since there are no issues there with HTML output.

#11

Version:All-versions-4.x-dev» All-versions-5.x-dev
Status:patch (to be ported)» fixed

Sounds right to me.

#12

Status:fixed» needs review

What if instead calling strip_tags() all the time, we used dt()?

AttachmentSize
dt.patch 1.35 KB

#13

Status:needs review» fixed

Not going to translate arbitrary strings. Drupal doesn't do that either.

#14

Component:Miscellaneous» Make
Status:fixed» needs review

The reason I bring that up is because this looks kind of silly.

AttachmentSize
strip_tagsALLTHETHINGS.patch 9.05 KB

#15

Ah, I understand. This is the same issue, but occurring in different places. I'm running into HTML being outputted when running through Drush Make's download factory. I think we have two options here...

1) drushmakehtml.patch
Stick a strip_tags() in the dt() function so that the <em> tags are removed.
2) checkplainInsteadOfEm.patch
Switch the dt() parameters to use @ instead of % so it uses check_plain() on the parameters instead of wrapping it in an em tag.

I think I prefer the #2 checkplainInsteadOfEm.patch approach more. Let's use @ instead of % for those dt() calls.

AttachmentSize
drushmakehtml.patch 691 bytes
checkplainInsteadOfEm.patch 8.83 KB

#16

Status:needs review» reviewed & tested by the community

I agree that #2 is preferable.

#17

Status:reviewed & tested by the community» fixed

Committed.

#18

Status:fixed» closed (fixed)

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

#19

Status:closed (fixed)» active

I still see this with Drush 5.1:

$ drush urol "administrator" --uid=2
Added the <em class="placeholder">administrator</em> role to uid <em class="placeholder">2</em>                                                                           [success]

#20

Status:active» closed (fixed)

Please use latest dev snapshot before reporting bugs. That might be fixed already. If still broken, feel free to reopen.

#21

My mistake, I did not see that this thread was related to Drush Make. This is an issue when using core commands. I'll open another issue.