Date: Fri, 8 Jun 2018 09:26:38 +0000 (UTC) From: Mathieu Arnold <mat@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r471993 - head/Mk/Scripts Message-ID: <201806080926.w589QcKN044668@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mat Date: Fri Jun 8 09:26:38 2018 New Revision: 471993 URL: https://svnweb.freebsd.org/changeset/ports/471993 Log: SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options. Since files and arguments are strings passed the same way, programs can't properly determine which is which, and rely on dashes to determine what's what. A file named -f (touch -- -f) will not be deleted by the problematic code. It will instead be interpreted as a command line option, and rm will even report success. Using ./* will instead cause the glob to be expanded into ./-f, which no program will treat as an option. It is not possible to use `-f *` because -f only forces the next argument to be a directory, a later directory named -delete would mess things up. PR: 227109 Submitted by: mat Sponsored by: Absolight Modified: head/Mk/Scripts/smart_makepatch.sh (contents, props changed) Modified: head/Mk/Scripts/smart_makepatch.sh ============================================================================== --- head/Mk/Scripts/smart_makepatch.sh Fri Jun 8 09:26:34 2018 (r471992) +++ head/Mk/Scripts/smart_makepatch.sh Fri Jun 8 09:26:38 2018 (r471993) @@ -69,8 +69,8 @@ std_patch_filename() { patchdir_files_list() { if [ -d "${PATCHDIR}" ]; then (cd ${PATCHDIR} && \ - find * -type f -name "patch-*" -maxdepth 0 \ - 2>/dev/null | sed -e '/\.orig$/d' + find ./* -type f -name "patch-*" -maxdepth 0 \ + 2>/dev/null | sed -e 's,^\./,,; /\.orig$/d' ) fi; } @@ -186,7 +186,7 @@ regenerate_patches() { local ORIG local new_list new_list=$(cd "${PATCH_WRKSRC}" && \ - find -s * -type f -name '*.orig' 2>/dev/null) + find -s ./* -type f -name '*.orig' 2>/dev/null) (cd "${PATCH_WRKSRC}" && for F in ${new_list}; do ORIG=${F#./} NEW=${ORIG%.orig} @@ -216,8 +216,9 @@ stage_patches() { local P local name local patch_list - patch_list=$(cd ${REGENNED} && find * -name "patch-*" 2>/dev/null) + patch_list=$(cd ${REGENNED} && find ./* -name "patch-*" 2>/dev/null) for P in ${patch_list}; do + P=${P#./} name=$(get_patch_name ${P}) [ -e ${COMMENTS}/${P} ] && cat ${COMMENTS}/${P} \ >> ${DESTDIR}/${name}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806080926.w589QcKN044668>