From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 1D860383F844 for ; Tue, 12 May 2020 15:00:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1D860383F844 Received: by mail-wm1-x330.google.com with SMTP id m24so12532079wml.2 for ; Tue, 12 May 2020 08:00:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :mime-version:in-reply-to:content-language; bh=L9i8PaHsR5C9gHSOjkZMQWpZA6Aemm3B9GMgMl2joAk=; b=CC35aNGfh9d8xx3A7nOtkEheatYEXn2A8Ov6ZUnlgV29X9WuyNegZze3HvIMMbrSTI UEaw6mC0BwhRG8HRdSI6pgqVbwV/zluMkOzQwHuKZe/VPI/u2Y4093aJJdOlTQhifcdN V4x8JkpeybhUJMiud6kN36+0AY0c9zvT8x42dYCsUl9ZGLGzAtGQxLV4Zene46E96Rne 99Ix4rk0XlociYp6Wf0+XZfIXg9hBiHPW+cOdZ+omd2E6/gwXYHD8bEFZ0gUCFhkh+m9 7p+Hm+QXmx6mOauK4SBznWSWLg5eGttaH3zCddeW4mxED+IFphEox6N92kbjChegobmM tqOw== X-Gm-Message-State: AGi0PuZ5y/gXn4y/8CjEHa9rSULtbr0KhoNBkJQchOxvgwTzMWJDbFML qJLXzVEzwnMXuwuI3bHeEJYRjltW X-Google-Smtp-Source: APiQypITldo7KKOvq0ttIltyvkaZwWakudhchJ9kvXaJBAMAEr2WM56VkF5U4Gw689p74aNw0Ll06g== X-Received: by 2002:a1c:1902:: with SMTP id 2mr14980787wmz.178.1589295602752; Tue, 12 May 2020 08:00:02 -0700 (PDT) Received: from ?IPv6:2a02:8109:9f40:4576::6912? ([2a02:8109:9f40:4576::6912]) by smtp.gmail.com with ESMTPSA id g24sm24958896wrb.35.2020.05.12.08.00.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 May 2020 08:00:01 -0700 (PDT) Subject: Re: cygport development From: Federico Kircheis To: cygwin-apps@cygwin.com References: <3501279f-70c8-042c-2e60-2cd315277ae9@SystematicSw.ab.ca> <97e449ba-2c23-a110-ce95-850394b398cf@gmail.com> <871rvgwqbc.fsf@Rainer.invalid> <0d57d59b-638f-47ae-bdd0-eefda2e63f0c@gmail.com> Message-ID: <7ac8dfe8-b7ae-8d4d-03aa-a8fbd95a00ef@gmail.com> Date: Tue, 12 May 2020 16:59:43 +0200 MIME-Version: 1.0 In-Reply-To: <0d57d59b-638f-47ae-bdd0-eefda2e63f0c@gmail.com> Content-Type: multipart/mixed; boundary="------------CFD50558A94566375D6846D9" Content-Language: en-US X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-apps@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin package maintainer discussion list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2020 15:00:07 -0000 This is a multi-part message in MIME format. --------------CFD50558A94566375D6846D9 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 10/14/19 10:55 AM, Federico Kircheis wrote: > On 13/10/2019 18.41, Achim Gratz wrote: >> Federico Kircheis writes: >>> I've sent the patches the 14.07.19, unfortunately I still got no answer. >> >> The cygport maintainer is rather busy with non-Cygwin related work these >> days, I suppose.  Anyway, one of the questions I have is why you need >> these changes.  Most build systems do not actually work when they >> encounter a path with spaces if they use make under the hood, so fixing >> cygport to grok such path locations isn't getting you much further I'd >> think.  Can you explain? > > Yep. > > I've built some software in my windows home directory. > It contains a space. > I expected it to work. > > Instead of failing with a clear error message, the build process deleted > some unrelated files as it cd failed (or cd in the wrong directory, cant > remember right now). > > I believe it is unacceptable to delete unrelated data. > > Even if it stated that there is no intention to support path with > spaces, those scripts should fail fast and ideally with a clear error > message. > > I found it easier to quote the offending variables, as not only spaces > might cause issues. The merge request in the repository has been closed. I'm attaching the updated patch. --------------CFD50558A94566375D6846D9 Content-Type: text/x-patch; charset=UTF-8; name="path-with-spaces.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="path-with-spaces.patch" >From b927688b921988c9aa7dafe9fbde9b71f96aa5c3 Mon Sep 17 00:00:00 2001 From: Federico Kircheis Date: Tue, 2 Jul 2019 20:53:55 +0200 Subject: [PATCH 1/2] Add support for path with spaces Quote most variables --- bin/cygport.in | 74 +++++++++++++------------- lib/config_registry.cygpart | 8 +-- lib/src_compile.cygpart | 2 +- lib/src_fetch.cygpart | 30 +++++------ lib/src_prep.cygpart | 102 ++++++++++++++++++------------------ lib/syntax.cygpart | 10 ++-- 6 files changed, 113 insertions(+), 113 deletions(-) diff --git a/bin/cygport.in b/bin/cygport.in index 12909fe..0503676 100755 --- a/bin/cygport.in +++ b/bin/cygport.in @@ -42,7 +42,7 @@ declare -r _privsysconfdir=@sysconfdir@; ### import defined, pushd, popd -source ${_privlibdir}/syntax.cygpart +source "${_privlibdir}/syntax.cygpart" ### @@ -166,7 +166,7 @@ source ${_privlibdir}/help.cygpart # Accept --help and --version arguments without specifying a cygport file while true do - case ${1} in + case "${1}" in --help|-h|-\?) __show_help; exit 0; @@ -204,7 +204,7 @@ do esac done -declare -ar argv=(${0} ${@}) +declare -ar argv=(${0} "${@}") declare -ir argc=$(( $# + 1 )) # Show help if no commands are given @@ -222,7 +222,7 @@ fi ################################################################################ ### import check_prog and friends -source ${_privlibdir}/check_funcs.cygpart +source "${_privlibdir}/check_funcs.cygpart" ### # check now for all mandatory programs @@ -349,11 +349,11 @@ unset _autotools_CYGCLASS_ _autotools_CYGCLASS_stage1_ ################################################################################ unset NAME VERSION RELEASE -if [ -f ${argv[1]} ] +if [ -f "${argv[1]}" ] then - eval $(grep '^NAME=' ${argv[1]}) - eval $(grep '^VERSION=' ${argv[1]}) - eval $(grep '^RELEASE=' ${argv[1]}) + eval "$(grep '^NAME=' "${argv[1]}")" + eval "$(grep '^VERSION=' "${argv[1]}")" + eval "$(grep '^RELEASE=' "${argv[1]}")" fi if [ "${NAME+y}${VERSION+y}${RELEASE+y}" = "yyy" ] @@ -371,7 +371,7 @@ declare -r PN=${PF%%-[0-9]*}; declare NAME=${PN} declare -r PR=${PF##*-}; declare RELEASE=${PR} - PV=$(echo ${PF} | sed -e "s/${PN}\-\(.*\)\-${PR}$/\1/"); + PV=$(echo "${PF}" | sed -e "s/${PN}\-\(.*\)\-${PR}$/\1/"); declare VERSION=${PV} declare -r cygportfile=${PF}.cygport; fi @@ -395,7 +395,7 @@ _topdir=${argv[1]%/*}; if [ "x${_topdir}" = "x${argv[1]}" ] then - if [ -f ./${cygportfile} ] + if [ -f "./${cygportfile}" ] then _topdir=.; else @@ -406,7 +406,7 @@ fi declare -r top=$(cd ${_topdir}; pwd); unset _topdir; -if [ ! -e ${top}/${cygportfile} ] +if [ ! -e "${top}/${cygportfile}" ] then error "${cygportfile} not found."; fi @@ -438,7 +438,7 @@ done unset n VALUE ARCHES VAR ### load .cygport -source ${top}/${cygportfile} || error "could not read ${cygportfile}" +source "${top}/${cygportfile}" || error "could not read ${cygportfile}" ### case ${ARCH} in @@ -448,7 +448,7 @@ esac if defined CYGPORT_DEPEND then - if ! __version_at_least ${CYGPORT_DEPEND} ${_cygport_version} + if ! __version_at_least "${CYGPORT_DEPEND}" "${_cygport_version}" then error "This package requires cygport ${CYGPORT_DEPEND} or newer"; fi @@ -511,7 +511,7 @@ declare -r uploadlog="${logdir}/${PF}-upload.log"; for _src_uri in ${SRC_URI} do - if [ -f ${top}/${_src_uri} ] + if [ -f "${top}/${_src_uri}" ] then _src_orig_pkgs+=" ${_src_uri}"; continue; @@ -525,7 +525,7 @@ unset _src_uri; for _patch_uri in ${PATCH_URI} do - if [ -f ${top}/${_patch_uri} ] + if [ -f "${top}/${_patch_uri}" ] then _src_orig_patches+=" ${_patch_uri}"; continue; @@ -537,8 +537,8 @@ done readonly _src_orig_patches; unset _patch_uri; -declare -r cygwin_patchfile=${PF}.cygwin.patch; -declare -r src_patchfile=${PF}.src.patch; +declare -r cygwin_patchfile="${PF}.cygwin.patch"; +declare -r src_patchfile="${PF}.src.patch"; declare -ar pkg_name=(${PKG_NAMES:-${PN}}); declare -r pkg_count=${#pkg_name[*]}; @@ -586,21 +586,21 @@ do ;; compile|build|make) __stage Compiling; - __log_init ${compilelog}; + __log_init "${compilelog}"; __check_depends && \ - src_compile 2>&1 | tee -a ${compilelog}; + src_compile 2>&1 | tee -a "${compilelog}"; _status=${PIPESTATUS[0]}; ;; check|test) __stage Testing; - __log_init ${checklog}; - src_test 2>&1 | tee -a ${checklog}; + __log_init "${checklog}"; + src_test 2>&1 | tee -a "${checklog}"; _status=${PIPESTATUS[0]}; ;; inst*) __stage Installing; - __log_init ${installlog}; - (__prepinstalldirs && src_install && __src_postinst) 2>&1 | tee -a ${installlog}; + __log_init "${installlog}"; + (__prepinstalldirs && src_install && __src_postinst) 2>&1 | tee -a "${installlog}"; _status=${PIPESTATUS[0]}; ;; postinst*) @@ -632,8 +632,8 @@ do ;& package|pkg) __stage "Packaging${_pkg_tag:+ ${_pkg_tag%:} release}"; - __log_init ${pkglog}; - (__pkg_binpkg && __pkg_pkgcheck && __pkg_srcpkg && __pkg_dist ${_pkg_tag}) 2>&1 | tee -a ${pkglog}; + __log_init "${pkglog}"; + (__pkg_binpkg && __pkg_pkgcheck && __pkg_srcpkg && __pkg_dist "${_pkg_tag}") 2>&1 | tee -a "${pkglog}"; _status=${PIPESTATUS[0]}; ;; diff|mkdiff|mkpatch) @@ -642,14 +642,14 @@ do ;; upload|up) __stage Uploading; - __log_init ${uploadlog}; - (__pkg_upload full) 2>&1 | tee -a ${uploadlog}; + __log_init "${uploadlog}"; + (__pkg_upload full) 2>&1 | tee -a "${uploadlog}"; _status=${PIPESTATUS[0]}; ;; stage) __stage Staging; - __log_init ${uploadlog}; - (__pkg_upload stage) 2>&1 | tee -a ${uploadlog}; + __log_init "${uploadlog}"; + (__pkg_upload stage) 2>&1 | tee -a "${uploadlog}"; _status=${PIPESTATUS[0]}; ;; announce) @@ -666,15 +666,15 @@ do ;& almostall|all) __stage Preparing && __src_prep && \ - __log_init ${compilelog} && \ + __log_init "${compilelog}" && \ __check_depends && \ - __stage Compiling && src_compile 2>&1 | tee -a ${compilelog} && \ + __stage Compiling && src_compile 2>&1 | tee -a "${compilelog}" && \ test ${PIPESTATUS[0]} -eq 0 && \ - __log_init ${installlog} && \ - __stage Installing && (__prepinstalldirs && src_install && __src_postinst) 2>&1 | tee -a ${installlog} && \ + __log_init "${installlog}" && \ + __stage Installing && (__prepinstalldirs && src_install && __src_postinst) 2>&1 | tee -a "${installlog}" && \ test ${PIPESTATUS[0]} -eq 0 && \ - __log_init ${pkglog} && \ - __stage Packaging && (__pkg_binpkg && __pkg_pkgcheck && __pkg_srcpkg && __pkg_dist ${_pkg_tag}) 2>&1 | tee -a ${pkglog} && \ + __log_init "${pkglog}" && \ + __stage Packaging && (__pkg_binpkg && __pkg_pkgcheck && __pkg_srcpkg && __pkg_dist "${_pkg_tag}") 2>&1 | tee -a "${pkglog}" && \ test ${PIPESTATUS[0]} -eq 0 _status=$?; ;; @@ -691,9 +691,9 @@ do exit 1; ;; *) - if __check_function ${argv[${arg_n}]} && ! __check_function_ro ${argv[${arg_n}]} + if __check_function "${argv[${arg_n}]}" && ! __check_function_ro "${argv[${arg_n}]}" then - ${argv[${arg_n}]}; + "${argv[${arg_n}]}"; else error "unknown command ${argv[${arg_n}]}"; fi diff --git a/lib/config_registry.cygpart b/lib/config_registry.cygpart index 4d6c6d1..b7662d9 100644 --- a/lib/config_registry.cygpart +++ b/lib/config_registry.cygpart @@ -21,16 +21,16 @@ ################################################################################ __config_get() { - if [ -f ${configdir}/${1} ] + if [ -f "${configdir}/${1}" ] then - echo -n $(cat ${configdir}/${1}); + echo -n "$(cat "${configdir}/${1}")"; else echo -n "0"; fi } __config_equals() { - if [ -f ${configdir}/${1} ] && [ $(cat ${configdir}/${1}) = ${2} ] + if [ -f "${configdir}/${1}" ] && [ "$(cat "${configdir}/${1}")" = "${2}" ] then return 0; else @@ -39,7 +39,7 @@ __config_equals() { } __config_set() { - echo -n ${2} > ${configdir}/${1}; + echo -n "${2}" > "${configdir}/${1}"; } readonly -f __config_equals __config_get __config_set diff --git a/lib/src_compile.cygpart b/lib/src_compile.cygpart index 4944520..f1b9c37 100644 --- a/lib/src_compile.cygpart +++ b/lib/src_compile.cygpart @@ -49,7 +49,7 @@ lndirs() { fi check_prog_req lndir - lndir -silent ${fromdir} ${todir} || error "lndir failed" + lndir -silent "${fromdir}" "${todir}" || error "lndir failed" } #****C* Compiling/manifestize diff --git a/lib/src_fetch.cygpart b/lib/src_fetch.cygpart index a273045..942be53 100644 --- a/lib/src_fetch.cygpart +++ b/lib/src_fetch.cygpart @@ -72,36 +72,36 @@ fetch() { urifile=${urifile%\?*}; urifile=${urifile##*/}; - if defined __DL_ONLY_MISSING && defined DISTDIR && [ -f ${DISTDIR}/${urifile} ] + if defined __DL_ONLY_MISSING && defined DISTDIR && [ -f "${DISTDIR}/${urifile}" ] then inform "Using ${urifile} from DISTDIR" return 0 elif check_prog wget then - if wget --no-check-certificate -O ${urifile}.tmp ${uri} + if wget --no-check-certificate -O "${urifile}.tmp" "${uri}" then - mv -f ${urifile}.tmp ${urifile} + mv -f "${urifile}.tmp" "${urifile}" else - rm -f ${urifile}.tmp + rm -f "${urifile}.tmp" error "wget ${uri} failed" fi elif check_prog curl then - if curl -k --url ${uri} -o ${urifile}.tmp + if curl -k --url "${uri}" -o "${urifile}.tmp" then - mv -f ${urifile}.tmp ${urifile} + mv -f "${urifile}.tmp" "${urifile}" else - rm -f ${urifile}.tmp + rm -f "${urifile}.tmp" error "curl ${uri} failed" fi else error "Either wget or curl are required to fetch sources."; fi - if defined DISTDIR && [ -f ${urifile} ] + if defined DISTDIR && [ -f "${urifile}" ] then - [ -d ${DISTDIR} ] || mkdir -p ${DISTDIR} - mv ${urifile} ${DISTDIR}/ + [ -d "${DISTDIR}" ] || mkdir -p "${DISTDIR}" + mv "${urifile}" "${DISTDIR}/" fi } @@ -156,7 +156,7 @@ __src_fetch() { done # the RCS_fetch functions change PWD - cd ${top}; + cd "${top}"; for uri in ${SRC_URI} ${PATCH_URI} do @@ -165,11 +165,11 @@ __src_fetch() { continue fi case ${uri%%//*} in - mirror:) __mirror_fetch ${uri} ;; - http:|https:|ftp:) fetch ${uri} || error "Download ${uri##*/} failed" ;; - file:) [ -f ${uri#file://} ] || error "${uri##*/}: does not exist" ;; + mirror:) __mirror_fetch "${uri}" ;; + http:|https:|ftp:) fetch "${uri}" || error "Download ${uri##*/} failed" ;; + file:) [ -f "${uri#file://}" ] || error "${uri##*/}: does not exist" ;; *:) error "Unsupported download protocol ${uri%%//*}" ;; - */*) [ -f ${uri#file://} ] || error "${uri##*/}: does not exist" ;; + */*) [ -f "${uri#file://}" ] || error "${uri##*/}: does not exist" ;; ${uri}) ;; # file in working directory *) error "Invalid download URI ${uri}" ;; esac diff --git a/lib/src_prep.cygpart b/lib/src_prep.cygpart index 80ba8d5..52440ac 100644 --- a/lib/src_prep.cygpart +++ b/lib/src_prep.cygpart @@ -50,14 +50,14 @@ __srpm_extract() { if check_prog rpm2tar then - rpm2tar ${rpmpath}; - tar xf ${tarfile}; - srcfiles="$(tar tf ${tarfile})"; + rpm2tar "${rpmpath}"; + tar xf "${tarfile}"; + srcfiles="$(tar tf "${tarfile}")"; elif check_prog rpm2cpio cpio then - rpm2cpio ${rpmpath} > ${cpiofile}; - cpio -i --quiet < ${cpiofile}; - srcfiles="$(cpio -t --quiet < ${cpiofile})"; + rpm2cpio "${rpmpath}" > "${cpiofile}"; + cpio -i --quiet < "${cpiofile}"; + srcfiles="$(cpio -t --quiet < "${cpiofile}")"; else error "${rpmfile} requires rpm2targz or rpm to unpack"; fi @@ -81,7 +81,7 @@ unpack() { do unpack_file_name=${unpack_file_path##*/}; - if [ ! -f ${unpack_file_path} ] + if [ ! -f "${unpack_file_path}" ] then error "Cannot find source package ${unpack_file_name}"; fi @@ -151,12 +151,12 @@ unpack() { if defined unpack_out then - if ! ${unpack_cmd} ${unpack_file_path} > ${unpack_out} + if ! ${unpack_cmd} "${unpack_file_path}" > "${unpack_out}" then error "${unpack_cmd} ${unpack_file_name} failed"; fi else - if ! ${unpack_cmd} ${unpack_file_path} + if ! ${unpack_cmd} "${unpack_file_path}" then error "${unpack_cmd} ${unpack_file_name} failed"; fi @@ -181,7 +181,7 @@ __gpg_verify() { return 0; fi - if [ -f ${_file}.${_sigext} ] + if [ -f "${_file}.${_sigext}" ] then inform "${_filetype} signature follows:"; gpg --verify ${_file}.${_sigext} ${_file} || true; @@ -189,8 +189,8 @@ __gpg_verify() { } __mkdirs() { - cd ${top}; - mkdir -p ${srcdir} ${origsrcdir} ${B} ${D} ${T} ${configdir} ${logdir} ${distdir} ${patchdir} ${spkgdir}; + cd "${top}"; + mkdir -p "${srcdir}" "${origsrcdir}" "${B}" "${D}" "${T}" "${configdir}" "${logdir}" "${distdir}" "${patchdir}" "${spkgdir}"; } cygpatch() { @@ -286,7 +286,7 @@ __src_prep() { local tar_patch; local n=1; - cd ${top}; + cd "${top}"; __mkdirs; @@ -294,17 +294,17 @@ __src_prep() { # wasn't upgraded since prep __config_set cygport_version ${_cygport_version} - if [ -f ${top}/${cygportfile}.sig ] + if [ -f "${top}/${cygportfile}.sig" ] then - __gpg_verify ${top}/${cygportfile} "CYGPORT SCRIPT"; + __gpg_verify "${top}/${cygportfile}" "CYGPORT SCRIPT"; fi for src_pkg in ${_src_orig_pkgs} do - if [ -f ${DISTDIR}/${src_pkg} -a ! -f ${top}/${src_pkg} ] + if [ -f ${DISTDIR}/${src_pkg} -a ! -f "${top}/${src_pkg}" ] then src_pkg=${DISTDIR}/${src_pkg}; - elif [ -f ${top}/${src_pkg##*/} -a ! -f ${top}/${src_pkg} ] + elif [ -f "${top}"/${src_pkg##*/} -a ! -f "${top}/${src_pkg}" ] then src_pkg=${src_pkg##*/}; fi @@ -319,10 +319,10 @@ __src_prep() { for src_patch in ${_src_orig_patches} do - if [ -f ${DISTDIR}/${src_patch} -a ! -f ${top}/${src_patch} ] + if [ -f "${DISTDIR}/${src_patch}" -a ! -f "${top}/${src_patch}" ] then src_patch=${DISTDIR}/${src_patch}; - elif [ -f ${top}/${src_patch##*/} -a ! -f ${src_patch} ] + elif [ -f "${top}"/${src_patch##*/} -a ! -f "${src_patch}" ] then src_patch=${src_patch##*/}; fi @@ -335,30 +335,30 @@ __src_prep() { done done - if [ -f ${top}/${cygwin_patchfile}.sig ] + if [ -f "${top}/${cygwin_patchfile}.sig" ] then __gpg_verify ${top}/${cygwin_patchfile} "CYGWIN PATCH"; fi - if [ -f ${top}/${src_patchfile}.sig ] + if [ -f "${top}/${src_patchfile}.sig" ] then - __gpg_verify ${top}/${src_patchfile} "SOURCE PATCH"; + __gpg_verify "${top}/${src_patchfile}" "SOURCE PATCH"; fi - cd ${origsrcdir}; + cd "${origsrcdir}"; for src_pkg in ${_src_orig_pkgs} do - if [ -f ${DISTDIR}/${src_pkg} -a ! -f ${top}/${src_pkg} ] + if [ -f "${DISTDIR}/${src_pkg}" -a ! -f "${top}/${src_pkg}" ] then src_pkg=${DISTDIR}/${src_pkg}; - elif [ -f ${top}/${src_pkg##*/} -a ! -f ${top}/${src_pkg} ] + elif [ -f "${top}"/${src_pkg##*/} -a ! -f "${top}/${src_pkg}" ] then - src_pkg=${top}/${src_pkg##*/}; + src_pkg="${top}"/${src_pkg##*/}; else - src_pkg=${top}/${src_pkg}; + src_pkg="${top}/${src_pkg}"; fi - unpack ${src_pkg}; + unpack "${src_pkg}"; done #****v* Preparation/SRC_DIR @@ -370,14 +370,14 @@ __src_prep() { # files are unpacked, use SRC_DIR=".". #**** - if [ ! -d ${origsrcdir}/${SRC_DIR} ] + if [ ! -d "${origsrcdir}/${SRC_DIR}" ] then error "SRC_DIR is not correctly defined" fi # cd will fail if not executable (e.g. dot2tex) - chmod +x ${origsrcdir}/${SRC_DIR}; - cd ${origsrcdir}/${SRC_DIR}; + chmod +x "${origsrcdir}/${SRC_DIR}"; + cd "${origsrcdir}/${SRC_DIR}"; #****v* Preparation/DISTCLEANFILES # DESCRIPTION @@ -389,7 +389,7 @@ __src_prep() { if defined DISTCLEANFILES then inform "Removing DISTCLEANFILES..." - rm -f ${DISTCLEANFILES} + rm -f "${DISTCLEANFILES}" fi @@ -404,33 +404,33 @@ __src_prep() { if __check_function src_unpack_hook then __check_unstable src_unpack_hook; - cd ${origsrcdir}/${SRC_DIR}; + cd "${origsrcdir}/${SRC_DIR}"; fi for src_patch in ${_src_orig_patches} do - if [ -f ${DISTDIR}/${src_patch} -a ! -f ${top}/${src_patch} ] + if [ -f "${DISTDIR}/${src_patch}" -a ! -f "${top}/${src_patch}" ] then src_patch=${DISTDIR}/${src_patch}; - elif [ -f ${top}/${src_patch##*/} -a ! -f ${top}/${src_patch} ] + elif [ -f "${top}"/${src_patch##*/} -a ! -f "${top}/${src_patch}" ] then - src_patch=${top}/${src_patch##*/}; + src_patch="${top}"/${src_patch##*/}; else - src_patch=${top}/${src_patch}; + src_patch="${top}/${src_patch}"; fi case ${src_patch} in *.tar.gz|*.tgz|*.tar.bz2|*.tbz2) - pushd ${T}; - unpack ${src_patch}; + pushd "${T}"; + unpack "${src_patch}"; popd; - for tar_patch in $(tar tf ${src_patch} | sort | grep -E '(diff|patch)$') + for tar_patch in $(tar tf "${src_patch}" | sort | grep -E '(diff|patch)$') do - cygpatch ${T}/${tar_patch}; + cygpatch "${T}/${tar_patch}"; done ;; *) - cygpatch ${src_patch}; + cygpatch "${src_patch}"; ;; esac done @@ -446,26 +446,26 @@ __src_prep() { if __check_function src_patch_hook then __check_unstable src_patch_hook; - cd ${origsrcdir}/${SRC_DIR}; + cd "${origsrcdir}/${SRC_DIR}"; fi __step "Preparing working source directory"; - rsync -aq --delete-before ${origsrcdir}/ ${srcdir}/; + rsync -aq --delete-before "${origsrcdir}/" "${srcdir}/"; - mkdir -p ${C}; - ln -sfn ${C} ${workdir}/CYGWIN-PATCHES; + mkdir -p "${C}"; + ln -sfn "${C}" "${workdir}/CYGWIN-PATCHES"; - cd ${S}; + cd "${S}"; - if [ -f ${top}/${cygwin_patchfile} ] + if [ -f "${top}/${cygwin_patchfile}" ] then - cygpatch ${top}/${cygwin_patchfile}; + cygpatch "${top}/${cygwin_patchfile}"; fi - if [ -f ${top}/${src_patchfile} ] + if [ -f "${top}/${src_patchfile}" ] then - cygpatch ${top}/${src_patchfile}; + cygpatch "${top}/${src_patchfile}"; fi } diff --git a/lib/syntax.cygpart b/lib/syntax.cygpart index 9d3bcb4..37acfe7 100644 --- a/lib/syntax.cygpart +++ b/lib/syntax.cygpart @@ -150,19 +150,19 @@ __step() { } __log_init() { - local log=${1} - rm -f ${log} + local log="${1}" + rm -f "${log}" - echo -e cygport ${_cygport_version} '\n' >> ${log} + echo -e cygport "${_cygport_version}" '\n' >> "${log}" for var in PF S B D C T CBUILD CHOST CTARGET CC CFLAGS CPPFLAGS CXX CXXFLAGS \ F77 FFLAGS FC FCFLAGS GOC GOFLAGS OBJC OBJCFLAGS \ OBJCXX OBJCXXFLAGS LDFLAGS LIBS MAKEOPTS do - echo ${var} = ${!var} >> ${log} + echo ${var} = ${!var} >> "${log}" done - echo -e '\n' >> ${log} + echo -e '\n' >> "${log}" } #****** Syntax/boolean -- 2.26.2 >From feeaccd68eda66f8ad65ff48417347125ced9034 Mon Sep 17 00:00:00 2001 From: Federico Kircheis Date: Tue, 2 Jul 2019 21:02:36 +0200 Subject: [PATCH 2/2] Exit in case `cd` fails --- lib/src_fetch.cygpart | 2 +- lib/src_prep.cygpart | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/src_fetch.cygpart b/lib/src_fetch.cygpart index 942be53..21c9d7a 100644 --- a/lib/src_fetch.cygpart +++ b/lib/src_fetch.cygpart @@ -156,7 +156,7 @@ __src_fetch() { done # the RCS_fetch functions change PWD - cd "${top}"; + cd "${top}" || error "Unable to cd to ${top}" for uri in ${SRC_URI} ${PATCH_URI} do diff --git a/lib/src_prep.cygpart b/lib/src_prep.cygpart index 52440ac..eae0b95 100644 --- a/lib/src_prep.cygpart +++ b/lib/src_prep.cygpart @@ -189,7 +189,7 @@ __gpg_verify() { } __mkdirs() { - cd "${top}"; + cd "${top}" || error "Unable to cd to ${top}"; mkdir -p "${srcdir}" "${origsrcdir}" "${B}" "${D}" "${T}" "${configdir}" "${logdir}" "${distdir}" "${patchdir}" "${spkgdir}"; } @@ -286,7 +286,7 @@ __src_prep() { local tar_patch; local n=1; - cd "${top}"; + cd "${top}" || error "Unable to cd to ${top}"; __mkdirs; @@ -345,7 +345,7 @@ __src_prep() { __gpg_verify "${top}/${src_patchfile}" "SOURCE PATCH"; fi - cd "${origsrcdir}"; + cd "${origsrcdir}" || error "Unable to cd to ${origsrcdir}"; for src_pkg in ${_src_orig_pkgs} do @@ -377,7 +377,7 @@ __src_prep() { # cd will fail if not executable (e.g. dot2tex) chmod +x "${origsrcdir}/${SRC_DIR}"; - cd "${origsrcdir}/${SRC_DIR}"; + cd "${origsrcdir}/${SRC_DIR}" || error "Unable to cd to ${origsrcdir}/${SRC_DIR}"; #****v* Preparation/DISTCLEANFILES # DESCRIPTION @@ -404,7 +404,7 @@ __src_prep() { if __check_function src_unpack_hook then __check_unstable src_unpack_hook; - cd "${origsrcdir}/${SRC_DIR}"; + cd "${origsrcdir}/${SRC_DIR}" | error "Unable to cd to ${origsrcdir}/${SRC_DIR}"; fi for src_patch in ${_src_orig_patches} @@ -446,7 +446,7 @@ __src_prep() { if __check_function src_patch_hook then __check_unstable src_patch_hook; - cd "${origsrcdir}/${SRC_DIR}"; + cd "${origsrcdir}/${SRC_DIR}" || error "Unable to cd to ${origsrcdir}/${SRC_DIR}"; fi __step "Preparing working source directory"; @@ -456,7 +456,7 @@ __src_prep() { mkdir -p "${C}"; ln -sfn "${C}" "${workdir}/CYGWIN-PATCHES"; - cd "${S}"; + cd "${S}" || error "Unable to cd to ${S}"; if [ -f "${top}/${cygwin_patchfile}" ] then -- 2.26.2 --------------CFD50558A94566375D6846D9--