Issues

Issue #35 resolved

Fails to handle cmd actions and target names containing "%"

José Esteves
created an issue

Doit is not prepared to handle action strings containing the '%' character, apparently because it uses the action string as part of a format without first escaping any existing '%'. In the particular case of the dodo.py file attached, doit fails with a TaskError ("CmdAction Error creating command string"), and the traceback ends with "ValueError: incomplete format". (I first met this with a dodo.py file including 'mogrify -fuzz 1% -trim...' in an action and in the case the traceback ended with "ValueError: unsupported format character 't'").

Beiing aware of this, one can prevent it, for now, escaping '%' in dodo.py's action strings, but there a problem at least also when using '%' in target file names: e.g., the attached file succeeeds with 'actions': ['touch gonzo%%'], but the outcome of doit clean is a TypeError exception ("'NoneType' object is not iterable") — maybe in some cases it is used as part of a format and in others not?

Comments (6)

  1. José Esteves reporter

    Oops — indeed, I was wrong on both issues:

    1. I was forgetting that action strings are expected to be used as formats (in spite of having seen it before in the contexts you mentioned).

    2. I also misunderstood the clean issue. Actually the "'NoneType' object is not iterable" also occurs with any plain target file name without '%' — it was actually the result of invoking 'doit clean' without defining 'default_tasks'. Maybe in that case there should be either a silent outcome or some informative message on the lack of default actions instead of an unhandled exception? [that would be the only issue left in all this].

  2. eduardo schettino repo owner

    Actually the "'NoneType' object is not iterable" also occurs with any plain target file name without '%' — it was actually the result of invoking 'doit clean' without defining 'default_tasks'.

    I guess I fixed this 4 days ago :)

    https://bitbucket.org/schettino72/doit/commits/bc00d5801adc6eb69cb0ddafdeee4b67a8706f34

    can you check?

    the documentation for cmd-actions needs to be more clear that the python formatting is used... so anyway you can leave this ticket open.

  3. Log in to comment