[MacPorts] #8401: RFE: macports installer package postflight tweak

MacPorts trac at macosforge.org
Sun Nov 18 12:18:44 PST 2007


#8401: RFE: macports installer package postflight tweak
-------------------------------+--------------------------------------------
  Reporter:  asigel at apple.com  |       Owner:  macports-tickets at lists.macosforge.org
      Type:  enhancement       |      Status:  new                                  
  Priority:  Normal            |   Milestone:  MacPorts base bugs                   
 Component:  base              |     Version:  1.2                                  
Resolution:                    |    Keywords:                                       
-------------------------------+--------------------------------------------
Old description:

> mktemp is used in the postflight script of the installer.  the return of
> the mktemp is not checked so it may not have succeeded.  the subsequent
> write to can fail when it doesnt have to.
>
> Instead of doing this:
>
> BINPATH=/opt/local/bin
> SBINPATH=/opt/local/sbin
> TMP=`/usr/bin/mktemp /tmp/dp.$$`
> $SHELL -l <<EOF > $TMP
>     /usr/bin/printenv PATH
>     exit
> EOF
>
> if grep $BINPATH $TMP >/dev/null 2>&1; then
>

> maybe you can do something like:
>
> if $SHELL -c "/usr/bin/printenv PATH"|grep -c $BINPATH >/dev/null; then
>         echo "You already have the right PATH - l337!"
> else
>
> most people would probably never run into a failure case.. but why create
> a temp file if you dont have to..

New description:

 mktemp is used in the postflight script of the installer.  the return of
 the mktemp is not checked so it may not have succeeded.  the subsequent
 write to can fail when it doesnt have to.

 Instead of doing this:

 {{{
 BINPATH=/opt/local/bin
 SBINPATH=/opt/local/sbin
 TMP=`/usr/bin/mktemp /tmp/dp.$$`
 $SHELL -l <<EOF > $TMP
     /usr/bin/printenv PATH
     exit
 EOF

 if grep $BINPATH $TMP >/dev/null 2>&1; then
 }}}

 maybe you can do something like:

 {{{
 if $SHELL -c "/usr/bin/printenv PATH"|grep -c $BINPATH >/dev/null; then
         echo "You already have the right PATH - l337!"
 else
 }}}

 most people would probably never run into a failure case.. but why create
 a temp file if you dont have to..

-- 
Ticket URL: <http://trac.macosforge.org/projects/macports/ticket/8401#comment:5>
MacPorts </projects/macports>
Ports system for Mac OS


More information about the macports-tickets mailing list