Sat Dec 05 12:46:58 2009: Request 52407 was acted upon.
Transaction: Correspondence added by RSCHUPP
       Queue: PAR-Packer
     Subject: pp creates par-<user>/ in /, not /tmp
   Broken in: 1.001
    Severity: Normal
       Owner: RSCHUPP
  Requestors: sw...@cpan.org
      Status: open
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52407 >


On Sat Dec 05 06:41:48 2009, SMUELLER wrote:
> Quite honestly... I have no good idea. Looking at the differences to
> 0.991, there is some change to myldr/mktempdir.c:

I know, it did these :) But I don't think they're responsible.

I was able to reproduce Steven's problem on a machine
running Novell SLES 10 64bit (with the system's Perl 5.8.8).
In fact, already the build failed there, 
running myldir/static aborted with 
"creation of private temporary subdirectory /cache-XXX failed".
In this environment the statement

            sprintf(
                stmpdir,
                "%s%scache-%s%s",
                stmpdir, dir_sep, sha1, subdirbuf_suffix
            );

(in the alternative headed by /* "$TEMP/par-$USER/cache-$SHA1" */)
had the expected contents of stmpdir before the statement,
but afterwards stmpdir didn't have dir_sep+sha1+subdirbuf_suffix
appended (as that seems to be the intent of the author), 
but stmpdir had been replaced by the latter. 

On the other hand, this works as intended on e.g. Debian sid,
with Perl 5.10.1 (and probably lots of other systems, otherwise
cpantesters  results would be mostly in the red).

Now my old C99 standard clearly states that you should not expect
any particular outcome from the above since the output buffer
overlaps with some input arguments. In fact, a few lines
above this statement, we find the following comment:

    /* stmpdir is what we are going to return 
       stmpdir2 is the top $TEMP/par-$USER, needed to build stmpdir.  We
       need 2 buffers because snprintf() can't write to a buffer it's
       reading from. */

Unfortunately, this advice is not heeded and stmpdir2 isn't
found in the code except for this comment.

I'll post a fix along these lines shortly, but I'm still
puzzled that this hasn't shown up earlier. All three alternatives
to compute stmpdir in par_mktmpdir() use the same broken call
to snprintf. And this code has been there for a long time.

Maybe it's dependent on a particular implementation of snprintf?
Steven's post shows (from "perl -V")

gnulibc_version='2.5'

I'm currently away from the machine I was able to reproduce it on,
hence can't doublecheck.
Unfortunately I don't see an easy way to extract this information
from the existing test reports (i.e. without going over each one
manually).

Cheers, Roderich

Reply via email to