This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

conformtest tampering with $HOME


Hi!

I was quite surprised to notice glibc's conformtest create and unlink a
few hundred files in my home directory.  I tracked this down to the
following commit:

    commit f095bb7204d80f609a73a22796edd6cffd4c6add
    Author: Ulrich Drepper <drepper@redhat.com>
    Date:   Sat Jan 9 10:56:41 2010 -0800
    
        Add support for XPG7 testing.
        
        The header conformance testing code needed extending for XPG7.  This
        exposed a few bugs in the headers.  There are more changes to come.
    
    diff --git a/ChangeLog b/ChangeLog
    index 6cbc86d..a2f8d1b 100644
    --- a/ChangeLog
    +++ b/ChangeLog
    @@ -1,3 +1,135 @@
    +2010-01-09  Ulrich Drepper  <drepper@redhat.com>
    +
    +	* conform/conformtest.pl: Update for XPG7 and some bug fixes.
    +	[...]
    [...]
    diff --git a/conform/conformtest.pl b/conform/conformtest.pl
    index b15656b..e594d87 100644
    --- a/conform/conformtest.pl
    +++ b/conform/conformtest.pl
    [...]
    @@ -71,7 +75,10 @@ while ($#knownproblems >= 0) {
       $isknown{pop (@knownproblems)} = 1;
     }
     
    -$tmpdir = "/tmp";
    +$uid = getuid();
    +($pwname,$pwpasswd,$pwuid,$pwgid,
    + $pwquota,$pwcomment,$pwgcos,$pwdir,$pwshell,$pwexpire) = getpwuid($uid);
    +$tmpdir = "$pwdir";
     
     $verbose = 1;
     
    [...]

Why would in $HOME be a better place for storing temporary files than /tmp?
(And why that is described as a bug fix?)  Surely storing files directly
in /tmp is not optimal either, but several glibc tests act this way (and
should be fixed).  Anyway, OK to commit the following patch?  With it,
things look more comforting, compared to pristine glibc sources:

    diff -ru glibc.build.pristine/conform/conform-ISO11.out glibc.build/conform/conform-ISO11.out
    --- glibc.build.pristine/conform/conform-ISO11.out	2012-03-19 15:49:13.810188048 +0100
    +++ glibc.build/conform/conform-ISO11.out	2012-03-19 17:20:27.010437849 +0100
    @@ -234,21 +234,21 @@
       Test availability of macro CMPLX... FAIL
         Function "CMPLX" is not available.  Compiler message:
         -----------------------------------------------------------------------
    -    /home/thomas/complex.h-test.c:3:48: error: 'CMPLX' undeclared here (not in a function)
    +    /home/thomas/tmp/source/glibc/glibc.build/conform/scratch/complex.h-test.c:3:48: error: 'CMPLX' undeclared here (not in a function)
         -----------------------------------------------------------------------
       Test for type of macro CMPLX... SKIP
    [...]

	Don't tamper with $HOME.

	* conform/conformtest.pl: Handle --tmpdir argument, defaulting to /tmp.
	* conform/run-conformtest.sh: Pass --tmpdir argument when invoking
	conformtest.pl

diff --git a/conform/conformtest.pl b/conform/conformtest.pl
index 6a78020..83650c2 100644
--- a/conform/conformtest.pl
+++ b/conform/conformtest.pl
@@ -3,11 +3,11 @@
 use Getopt::Long;
 use POSIX;
 
+$standard = "XOPEN2K8";
 $CC = "gcc";
-
-$standard="XOPEN2K8";
+$tmpdir = "/tmp";
 GetOptions ('headers=s' => \@headers, 'standard=s' => \$standard,
-	    'flags=s' => \$flags, 'cc=s' => \$CC);
+	    'flags=s' => \$flags, 'cc=s' => \$CC, 'tmpdir=s' => \$tmpdir);
 @headers = split(/,/,join(',',@headers));
 
 # List of the headers we are testing.
@@ -84,11 +84,6 @@ while ($#knownproblems >= 0) {
   $isknown{pop (@knownproblems)} = 1;
 }
 
-$uid = getuid();
-($pwname,$pwpasswd,$pwuid,$pwgid,
- $pwquota,$pwcomment,$pwgcos,$pwdir,$pwshell,$pwexpire) = getpwuid($uid);
-$tmpdir = "$pwdir";
-
 $verbose = 1;
 
 $total = 0;
diff --git a/conform/run-conformtest.sh b/conform/run-conformtest.sh
index d83aa79..c82fbcb 100644
--- a/conform/run-conformtest.sh
+++ b/conform/run-conformtest.sh
@@ -5,6 +5,9 @@ perl="$2"
 cc="$3"
 includes="$4"
 
+scratch=${objpfx}scratch
+mkdir -p "$scratch"
+
 standards=("ISO" "ISO99" "ISO11" "POSIX" "XPG3" "XPG4" "UNIX98"
 	   "XOPEN2K" "XOPEN2K8" "POSIX2008")
 
@@ -13,7 +16,7 @@ exitval=0
 for s in ${standards[*]}; do
     echo -n $s...
     e=0
-    if ! $perl conformtest.pl --cc="$cc" --flags="$includes" --standard=$s > ${objpfx}conform-$s.out; then
+    if ! $perl conformtest.pl --tmpdir="$scratch" --cc="$cc" --flags="$includes" --standard=$s > ${objpfx}conform-$s.out; then
 	e=1
     fi
     printf "\n%s\n" $s >> ${objpfx}run-conformtest.out


GrÃÃe,
 Thomas

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]