GNU bug report logs - #11586
mkstemp failure diagnostic lacks directory name

Previous Next

Package: emacs;

Reported by: Jim Meyering <jim <at> meyering.net>

Date: Wed, 30 May 2012 10:31:02 UTC

Severity: normal

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Meyering <jim <at> meyering.net>
To: 11586 <at> debbugs.gnu.org
Subject: bug#11586: mkstemp failure diagnostic lacks directory name
Date: Wed, 30 May 2012 12:28:29 +0200
In emacs I tried to filter a section of an input file
through a pipe and got this diagnostic:

    byte-code: Failed to open temporary file: No such file or directory, emacsXXXXXX

Knowing it's due to mkstemp failure, most would suspect that
/tmp is missing.  But I set TMPDIR to a different private directory
for each shell, and for me it means that the parent shell's
temporary directory had been removed.  Oops.
It should be easy to work around simply by recreating that directory,
but the diagnostic doesn't include the directory name.

Sure, I was able to work around it by inspecting emacs's
view of $TMPDIR, but I shouldn't have had to do that.

With the tiny patch below, I now get a diagnostic like this:

    byte-code: Failed to open temporary file: No such file or directory, /t/jt-toGrGn/emacs3gdoKc

From a389e755b74e048a34628b4f5ccad9f244e99cc3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering <at> redhat.com>
Date: Wed, 30 May 2012 12:25:58 +0200
Subject: [PATCH] diagnose mkstemp failure with full file name

* callproc.c (Fcall_process_region): Diagnose mkstemp failure using
the full, expanded name, including the directory part, not just
the basename template.
---
 src/ChangeLog  | 6 ++++++
 src/callproc.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index edf68a5..5d9e86e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-30  Jim Meyering  <meyering <at> redhat.com>
+
+	* callproc.c (Fcall_process_region): Diagnose mkstemp failure using
+	the full, expanded name, including the directory part, not just
+	the basename template.
+
 2012-05-30  Paul Eggert  <eggert <at> cs.ucla.edu>

 	* alloc.c, lisp.h (make_pure_vector): Now static.
diff --git a/src/callproc.c b/src/callproc.c
index f7c9971..976d306 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1015,7 +1015,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
       UNBLOCK_INPUT;
       if (fd == -1)
 	report_file_error ("Failed to open temporary file",
-			   Fcons (Vtemp_file_name_pattern, Qnil));
+			   Fcons (build_string (tempfile), Qnil));
       else
 	close (fd);
     }
--
1.7.10.2.605.gbefc5ed




This bug report was last modified 12 years and 361 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.