#22 &rm can't handle filenames with '#'

closed-rejected
nobody
None
8
2009-07-06
2009-06-30
Thomas Dorner
No

When one uses gcov with the option --long-file-name it creates coverage files for includes like the following ones:
source1.cpp##include1.hpp.gcov
source1.cpp##include2.hpp.gcov
source2.cpp##include1.hpp.gcov
source2.cpp##include2.hpp.gcov
Trying to delete them using a
&rm -f $(wildcard **/*.gcov)
results in deleting the first source (source1.cpp) while leaving all following gcov-files behind.
This smells like the '#' is treated as a comment separator somewhere.

Discussion

  • Thomas Dorner
    Thomas Dorner
    2009-06-30

    • priority: 5 --> 8
     
  • Thomas Dorner
    Thomas Dorner
    2009-07-01

    A work-around for the specific symptom is using
    &rm -f $(subst #,\#,$(wildcard **/*.gcov))

     
    • status: open --> closed-rejected
     
  • Makepp is compatible with gmake here in that an unquoted #, no matter what precedes it, is a comment sign. The problem is that gmake is not consistent, in the sence that in your case the # gets passed to the Shell, which may have different rules for it, so that in many cases this would work.

    The &rm command in makepp on the other hand, gets parsed by makepp itself, which uses the same # semantics everywhere. As a workaround try the following:

    &rm -f $(perl '"')$(wildcard **/*.gcov)$(perl '"')