unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/")
@ 2012-04-30 17:30 Drew Adams
  2012-05-06  4:43 ` Chong Yidong
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2012-04-30 17:30 UTC (permalink / raw)
  To: 11385


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'
 






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/")
  2012-04-30 17:30 bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/") Drew Adams
@ 2012-05-06  4:43 ` Chong Yidong
  2012-05-12 16:02   ` Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Chong Yidong @ 2012-05-06  4:43 UTC (permalink / raw)
  To: Drew Adams; +Cc: 11385

"Drew Adams" <drew.adams@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.






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/")
  2012-05-06  4:43 ` Chong Yidong
@ 2012-05-12 16:02   ` Drew Adams
  2012-05-12 16:28     ` Andreas Schwab
  2012-05-12 16:29     ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: Drew Adams @ 2012-05-12 16:02 UTC (permalink / raw)
  To: 'Chong Yidong'; +Cc: 11385

> 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?).






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/")
  2012-05-12 16:02   ` Drew Adams
@ 2012-05-12 16:28     ` Andreas Schwab
  2012-05-12 16:34       ` Drew Adams
  2012-05-12 16:29     ` Eli Zaretskii
  1 sibling, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2012-05-12 16:28 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Chong Yidong', 11385

"Drew Adams" <drew.adams@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/")
  2012-05-12 16:02   ` Drew Adams
  2012-05-12 16:28     ` Andreas Schwab
@ 2012-05-12 16:29     ` Eli Zaretskii
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2012-05-12 16:29 UTC (permalink / raw)
  To: Drew Adams; +Cc: cyd, 11385

> From: "Drew Adams" <drew.adams@oracle.com>
> Date: Sat, 12 May 2012 09:02:42 -0700
> Cc: 11385@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/")
  2012-05-12 16:28     ` Andreas Schwab
@ 2012-05-12 16:34       ` Drew Adams
  2012-05-12 17:11         ` Eli Zaretskii
  2013-02-08  1:14         ` Glenn Morris
  0 siblings, 2 replies; 10+ messages in thread
From: Drew Adams @ 2012-05-12 16:34 UTC (permalink / raw)
  To: 'Andreas Schwab'; +Cc: 'Chong Yidong', 11385

> 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.






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/")
  2012-05-12 16:34       ` Drew Adams
@ 2012-05-12 17:11         ` Eli Zaretskii
  2012-05-12 19:20           ` Stefan Monnier
  2012-05-12 20:04           ` Andreas Schwab
  2013-02-08  1:14         ` Glenn Morris
  1 sibling, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2012-05-12 17:11 UTC (permalink / raw)
  To: Drew Adams; +Cc: cyd, schwab, 11385

> From: "Drew Adams" <drew.adams@oracle.com>
> Date: Sat, 12 May 2012 09:34:16 -0700
> Cc: 'Chong Yidong' <cyd@gnu.org>, 11385@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).





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/")
  2012-05-12 17:11         ` Eli Zaretskii
@ 2012-05-12 19:20           ` Stefan Monnier
  2012-05-12 20:04           ` Andreas Schwab
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2012-05-12 19:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: cyd, schwab, 11385

> 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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/")
  2012-05-12 17:11         ` Eli Zaretskii
  2012-05-12 19:20           ` Stefan Monnier
@ 2012-05-12 20:04           ` Andreas Schwab
  1 sibling, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2012-05-12 20:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: cyd, 11385

Eli Zaretskii <eliz@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/")
  2012-05-12 16:34       ` Drew Adams
  2012-05-12 17:11         ` Eli Zaretskii
@ 2013-02-08  1:14         ` Glenn Morris
  1 sibling, 0 replies; 10+ messages in thread
From: Glenn Morris @ 2013-02-08  1:14 UTC (permalink / raw)
  To: 11385-done

"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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-02-08  1:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-30 17:30 bug#11385: 24.0.96; `image-dired-create-thumb': (file-error "Setting current directory" "no such file or directory" "$HOME/") Drew Adams
2012-05-06  4:43 ` Chong Yidong
2012-05-12 16:02   ` Drew Adams
2012-05-12 16:28     ` Andreas Schwab
2012-05-12 16:34       ` Drew Adams
2012-05-12 17:11         ` Eli Zaretskii
2012-05-12 19:20           ` Stefan Monnier
2012-05-12 20:04           ` Andreas Schwab
2013-02-08  1:14         ` Glenn Morris
2012-05-12 16:29     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).