Bug 199550

Summary: Mk/bsd.port.mk: COPYTREE_* escaping glob/shell patterns
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Closed Feedback Timeout    
Severity: Affects Only Me CC: ports-bugs
Priority: --- Keywords: needs-patch
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
v0 none

Description Jan Beich freebsd_committer freebsd_triage 2015-04-19 19:34:06 UTC
Created attachment 155744 [details]
v0

Trying to optimize find(1) primaries in attachment 149511 [details] 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' -- "'*'"
  *
Comment 1 Mathieu Arnold freebsd_committer freebsd_triage 2016-04-13 11:32:26 UTC
Is this still a problem ?
If it is, could you make sure the patch is still ok, and ask for an exp-run ?
Comment 2 Jan Beich freebsd_committer freebsd_triage 2016-04-13 12:09:27 UTC
v0 has a serious regression that affects many ports but I don't remember anymore. Also, ENOTIME.