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: Eric Blake
Subject: Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM
Date: Thu, 5 Nov 2009 15:41:00 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Jim Meyering <jim <at> meyering.net> writes:

> Here's at least part of it:

Our mails crossed; it's good to see we both identified the same cause of the 
problem.  It was introduced because I was sloppy during my rebase to change 3 
spaces down to 2 earlier in the series; rebase noticed a conflict, but I 
resolved the conflict incorrectly.

As penance, I'm making sure the testsuite can catch this (applying just the 
test change without the mktemp.c change takes a while to fail (62**3 calls to 
lstat("XXXX")), but with mktemp.c fixed the test once again passes).


From: Eric Blake <address@hidden>
Date: Thu, 5 Nov 2009 08:36:09 -0700
Subject: [PATCH] mktemp: fix typo in previous patch

* src/mktemp.c (mkstemp_len, mkdtemp_len): Use correct argument.
* tests/misc/mktemp (check_tmp): Test for the bug it caused.
---
 src/mktemp.c      |    4 ++--
 tests/misc/mktemp |    3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

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
diff --git a/tests/misc/mktemp b/tests/misc/mktemp
index 7735f33..e49643f 100755
--- a/tests/misc/mktemp
+++ b/tests/misc/mktemp
@@ -85,9 +85,10 @@ my @Tests =

      # Use a template consisting solely of X's
      ['1d-allX', '-d XXXX', {OUT => "ZZZZ\n"},
+      {PRE => sub {mkdir 'XXXX',0755 or die "XXXX: $!\n"}},
       {OUT_SUBST => 's,^....$,ZZZZ,'},
       {POST => sub { my ($f) = @_; defined $f or return; chomp $f;
-       check_tmp $f, 'D'; }}
+       check_tmp $f, 'D'; rmdir 'XXXX' or die "rmdir XXXX: $!\n"; }}
      ],

      # Test -u
-- 
1.6.4.2








reply via email to

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