GNU bug report logs -
#13013
24.3.50; Windows XP bug? get-file-buffer, file-name-as-directory
Previous Next
Reported by: Jambunathan K <kjambunathan <at> gmail.com>
Date: Tue, 27 Nov 2012 17:25:02 UTC
Severity: minor
Tags: notabug
Found in version 24.3.50
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 13013 in the body.
You can then email your comments to 13013 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13013
; Package
emacs
.
(Tue, 27 Nov 2012 17:25:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jambunathan K <kjambunathan <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 27 Nov 2012 17:25:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
This report is a digest of following thread:
http://www.mail-archive.com/emacs-orgmode <at> gnu.org/msg62455.html.
The problem is because of Emacs mangling file paths like this on Windows
XP.
"c:/DOCUME~1/IZAHN/LOCALS~1/Temp/odt-8052VuJ/"
"c:/Documents and Settings/IZAHN/Local Settings/Temp/odt-8052VuJ/content.xml"
The problem is better explained with ielm session below.
Create a ielm buffer with
M-x ielm RET
and type out the following 4 lisp forms ONE-by-ONE.
(setq org-e-odt-zip-dir (file-name-as-directory (make-temp-file "odt-" t)))
(with-current-buffer (find-file-noselect (concat org-e-odt-zip-dir "content.xml") t) (buffer-file-name))
(with-current-buffer (get-file-buffer (concat org-e-odt-zip-dir "content.xml")) (save-buffer 0))
(get-file-buffer (concat org-e-odt-zip-dir "content.xml"))
Here is what Ista reports:
*** Welcome to IELM *** Type (describe-mode) for help.
ELISP> (setq org-e-odt-zip-dir (file-name-as-directory (make-temp-file
"odt-" t)))
"c:/DOCUME~1/IZAHN/LOCALS~1/Temp/odt-8052VuJ/"
ELISP> (with-current-buffer (find-file-noselect (concat
org-e-odt-zip-dir "content.xml") t) (buffer-file-name))
"c:/Documents and Settings/IZAHN/Local Settings/Temp/odt-8052VuJ/content.xml"
ELISP> (with-current-buffer (get-file-buffer (concat org-e-odt-zip-dir
"content.xml")) (save-buffer 0))
*** Eval error *** Wrong type argument: stringp, nil
ELISP> (get-file-buffer (concat org-e-odt-zip-dir "content.xml"))
nil
ELISP>
I am surprised that `get-file-buffer' is returning nil. Why is there a
mismatch between file names as reported by `file-name-as-directory' and
`buffer-file-name'.
The problem is seen with Ista's machine (CCed here) with the following
setup.
,----
| GNU Emacs 24.2.1 (i386-mingw-nt5.1.2600) of 2012-08-28 on MARVIN
|
| I have cygwin installed, but emacs is the windows version from
| http://ftp.gnu.org/gnu/emacs/windows/
|
| The OS is Windows XP professional with service pack 3.
`----
Apparently the problem is not seen with either here or
,----
| Windows 7
| GNU Emacs 24.2.1 (i386-mingw-nt6.1.7601) of 2012-08-29 on MARVIN
`----
here
,----
| GNU Emacs 24.2.1 (i386-mingw-nt6.1.7601) of 2012-08-29 on MARVIN
| Windows 7
`----
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13013
; Package
emacs
.
(Tue, 27 Nov 2012 18:04:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 13013 <at> debbugs.gnu.org (full text, mbox):
> From: Jambunathan K <kjambunathan <at> gmail.com>
> Date: Tue, 27 Nov 2012 22:54:57 +0530
> Cc: Ista Zahn <istazahn <at> gmail.com>
>
>
> This report is a digest of following thread:
> http://www.mail-archive.com/emacs-orgmode <at> gnu.org/msg62455.html.
I will read it soon, for now replying only based on what you posted.
> The problem is because of Emacs mangling file paths like this on Windows
> XP.
>
> "c:/DOCUME~1/IZAHN/LOCALS~1/Temp/odt-8052VuJ/"
> "c:/Documents and Settings/IZAHN/Local Settings/Temp/odt-8052VuJ/content.xml"
Emacs doesn't mangle file names. Emacs uses the value of TEMP
environment variable, which Windows sets to a 8+3 alias of the long
name (evidently trying to avoid bugs in programs that don't handle
whitespace in file names). Emacs then converts the 8+3 alias to the
full long name when it stores the file name in the buffer object of
the buffer that visits the file.
> Create a ielm buffer with
> M-x ielm RET
>
> and type out the following 4 lisp forms ONE-by-ONE.
>
> (setq org-e-odt-zip-dir (file-name-as-directory (make-temp-file "odt-" t)))
>
> (with-current-buffer (find-file-noselect (concat org-e-odt-zip-dir "content.xml") t) (buffer-file-name))
>
> (with-current-buffer (get-file-buffer (concat org-e-odt-zip-dir "content.xml")) (save-buffer 0))
>
> (get-file-buffer (concat org-e-odt-zip-dir "content.xml"))
The solution is to call file-truename on
(concat org-e-odt-zip-dir "content.xml")
Think of the 8+3 name as a symlink to the long file name.
> I am surprised that `get-file-buffer' is returning nil.
It returns nil because it compares file names with string-equal.
> Why is there a mismatch between file names as reported by
> `file-name-as-directory' and `buffer-file-name'.
See above. Won't the same happen with symlinks?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13013
; Package
emacs
.
(Tue, 27 Nov 2012 18:41:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 13013 <at> debbugs.gnu.org (full text, mbox):
>> I am surprised that `get-file-buffer' is returning nil.
> It returns nil because it compares file names with string-equal.
I think this brings us back to a recent suggestion to get rid of
get-file-buffer and redefine it as an alias of find-buffer-visiting
(which should work fine in this case).
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13013
; Package
emacs
.
(Tue, 27 Nov 2012 19:02:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 13013 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 27 Nov 2012 20:01:19 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: istazahn <at> gmail.com, 13013 <at> debbugs.gnu.org
>
> > From: Jambunathan K <kjambunathan <at> gmail.com>
> > Date: Tue, 27 Nov 2012 22:54:57 +0530
> > Cc: Ista Zahn <istazahn <at> gmail.com>
> >
> >
> > This report is a digest of following thread:
> > http://www.mail-archive.com/emacs-orgmode <at> gnu.org/msg62455.html.
>
> I will read it soon, for now replying only based on what you posted.
Read it, but didn't learn anything useful.
> The problem is seen with Ista's machine (CCed here) with the following
> setup.
> ,----
> | GNU Emacs 24.2.1 (i386-mingw-nt5.1.2600) of 2012-08-28 on MARVIN
> |
> | I have cygwin installed, but emacs is the windows version from
> | http://ftp.gnu.org/gnu/emacs/windows/
> |
> | The OS is Windows XP professional with service pack 3.
> `----
>
> Apparently the problem is not seen with either here or
> ,----
> | Windows 7
> | GNU Emacs 24.2.1 (i386-mingw-nt6.1.7601) of 2012-08-29 on MARVIN
> `----
>
> here
> ,----
> | GNU Emacs 24.2.1 (i386-mingw-nt6.1.7601) of 2012-08-29 on MARVIN
> | Windows 7
> `----
Because Windows 7 doesn't put a 8+3 alias into TEMP, but instead uses
the full long file name. Probably because XP still supports DOS
programs (via NTVDM), while Windows 7 tossed that support.
IOW, it works on Windows 7 "by sheer luck".
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13013
; Package
emacs
.
(Tue, 27 Nov 2012 19:26:01 GMT)
Full text and
rfc822 format available.
Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii writes:
> Because Windows 7 doesn't put a 8+3 alias into TEMP, but instead uses
> the full long file name. Probably because XP still supports DOS
> programs (via NTVDM), while Windows 7 tossed that support.
Win7 may not support DOS programs, but it still supports 8+3 filenames,
this is one of the easier ways to escape quoting hell on that platform.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13013
; Package
emacs
.
(Tue, 27 Nov 2012 19:56:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 13013 <at> debbugs.gnu.org (full text, mbox):
> From: Achim Gratz <Stromeko <at> nexgo.de>
> Date: Tue, 27 Nov 2012 20:23:08 +0100
>
> Eli Zaretskii writes:
> > Because Windows 7 doesn't put a 8+3 alias into TEMP, but instead uses
> > the full long file name. Probably because XP still supports DOS
> > programs (via NTVDM), while Windows 7 tossed that support.
>
> Win7 may not support DOS programs, but it still supports 8+3 filenames,
Of course it does. I never said it didn't. I attempted to explain
why XP sets TEMP to something like C:\DOCUME~1\USERNAME\LOCALS~1\Temp,
whereas Windows 7 sets it to C:\Users\USERNAME\APPDATA\Local\Temp.
bug closed, send any further explanations to
13013 <at> debbugs.gnu.org and Jambunathan K <kjambunathan <at> gmail.com>
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Tue, 04 Dec 2012 18:13:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 02 Jan 2013 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 12 years and 172 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.