OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer Root: /v/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-tools Date: 11-Oct-2005 18:11:25 Branch: HEAD Handle: 2005101117112400 Modified files: openpkg-tools/cmd dev.sh Log: prevent race condition where temporary .bashrc files overwrite each other when "openpkg dev" is launched simultaneously on multiple host using shared OPENPKG_WORK dir Summary: Revision Changes Path 1.62 +37 -36 openpkg-tools/cmd/dev.sh ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-tools/cmd/dev.sh ============================================================================ $ cvs diff -u -r1.61 -r1.62 dev.sh --- openpkg-tools/cmd/dev.sh 10 Oct 2005 10:00:51 -0000 1.61 +++ openpkg-tools/cmd/dev.sh 11 Oct 2005 16:11:24 -0000 1.62 @@ -1396,9 +1396,6 @@ [ ".$4" != . ] && openpkg_dev_tools "$4" [ ".$5" != . ] && openpkg_dev_src "$5" cd - - # self destruction - command rm ${OPENPKG_WORK}/.bashrc } bash () { @@ -1437,37 +1434,37 @@ T="${RV}" fi - # create a .bashrc - >.bashrc - dumpfunc -i bashrcprolog >>.bashrc - dumpfunc warn >>.bashrc - dumpfunc error >>.bashrc - dumpfunc makedir >>.bashrc - dumpfunc uwhich >>.bashrc - dumpfunc initmpx >>.bashrc - dumpfunc openpkgi >>.bashrc - dumpfunc openpkgE >>.bashrc - dumpfunc openpkgT >>.bashrc - dumpfunc openpkg >>.bashrc - dumpfunc rpmi >>.bashrc - dumpfunc rpmE >>.bashrc - dumpfunc rpmT >>.bashrc - dumpfunc rpm >>.bashrc - dumpfunc rpm2cpioi >>.bashrc - dumpfunc rpm2cpioE >>.bashrc - dumpfunc rpm2cpioT >>.bashrc - dumpfunc rpm2cpio >>.bashrc - dumpfunc openpkg_dev_package >>.bashrc - dumpfunc openpkg_dev_branch >>.bashrc - dumpfunc openpkg_dev_execute >>.bashrc - dumpfunc openpkg_dev_tools >>.bashrc - dumpfunc openpkg_dev_srcdir >>.bashrc - dumpfunc _arg2sh >>.bashrc - dumpfunc _env2sh >>.bashrc - dumpfunc _root >>.bashrc - dumpfunc root >>.bashrc - dumpfunc cvs >>.bashrc - dumpfunc -i bashrcepilog >>.bashrc + # create a unique .bashrc + >.bashrc${GUID} + dumpfunc -i bashrcprolog >>.bashrc${GUID} + dumpfunc warn >>.bashrc${GUID} + dumpfunc error >>.bashrc${GUID} + dumpfunc makedir >>.bashrc${GUID} + dumpfunc uwhich >>.bashrc${GUID} + dumpfunc initmpx >>.bashrc${GUID} + dumpfunc openpkgi >>.bashrc${GUID} + dumpfunc openpkgE >>.bashrc${GUID} + dumpfunc openpkgT >>.bashrc${GUID} + dumpfunc openpkg >>.bashrc${GUID} + dumpfunc rpmi >>.bashrc${GUID} + dumpfunc rpmE >>.bashrc${GUID} + dumpfunc rpmT >>.bashrc${GUID} + dumpfunc rpm >>.bashrc${GUID} + dumpfunc rpm2cpioi >>.bashrc${GUID} + dumpfunc rpm2cpioE >>.bashrc${GUID} + dumpfunc rpm2cpioT >>.bashrc${GUID} + dumpfunc rpm2cpio >>.bashrc${GUID} + dumpfunc openpkg_dev_package >>.bashrc${GUID} + dumpfunc openpkg_dev_branch >>.bashrc${GUID} + dumpfunc openpkg_dev_execute >>.bashrc${GUID} + dumpfunc openpkg_dev_tools >>.bashrc${GUID} + dumpfunc openpkg_dev_srcdir >>.bashrc${GUID} + dumpfunc _arg2sh >>.bashrc${GUID} + dumpfunc _env2sh >>.bashrc${GUID} + dumpfunc _root >>.bashrc${GUID} + dumpfunc root >>.bashrc${GUID} + dumpfunc cvs >>.bashrc${GUID} + dumpfunc -i bashrcepilog >>.bashrc${GUID} # make sure temporary area exists if [ ! -d ${OPENPKG_TEMP} ]; then @@ -1488,7 +1485,8 @@ # enter environment echo "++ entering OpenPKG development shell (mode: [1m${OPENPKG_MODE}[m)" - ${bash} --rcfile .bashrc + ${bash} --rcfile .bashrc${GUID} + command rm .bashrc${GUID} echo "++ leaving OpenPKG development shell" # remove workdir if it is completely empty @@ -2810,7 +2808,10 @@ shift # create a unique id for unique temporary files -GUID=".`date +%Y%m%d%H%M%S`-$$" +if [ ".$HOSTNAME" = . ]; then + HOSTNAME=`hostname` +fi +GUID=".`date +%Y%m%d%H%M%S`-${HOSTNAME}-$$" # make sure environment is set up [ ".${OPENPKG_INST}" = . ] && die "OPENPKG_INST is not set"; @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org