Package: fakeroot
Version: 1.13.1
Severity: normal
Tags: patch

Hi!

Investigating a FTBFS, I found that building the package in a clean
chroot with dpkg-buildpackage failed, but each step of the build worked
fine when run manually.

Slowly breaking down the problem, I eventually found the following:

# aptitude install fakeroot ghostscript

# ps2pdf testprint.ps
# ls testprint.ps
testprint.ps

# fakeroot ps2pdf testprint.ps
# ls testprint.ps
testprint.ps

# export TEMP=/tmp
# fakeroot ps2pdf testprint.ps
GPL Ghostscript 8.70: **** Could not open temporary file  -- 'ps2pdf' 
'testprint.ps'/gs_9FcqUJ
**** Unable to open the initial device, quitting.

So ghostscript is trying to use the literal:

  -- 'ps2pdf' 'testprint.ps'/gs_9FcqUJ

as the temp file and of course the directory "-- 'ps2pdf' 'testprint.ps'"
doesn't exist so it all fails.

Sure, it would be better if ghostscript didn't use a nonstandard environment
variable to set its temp directory, but that's not going to change any time
soon. It would also be preferable for fakeroot to refrain from polluting the 
environment.

The attached patch renames the TEMP variable in /usr/bin/fakeroot to something
that should prevent such clashes in the future. There are undoubtedly other
approaches that would prevent fakeroot from polluting the environment (and
perhaps there are other commonly used variables that also should not be touched
in /usr/bin/fakeroot; PREFIX and BINDIR are two that jump to mind).

cheers
Stuart
--- fakeroot.orig       2009-10-08 13:07:55.000000000 +0100
+++ fakeroot    2009-10-08 13:07:30.000000000 +0100
@@ -47,8 +47,8 @@
 case $GETOPTEST in
 getopt*) # GNU getopt
-    TEMP=`getopt -l lib: -l faked: -l unknown-is-real -l fd-base: -l version 
-l help -- +l:f:i:s:ub:vh "$@"`
+    FAKE_TEMP=`getopt -l lib: -l faked: -l unknown-is-real -l fd-base: -l 
version -l help -- +l:f:i:s:ub:vh "$@"`
     ;;
 *) # POSIX getopt ?
-    TEMP=`getopt l:f:i:s:ub:vh "$@"`
+    FAKE_TEMP=`getopt l:f:i:s:ub:vh "$@"`
     ;;
 esac
@@ -58,5 +58,5 @@
 fi
 
-eval set -- "$TEMP"
+eval set -- "$FAKE_TEMP"
 
 FAKEDOPTS=""

Reply via email to