Bug 199550 - Mk/bsd.port.mk: COPYTREE_* escaping glob/shell patterns
Summary: Mk/bsd.port.mk: COPYTREE_* escaping glob/shell patterns
Status: Closed Feedback Timeout
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Port Management Team
URL:
Keywords: needs-patch
Depends on:
Blocks:
 
Reported: 2015-04-19 19:34 UTC by Jan Beich
Modified: 2016-09-08 14:14 UTC (History)
1 user (show)

See Also:


Attachments
v0 (1.32 KB, patch)
2015-04-19 19:34 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.