Uploaded image for project: 'Picard'
  1. Picard
  2. PICARD-2568

$cleanmulti() has no effect for hidden variables

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2.8.4
    • 2.8.0rc1, 2.8.3
    • Scripting
    • None

      The new $cleanmulti() function seemingly only works with multi-value tags but not with multi-value variables.

      $setmulti(_test,A; ; B)
      $cleanmulti(_test)
      $join(%_test%,+)
      

      The above file naming script demo outputs "A++B" in Picard 2.8.3 while it should output "A+B". If I remove the underscore prefixes from that example, the function works as intended.

      I discovered this because there were lots of unintended side effects (i.e. too many joiner spaces) in my naming script due to the new behaviour that empty values are no longer automatically discarded. (My script makes heavy use of multi-value variables for string concatenation with optional string segments.)

          [PICARD-2568] $cleanmulti() has no effect for hidden variables

          David Kellner added a comment -

          Thank you for the fast fix
          Interesting, I didn't notice that side effect because I had only tried to fix the occurrences in my file naming script so far, where it did not matter whether a new variable is hidden or not. But as I also have these patterns in my tagger scripts, I can not simply use visible tags there. So I had to resort to an ugly workaround until Picard 2.8.4:

          $setmulti(_foo,...)
          

          ... from the previous Picard version became ...

          $setmulti(foo,...)
          $cleanmulti(foo)
          $setmulti(_foo,%foo%)
          $unset(foo)
          

          But in the end I can live with the final adaption which should work in Picard 2.8.4:

          $setmulti(_foo,...)
          $cleanmulti(_foo)
          

          David Kellner added a comment - Thank you for the fast fix Interesting, I didn't notice that side effect because I had only tried to fix the occurrences in my file naming script so far, where it did not matter whether a new variable is hidden or not. But as I also have these patterns in my tagger scripts, I can not simply use visible tags there. So I had to resort to an ugly workaround until Picard 2.8.4: $setmulti(_foo,...) ... from the previous Picard version became ... $setmulti(foo,...) $cleanmulti(foo) $setmulti(_foo,%foo%) $unset(foo) But in the end I can live with the final adaption which should work in Picard 2.8.4: $setmulti(_foo,...) $cleanmulti(_foo)

          Thanks for reporting this. As a fun side effect 
          $cleanmulti(_test)
          instead adds a visible tag called _test with correct value.

          Fix in review

          Philipp Wolfer added a comment - Thanks for reporting this. As a fun side effect  $cleanmulti(_test) instead adds a visible tag called _test with correct value. Fix in review

          GitHub Bot added a comment -

          See code changes in pull request #2160 submitted by phw.

          GitHub Bot added a comment - See code changes in pull request #2160 submitted by phw .

            outsidecontext Philipp Wolfer
            kellnerd David Kellner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Version Package
                2.8.4