Opened 19 years ago

Closed 19 years ago

Last modified 8 years ago

#2895 closed defect (fixed)

Problem with patch and P4CONFIG in env

Reported by: mat@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 1.0
Keywords: Cc:
Port:

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Hi,

I recently got myself a PB, and yesterday, I began playing with DarwinPorts, I installed a few things, and I wanted to install lang/perl5.8, there, it borked with :

--->  Applying patches to perl5.8
Error: Target com.apple.patch returned: shell command "cd "/Volumes/Users/darwinports/dports/lang/perl5.8/work/perl-5.8.6" && patch -p0 < "/Volumes/Users/darwinports/dports/lang/perl5.8/files/patch-hints_darwin.sh""
returned error 2
Command output: Get file hints/darwin.sh from Perforce with lock? [y] 
sh: line 1: p4: command not found
patch: **** Can't get file hints/darwin.sh from Perforce

Which is quite obfuscated. I began to look at patch's man page, found out that running patch with -g0 was resolving the problem (I patched /opt/local/share/darwinports/Tcl/port1.0/portpatch.tcl to have it just work) and after, I told myself, no, that's not the right solution, so, hum, it happens that I use perforce from time to time, and that I have a P4CONFIG in my env. Unsetting P4CONFIG solved the problem... I have unlearned Tcl long time ago, and I don't know where I should begin looking at, but it should definitively be in the FAQ, or port should clean up it's env before running commands. (I agree that MacOS X's patch is behaving strangely there).

The following patch fixes it :

Index: base/src/darwinports1.0/darwinports.tcl
===================================================================
RCS file:
/Volumes/src/cvs/od/proj/darwinports/base/src/darwinports1.0/darwinports.tcl,v
retrieving revision 1.159
diff -u -u -r1.159 darwinports.tcl
--- base/src/darwinports1.0/darwinports.tcl  9 Apr 2005 09:51:03 -0000       1.159
+++ base/src/darwinports1.0/darwinports.tcl  13 Apr 2005 09:39:11 -0000
@@ -267,6 +267,10 @@
        set env(PATH) "$binpath"
     }
 
+    if {[info exists env(P4CONFIG)]} {
+       unset env(P4CONFIG)
+    }
+
     # Set the default umask
     if {![info exists destroot_umask]} {
         set destroot_umask 022

Change History (3)

comment:1 Changed 19 years ago by doug@…

I think pretty much any of the P4FOO env variables need to be unset. Specifically, I had a P4USER env variable that caused patch to fail.

for var in `env | grep ^P4 | cut -f1 -d=`; do unset $var; done
Last edited 8 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:2 Changed 19 years ago by pguyot (Paul Guyot)

Resolution: fixed
Status: newclosed

Thanks. I committed a fix to HEAD.

comment:3 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Note: See TracTickets for help on using tickets.