Opened 18 years ago

Closed 16 years ago

Last modified 14 years ago

#8401 closed enhancement (fixed)

RFE: macports installer package postflight tweak

Reported by: asigel@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 1.6
Component: base Version: 1.2
Keywords: Cc:
Port:

Description (last modified by jmpp@…)

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..

Change History (9)

comment:1 Changed 18 years ago by asigel@…

severity: normaltrivial

comment:2 Changed 18 years ago by markd@…

Type: defectenhancement

comment:3 Changed 17 years ago by markd@…

Summary: darwinports installer package postflight tweakRFE: darwinports installer package postflight tweak

comment:4 Changed 17 years ago by nox@…

Milestone: MacPorts base bugs
Priority: ExpectedNormal
Summary: RFE: darwinports installer package postflight tweakRFE: macports installer package postflight tweak

comment:5 Changed 16 years ago by jmpp@…

Description: modified (diff)

comment:6 Changed 16 years ago by jmpp@…

Doablem, but can we guarantee that the -c construct will work with every shell out there? I'm a bash user and just skimmed over tcsh's, ksh's and zsh's and confirmed it for them.... but am I missing any other? I know we already sorta blindly assume it for the -l construct, but it's not like I'm that comfortable about it.

-jmpp

comment:7 Changed 16 years ago by jmpp@…

Resolution: fixed
Status: newclosed

Committed in r31486, thanks for the suggestion!

-jmpp

comment:8 Changed 15 years ago by tobypeterson

Milestone: MacPorts base bugsMacPorts Future

Milestone MacPorts base bugs deleted

comment:9 Changed 14 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 1.6
Note: See TracTickets for help on using tickets.