bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM


From: Jim Meyering
Subject: Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM
Date: Thu, 05 Nov 2009 16:04:26 +0100

Eric Blake wrote:

> According to Jim Meyering on 11/5/2009 2:35 AM:
>> Nice work!
>> Modulo tiny comments, you're welcome to push that series
>> once you've pushed the gnulib bits upon which it depends.
>
> Aargh.  I just noticed that what I pushed still has a bug:
>
> $ src/mktemp -u XXXXXXXXXXXXXXXXX.pdf
> XXXXXXXXXXXXXpiYD.pdf
>
> Rather than replacing all the X, it is only replacing the number of X in
> the suffix.  And the testsuite didn't catch it :(
>
> I'll have to prepare a followup patch, but I ran out of time this morning.

Here's at least part of it:

diff --git a/src/mktemp.c b/src/mktemp.c
index ac35026..f60e824 100644
--- a/src/mktemp.c
+++ b/src/mktemp.c
@@ -118,14 +118,14 @@ static int
 mkstemp_len (char *tmpl, size_t suff_len, size_t x_len, bool dry_run)
 {
   return gen_tempname_len (tmpl, suff_len, 0, dry_run ? GT_NOCREATE : GT_FILE,
-                           suff_len);
+                           x_len);
 }

 static int
 mkdtemp_len (char *tmpl, size_t suff_len, size_t x_len, bool dry_run)
 {
   return gen_tempname_len (tmpl, suff_len, 0, dry_run ? GT_NOCREATE : GT_DIR,
-                           suff_len);
+                           x_len);
 }

 int




reply via email to

[Prev in Thread] Current Thread [Next in Thread]