OSDN Git Service

[BUG FIX] Inappropriate operations could be attempted on the temporal database by...
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Sat, 19 Jan 2013 12:00:04 +0000 (21:00 +0900)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Sat, 19 Jan 2013 12:00:04 +0000 (21:00 +0900)
modified:   portsreinstall
modified:   portsreinstall.8

portsreinstall
portsreinstall.8

index bd3568a..679353f 100755 (executable)
@@ -10,7 +10,7 @@
 # ================================================
 
 APPNAME=`basename "$0"`
-MYVERSION=2.2.2+toward_2.2.3_20130119200821
+MYVERSION=2.2.2+toward_2.2.3_20130119205828
 
 PREFIX=${PREFIX:-/usr/local}
 CONFFILE=${PREFIX}/etc/${APPNAME}.conf
@@ -591,15 +591,16 @@ str_escape_regexp ()
 
 create_backup_pkg ()
 {
-       local pkgname dstdir backup_pkg
+       local pkgname dstdir pkgname_ptn backup_pkg
        pkgname=$1
        dstdir=$2
        rm -rf "${TMPDIR}"/package.tmp
        mkdir "${TMPDIR}"/package.tmp
        if ( cd "${TMPDIR}"/package.tmp && pkg_create_b "$pkgname" )
        then
+               pkgname_ptn=`str_escape_regexp "$pkgname"`
                backup_pkg=`ls "${TMPDIR}"/package.tmp | \
-                       grep -m 1 -E "^`str_escape_regexp \"$pkgname\"`\.(txz|tbz|tgz|tar)$"` || :
+                       grep -m 1 -E "^${pkgname_ptn}\.(txz|tbz|tgz|tar)$"` || :
        fi
        if [ -z "$backup_pkg" ]
        then
@@ -961,7 +962,7 @@ inspect_dependencies ()
                        env ${MAKE_ENVS} make config-conditional ${MAKE_ARGS}
                        pkg=`pkg_info_qO "$origin"`
                        [ -z "$pkg" ] || echo $pkg > $target_dir/installed_version
-                       pkg_new=`(cd "${PORTSDIR}/$origin" && env ${MAKE_ENVS} make package-name ${MAKE_ARGS})`
+                       pkg_new=`env ${MAKE_ENVS} make package-name ${MAKE_ARGS}`
                        pkgtag=$pkg
                        [ -n "$pkgtag" ] || pkgtag=$pkg_new
                        if [ -z "$pkgtag" ]
@@ -1178,7 +1179,7 @@ echo
 [ "$load_pkgtoolsconf" = undef -o ! -e "${DBDIR}/COMPLETE_IMPORT_PKGTOOLS_CONF" ] || echo "WARNING: -p, -P or -Q option is specified but ignored by following the previous settings." >&2
 
 # Check whether the temporal database is newer than the ports tree
-if [ "${PORTS_INDEX_DB}" -nt "${DBDIR}"/MYVERSION ]
+if [ `id -u` -eq 0 -a "${PORTS_INDEX_DB}" -nt "${DBDIR}"/MYVERSION ]
 then
        if [ $supress_obsolete_db_clean = no ]
        then
@@ -1298,7 +1299,8 @@ if [ -d "${DBDIR}" ]
 then
        DBVERSION=`cat "${DBDIR}"/MYVERSION 2> /dev/null || :`
        # Reserved for compatibility check
-else
+elif [ `id -u` -eq 0 ]
+then
        mkdir -p "${DBDIR}"
        echo ${MYVERSION} > ${DBDIR}/MYVERSION
 fi
@@ -1381,7 +1383,7 @@ save)
        srcnode=`basename "${DBDIR}"`
        savefile=`realpath "$savedir"`/${APPNAME}_`date +%Y%m%d_%H%M%S`.tar.gz
        echo "Starting to save the temporal database as [$savefile]..."
-       ( cd "$srcdir" && tar czf "$savefile" "$srcnode" )
+       tar czf "$savefile" -C "$srcdir" "$srcnode"
        echo "Done"
        exit
        ;;
@@ -1396,7 +1398,7 @@ load)
        srcdir=`dirname "${DBDIR}"`
        srcnode=`basename "${DBDIR}"`
        [ -d "$srcdir" ] || mkdir -p "$srcdir"
-       ( cd "$srcdir" && tar xzf "$loadfile" )
+       tar xzf "$loadfile" -C "$srcdir"
        echo "Done"
        exit
        ;;
index 60fd59f..ae8ccfc 100644 (file)
@@ -301,6 +301,8 @@ Configuration file of portupgrade(1).
 [MISC] Line feeds of the help and information messages are improved.
 
 [BUG FIX] Meaningless warnings at the end of leave ports are suppressed.
+
+[BUG FIX] Inappropriate operations could be attempted on the temporal database by non-superuser privilege.
 .TP
 2.2.2 (03 January 2013)
 [BUG FIX] Commands \fBok add\fR and \fBok del\fR failed if no port has reinstalled in the latest do/redo process.