[Bug 199550] Mk/bsd.port.mk: COPYTREE_* escaping glob/shell patterns

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Apr 19 19:34:06 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199550

            Bug ID: 199550
           Summary: Mk/bsd.port.mk: COPYTREE_* escaping glob/shell
                    patterns
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Ports Framework
          Assignee: portmgr at FreeBSD.org
          Reporter: jbeich at FreeBSD.org
                CC: freebsd-ports-bugs at FreeBSD.org

Created attachment 155744
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=155744&action=edit
v0

Trying to optimize find(1) primaries in attachment 149511 I've noticed the 3rd
argument is always expanded. This makes it harder to exclude files based on
regex or shell globs. One could try to escape meta characters with \
(backslash) but it doesn't work because \ isn't stripped in the output.

  post-install:
          (cd ${WRKSRC}/manual && ${COPYTREE_SHARE} \
                  . ${STAGEDIR}${DOCSDIR} "! -name Makefile\*")

Here's the illustration:

  $ sh -c 'cd /var/empty; echo $0' -- "*"
  *

  $ sh -c 'cd /bin; echo $0' -- "*"
  [ cat chflags ...

  $ sh -c 'cd /bin; echo $0' -- "\*"
  \*

  $ sh -c 'cd /bin; echo $0' -- "\\*"
  \*

  $ sh -c 'cd /bin; echo $0' -- "'*'"
  '*'

One way to strip quoting is via `eval' builtin:

  $ sh -c 'cd /bin; eval echo $0' -- "\*"
  *

  $ sh -c 'cd /bin; eval echo $0' -- "'*'"
  *

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the freebsd-ports-bugs mailing list