GNU bug report logs - #11385
24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/")

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Mon, 30 Apr 2012 17:33:01 UTC

Severity: normal

Tags: moreinfo

Found in version 24.0.96

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11385 in the body.
You can then email your comments to 11385 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11385; Package emacs. (Mon, 30 Apr 2012 17:33:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 30 Apr 2012 17:33:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.0.96;
	`image-dired-create-thumb': (file-error "Setting current directory"
	"no such file or directory" "$HOME/")
Date: Mon, 30 Apr 2012 10:30:46 -0700
I do not have a recipe from emacs -Q
 
However, I debugged the code that leads to the problem a bit, hoping it
will help. This is from the debugger, just before the error:
 
* call-process("C:/cygwin/bin/bash.exe" nil nil nil "-c"
   #("convert -size 100x100
   \".emacs-bmk-bmenu-image-file-icon.png\" -resize \"100x100>\" -strip
 
jpeg:\"c:/.emacs.d/image-dired/.emacs_028631bce981005b8fb0ffc7b6a1a0f9.thumb.png
\""
   23 59 (mouse-face highlight)))
* image-dired-create-thumb(#(".emacs.png"
   0 36 (mouse-face highlight))
   "c:/.emacs.d/image-dired/.emacs_028631bce981005b8fb0ffc7b6a1a0f9.thumb.png")
* image-dired-get-thumbnail-image(#(".emacs.png"
   0 36 (mouse-face highlight)))
 
In the minibuffer, which is where the current directory is being picked up, I
have this: c:/foo/bar/$HOME/.  My value of env var $HOME is "c:\\".
 
I am not using vanilla Emacs completion.  At the time the debugger was
entered (because I placed `(debug)' in the code), the completion
candidates are displayed in *Completions*, and they are (correctly)
all of the files in c:/.
 
I'm using code that, to display the candidates in *Completions*,
checks whether each is an image file, and if so optionally
displays a thumbnail of the image in *Completions*.  It is this code
that calls `image-dired-get-thumbnail':
 
(when (and (require 'image-dired nil t)
           (string-match-p (image-file-name-regexp) image-file))
  (let ((thumb-img  (append (image-dired-get-thumbnail-image image-file)
                                                             '(:margin 2)))

Debugging shows that (image-dired-thumb-name ".emacs.png") returns
"c:/foo/bar/$HOME/.emacs.png".  Eventually, `image-dired-create-thumb' is
called, and it calls `call-process' as shown above.

In GNU Emacs 24.0.96.1 (i386-mingw-nt5.1.2600)
 of 2012-04-28 on MARVIN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.6) --no-opt --enable-checking --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include'
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11385; Package emacs. (Sun, 06 May 2012 04:46:02 GMT) Full text and rfc822 format available.

Message #8 received at 11385 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 11385 <at> debbugs.gnu.org
Subject: Re: bug#11385: 24.0.96;
	`image-dired-create-thumb': (file-error "Setting current directory"
	"no such file or directory" "$HOME/")
Date: Sun, 06 May 2012 12:43:23 +0800
"Drew Adams" <drew.adams <at> oracle.com> writes:

> I am not using vanilla Emacs completion.  At the time the debugger was
> entered (because I placed `(debug)' in the code), the completion
> candidates are displayed in *Completions*, and they are (correctly)
> all of the files in c:/.
>  
> I'm using code that, to display the candidates in *Completions*,
> checks whether each is an image file, and if so optionally
> displays a thumbnail of the image in *Completions*.

I don't see the problem.  Feel free to keep debugging.





Added tag(s) moreinfo. Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 06 May 2012 04:46:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11385; Package emacs. (Sat, 12 May 2012 16:04:02 GMT) Full text and rfc822 format available.

Message #13 received at 11385 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Chong Yidong'" <cyd <at> gnu.org>
Cc: 11385 <at> debbugs.gnu.org
Subject: RE: bug#11385: 24.0.96;
	`image-dired-create-thumb': (file-error "Setting current directory"
	"no such file or directory" "$HOME/")
Date: Sat, 12 May 2012 09:02:42 -0700
> I don't see the problem.  Feel free to keep debugging.

The question is whether the string passed to `call-process' is legitimate, and
if so, why it raises an error.  This is the string:

* call-process("C:/cygwin/bin/bash.exe" nil nil nil "-c" #("convert -size
100x100 \".emacs-bmk-bmenu-image-file-icon.png\" -resize \"100x100>\" -strip
jpeg:\"c:/.emacs.d/image-dired/.emacs-bmk-bmenu-image-file-icon_296198de66b39419
757fa05281dd3766.thumb.png\"" 23 59 (mouse-face highlight)))

It is the `image-dired-create-thumb' code that creates that string, not I.

Again, this is the error raised:

Debugger entered--Lisp error:
(file-error "Setting current directory" "no such file or directory"
 "c:/drews-lisp-20/$HOME/")

I don't see code in `image-dired-create-thumb' that refers to the directory, so
I don't know where that error is coming from.

But clearly either (a) the caller (whoever it is) should have converted
"c:/drews-lisp-20/$HOME/" to the value of $HOME (which is "c:/" in this case) or
(b) the consumer of "c:/drews-lisp-20/$HOME/" should itself interpret it
correctly.

IOW, something is wrong, I think, in `image-dired-create-thumb', since it seems
to be called with legitimate arguments and it raises an error.

Again, this is the call to `image-dired-create-thumb':

image-dired-create-thumb(#(".emacs-bmk-bmenu-image-file-icon.png" 0 36
(mouse-face highlight))
"c:/.emacs.d/image-dired/.emacs-bmk-bmenu-image-file-icon_296198de66b39419757fa0
5281dd3766.thumb.png")

As you can see, there is nothing here about "c:/drews-lisp-20/$HOME/".

And that function was called from this, which also seems legitimate:

image-dired-get-thumbnail-image(#(".emacs-bmk-bmenu-image-file-icon.png" 0 36
(mouse-face highlight)))

Surely `image-dired-get-thumbnail-image' should be able to return an image file
or raise its own pertinent error (which it does): (error "%s is not a valid
image file" file).  It should not be the case that some low-level code raises an
error here (and why does it?).





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11385; Package emacs. (Sat, 12 May 2012 16:29:02 GMT) Full text and rfc822 format available.

Message #16 received at 11385 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: cyd <at> gnu.org, 11385 <at> debbugs.gnu.org
Subject: Re: bug#11385: 24.0.96;
	`image-dired-create-thumb': (file-error "Setting current
	directory"	"no such file or directory" "$HOME/")
Date: Sat, 12 May 2012 19:29:27 +0300
> From: "Drew Adams" <drew.adams <at> oracle.com>
> Date: Sat, 12 May 2012 09:02:42 -0700
> Cc: 11385 <at> debbugs.gnu.org
> 
> > I don't see the problem.  Feel free to keep debugging.
> 
> The question is whether the string passed to `call-process' is legitimate, and
> if so, why it raises an error.  This is the string:
> 
> * call-process("C:/cygwin/bin/bash.exe" nil nil nil "-c" #("convert -size
> 100x100 \".emacs-bmk-bmenu-image-file-icon.png\" -resize \"100x100>\" -strip
> jpeg:\"c:/.emacs.d/image-dired/.emacs-bmk-bmenu-image-file-icon_296198de66b39419
> 757fa05281dd3766.thumb.png\"" 23 59 (mouse-face highlight)))

It seems legitimate, although the \"100x100>\" part looks suspicious
(what is that '>' character doing there?).  But I don't think this is
the problem.

> Debugger entered--Lisp error:
> (file-error "Setting current directory" "no such file or directory"
>  "c:/drews-lisp-20/$HOME/")

It's the $HOME part that is the problem.  Can you find out where
exactly inside image-dired-thumb-name does it come from?  The $HOME
part was supposed to be expanded, but instead it is being treated
literally, and the current directory is prepended to it.  The question
is, what code produces that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11385; Package emacs. (Sat, 12 May 2012 16:29:02 GMT) Full text and rfc822 format available.

Message #19 received at 11385 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 'Chong Yidong' <cyd <at> gnu.org>, 11385 <at> debbugs.gnu.org
Subject: Re: bug#11385: 24.0.96;
	`image-dired-create-thumb': (file-error "Setting current directory"
	"no such file or directory" "$HOME/")
Date: Sat, 12 May 2012 18:28:36 +0200
"Drew Adams" <drew.adams <at> oracle.com> writes:

> Debugger entered--Lisp error:
> (file-error "Setting current directory" "no such file or directory"
>  "c:/drews-lisp-20/$HOME/")

You need to find out who ever sets default-directory to
"c:/drews-lisp-20/$HOME/".

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11385; Package emacs. (Sat, 12 May 2012 16:36:02 GMT) Full text and rfc822 format available.

Message #22 received at 11385 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Andreas Schwab'" <schwab <at> linux-m68k.org>
Cc: 'Chong Yidong' <cyd <at> gnu.org>, 11385 <at> debbugs.gnu.org
Subject: RE: bug#11385: 24.0.96;
	`image-dired-create-thumb': (file-error "Setting current directory"
	"no such file or directory" "$HOME/")
Date: Sat, 12 May 2012 09:34:16 -0700
> You need to find out who ever sets default-directory to
> "c:/drews-lisp-20/$HOME/".

Yes, it is my code that (mistakenly) does that.  That is what is provoking the
problem, but I think the image-dired code should anyway protect against such a
case, instead of leading to a low-level error.

If you don't think so, feel free to close the bug.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11385; Package emacs. (Sat, 12 May 2012 17:11:02 GMT) Full text and rfc822 format available.

Message #25 received at 11385 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: cyd <at> gnu.org, schwab <at> linux-m68k.org, 11385 <at> debbugs.gnu.org
Subject: Re: bug#11385: 24.0.96;
	`image-dired-create-thumb': (file-error "Setting current
	directory"	"no such file or directory" "$HOME/")
Date: Sat, 12 May 2012 20:11:34 +0300
> From: "Drew Adams" <drew.adams <at> oracle.com>
> Date: Sat, 12 May 2012 09:34:16 -0700
> Cc: 'Chong Yidong' <cyd <at> gnu.org>, 11385 <at> debbugs.gnu.org
> 
> > You need to find out who ever sets default-directory to
> > "c:/drews-lisp-20/$HOME/".
> 
> Yes, it is my code that (mistakenly) does that.  That is what is provoking the
> problem, but I think the image-dired code should anyway protect against such a
> case, instead of leading to a low-level error.

I think $HOME is not generally recognized in file names.  Only a few
select functions know about it (substitute-in-file-name and
expand-file-name come to mind).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11385; Package emacs. (Sat, 12 May 2012 19:22:01 GMT) Full text and rfc822 format available.

Message #28 received at 11385 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: cyd <at> gnu.org, schwab <at> linux-m68k.org, Drew Adams <drew.adams <at> oracle.com>,
	11385 <at> debbugs.gnu.org
Subject: Re: bug#11385: 24.0.96;
	`image-dired-create-thumb': (file-error "Setting current
	directory"	"no such file or directory" "$HOME/")
Date: Sat, 12 May 2012 15:20:30 -0400
> I think $HOME is not generally recognized in file names.  Only a few
> select functions know about it (substitute-in-file-name and
> expand-file-name come to mind).

Only substitute-in-file-name performs expansion of env-vars.  IIRC the
function `load' also calls substitute-in-file-name, but otherwise
substitute-in-file-name is only applied to file names typed in
the minibuffer.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11385; Package emacs. (Sat, 12 May 2012 20:05:01 GMT) Full text and rfc822 format available.

Message #31 received at 11385 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: cyd <at> gnu.org, Drew Adams <drew.adams <at> oracle.com>, 11385 <at> debbugs.gnu.org
Subject: Re: bug#11385: 24.0.96;
	`image-dired-create-thumb': (file-error "Setting current
	directory"	"no such file or directory" "$HOME/")
Date: Sat, 12 May 2012 22:04:19 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> I think $HOME is not generally recognized in file names.  Only a few
> select functions know about it (substitute-in-file-name and
> expand-file-name come to mind).

Only substitute-in-file-name expands references to environment
variables.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Fri, 08 Feb 2013 01:15:01 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Fri, 08 Feb 2013 01:15:01 GMT) Full text and rfc822 format available.

Message #36 received at 11385-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 11385-done <at> debbugs.gnu.org
Subject: Re: bug#11385: 24.0.96;
	`image-dired-create-thumb': (file-error "Setting current directory"
	"no such file or directory" "$HOME/")
Date: Thu, 07 Feb 2013 20:14:47 -0500
"Drew Adams" wrote:

>> You need to find out who ever sets default-directory to
>> "c:/drews-lisp-20/$HOME/".
>
> Yes, it is my code that (mistakenly) does that.
[...]
> If you don't think so, feel free to close the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 08 Mar 2013 12:24:05 GMT) Full text and rfc822 format available.

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

Previous Next


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