From: Lowell
Subject: trouble writing to files with names beginning with .
Date:
Message-ID: <blit63$dhm$1@mughi.cs.ubc.ca>
I am using Clisp 2.30 on Windows and am habing trouble writing to files.
It seems to me that I can't write files whose names begin with a period.
The following code will work if filename doesn't begin with a . but will
not work if filename does begin with one:
(with-open-file (str filename :direction :output) (princ "foo"))
sample error message:
*** - no file name given: #P"/grads1/lkirsh/scripts/.bashrc"
Is there a way to create files whose names begin with "." ? I would
prefer to do so without having to deal with pathnames if it's possible.
Is it?
Lowell
From: ·············@comcast.net
Subject: Re: trouble writing to files with names beginning with .
Date:
Message-ID: <7k3m3gva.fsf@comcast.net>
Lowell <······@cs.ubc.ca> writes:
> I am using Clisp 2.30 on Windows and am habing trouble writing to
> files. It seems to me that I can't write files whose names begin with
> a period. The following code will work if filename doesn't begin with
> a . but will not work if filename does begin with one:
>
> (with-open-file (str filename :direction :output) (princ "foo"))
>
> sample error message:
>
> *** - no file name given: #P"/grads1/lkirsh/scripts/.bashrc"
>
> Is there a way to create files whose names begin with "." ? I would
> prefer to do so without having to deal with pathnames if it's
> possible. Is it?
Apparently not in CLISP.
What's wrong with pathnames, though?
(with-open-file (str (make-pathname :name ".bashrc"
:defaults "/grads1/lkirsh/scripts/")
:direction :output)
(format str "foo"))
From: Peter Seibel
Subject: Re: trouble writing to files with names beginning with .
Date:
Message-ID: <m3y8w22u33.fsf@javamonkey.com>
Lowell <······@cs.ubc.ca> writes:
> I am using Clisp 2.30 on Windows and am habing trouble writing to
> files. It seems to me that I can't write files whose names begin with
> a period. The following code will work if filename doesn't begin with
> a . but will not work if filename does begin with one:
>
> (with-open-file (str filename :direction :output) (princ "foo"))
>
> sample error message:
>
> *** - no file name given: #P"/grads1/lkirsh/scripts/.bashrc"
>
> Is there a way to create files whose names begin with "." ? I would
> prefer to do so without having to deal with pathnames if it's
> possible. Is it?
Hmmm. Dunno about Windows and I'm using 2.31, not 2.30. But this works
for me:
[2]> (with-open-file (out #p"/home/peter/.testdotfile" :direction :output) (format out "hello"))
NIL
And .testdotfile contains the string "hello".
-Peter
--
Peter Seibel ·····@javamonkey.com
Lisp is the red pill. -- John Fraser, comp.lang.lisp
From: Lowell Kirsh
Subject: Re: trouble writing to files with names beginning with .
Date:
Message-ID: <blknoe$msk$1@mughi.cs.ubc.ca>
Hmmm, I just tried your code on Solaris2.9 with Clisp 2.29 and I still
get the same error message : "no file name given..."
Lowell
Peter Seibel wrote:
> Lowell <······@cs.ubc.ca> writes:
>
>
>>I am using Clisp 2.30 on Windows and am habing trouble writing to
>>files. It seems to me that I can't write files whose names begin with
>>a period. The following code will work if filename doesn't begin with
>>a . but will not work if filename does begin with one:
>>
>>(with-open-file (str filename :direction :output) (princ "foo"))
>>
>>sample error message:
>>
>>*** - no file name given: #P"/grads1/lkirsh/scripts/.bashrc"
>>
>>Is there a way to create files whose names begin with "." ? I would
>>prefer to do so without having to deal with pathnames if it's
>>possible. Is it?
>
>
> Hmmm. Dunno about Windows and I'm using 2.31, not 2.30. But this works
> for me:
>
> [2]> (with-open-file (out #p"/home/peter/.testdotfile" :direction :output) (format out "hello"))
> NIL
>
> And .testdotfile contains the string "hello".
>
> -Peter
>
From: Thomas A. Russ
Subject: Re: trouble writing to files with names beginning with .
Date:
Message-ID: <ymi3ceam1gd.fsf@sevak.isi.edu>
Lowell <······@cs.ubc.ca> writes:
>
> I am using Clisp 2.30 on Windows and am habing trouble writing to
> files. It seems to me that I can't write files whose names begin with
> a period. The following code will work if filename doesn't begin with
> a . but will not work if filename does begin with one:
>
> (with-open-file (str filename :direction :output) (princ "foo"))
>
> sample error message:
>
> *** - no file name given: #P"/grads1/lkirsh/scripts/.bashrc"
>
> Is there a way to create files whose names begin with "." ? I would
> prefer to do so without having to deal with pathnames if it's
> possible. Is it?
How about creating the pathname explicitly? Perhaps like this:
(with-open-file (str (make-pathname
:directory '(:absoluate "grads1" "lkirsh" "scripts")
:name ".bashrc"
:type NIL)
:direction :output)
(princ "foo"f str))
The problem you are getting is probably a result of the built-in string
to pathname parsing. If you circumvent that by building your own
pathname out of its constituent parts you may be able to overcome the
problem.
--
Thomas A. Russ, USC/Information Sciences Institute
"Thomas A. Russ" <···@sevak.isi.edu> ha scritto nel messaggio ····················@sevak.isi.edu...
> How about creating the pathname explicitly?
How about reporting this as a bug, instead?
Let's not encourage this weirdness.
>Perhaps like this:
>
> (with-open-file (str (make-pathname
> :directory '(:absoluate "grads1" "lkirsh" "scripts")
> :name ".bashrc"
> :type NIL)
> :direction :output)
> (princ "foo"f str))
>
> The problem you are getting is probably a result of the built-in string
> to pathname parsing. If you circumvent that by building your own
> pathname out of its constituent parts you may be able to overcome the
> problem.
This workaround cannot be used always. Think of a filename typed
in from an end-user.
The parsing of namestrings should conform to the expectations of users
of the OS on which the lisp is running.
Traditionally, in Unix, .bashrc is not interpreted as a file with no name and
type bashrc.
P.
From: Christopher C. Stacy
Subject: Re: trouble writing to files with names beginning with .
Date:
Message-ID: <uhe2pvt8p.fsf@dtpq.com>
>>>>> On Sat, 04 Oct 2003 12:43:08 GMT, Pierpaolo BERNARDI ("Pierpaolo") writes:
Pierpaolo> "Thomas A. Russ" <···@sevak.isi.edu> ha scritto nel messaggio ····················@sevak.isi.edu...
>> How about creating the pathname explicitly?
Pierpaolo> How about reporting this as a bug, instead?
Pierpaolo> Let's not encourage this weirdness.
It certainly looks like a bug to me (I just tried it in clisp 2.28).
Did you report it the maintainers of clisp?
What did they say?
"Christopher C. Stacy" <······@dtpq.com> ha scritto nel messaggio ··················@dtpq.com...
> >>>>> On Sat, 04 Oct 2003 12:43:08 GMT, Pierpaolo BERNARDI ("Pierpaolo") writes:
>
> Pierpaolo> "Thomas A. Russ" <···@sevak.isi.edu> ha scritto nel messaggio ····················@sevak.isi.edu...
>
> >> How about creating the pathname explicitly?
>
> Pierpaolo> How about reporting this as a bug, instead?
> Pierpaolo> Let's not encourage this weirdness.
>
> It certainly looks like a bug to me (I just tried it in clisp 2.28).
> Did you report it the maintainers of clisp?
> What did they say?
OP, Christopher is talking to you.
I'm not a Clisp user.
P.
From: Lowell
Subject: Re: trouble writing to files with names beginning with .
Date:
Message-ID: <blqjhq$sim$1@mughi.cs.ubc.ca>
Nope, I don't have enough lisp experience to know whethter it's really a
bug or just a lack of understanding on my part. Are we sure it's a bug?
Lowell
Christopher C. Stacy wrote:
>>>>>>On Sat, 04 Oct 2003 12:43:08 GMT, Pierpaolo BERNARDI ("Pierpaolo") writes:
>
>
> Pierpaolo> "Thomas A. Russ" <···@sevak.isi.edu> ha scritto nel messaggio ····················@sevak.isi.edu...
>
> >> How about creating the pathname explicitly?
>
> Pierpaolo> How about reporting this as a bug, instead?
> Pierpaolo> Let's not encourage this weirdness.
>
> It certainly looks like a bug to me (I just tried it in clisp 2.28).
> Did you report it the maintainers of clisp?
> What did they say?
Hi Lowell,
>> It certainly looks like a bug to me (I just tried it in clisp 2.28).
>> Did you report it the maintainers of clisp? What did they say?
> Nope, I don't have enough lisp experience to know whether it's really a
> bug or just a lack of understanding on my part. Are we sure it's a bug?
[Adjusted reply to indicate context]
It's a bug.
Common Lisp programs should be able to refer to _filenames_ in a
non-portable, operating system specific way. They are accessed as
"physical pathnames", which by definition are not "logical pathnames".
Logical pathnames use a namestring syntax that is
implementation-independent, and that has component values that are
implementation-independent.
Start with the ANSI Common Lisp glossary for more information.
Regards,
Adam
From: Marco Antoniotti
Subject: Re: trouble writing to files with names beginning with .
Date:
Message-ID: <3F81B0C1.90602@cs.nyu.edu>
Pierpaolo BERNARDI wrote:
> "Thomas A. Russ" <···@sevak.isi.edu> ha scritto nel messaggio ····················@sevak.isi.edu...
>
>
>>How about creating the pathname explicitly?
>
>
> How about reporting this as a bug, instead?
> Let's not encourage this weirdness.
>
>
>>Perhaps like this:
>>
>>(with-open-file (str (make-pathname
>> :directory '(:absoluate "grads1" "lkirsh" "scripts")
>> :name ".bashrc"
>> :type NIL)
>> :direction :output)
>> (princ "foo"f str))
>>
>>The problem you are getting is probably a result of the built-in string
>>to pathname parsing. If you circumvent that by building your own
>>pathname out of its constituent parts you may be able to overcome the
>>problem.
>
>
> This workaround cannot be used always. Think of a filename typed
> in from an end-user.
>
> The parsing of namestrings should conform to the expectations of users
> of the OS on which the lisp is running.
>
> Traditionally, in Unix, .bashrc is not interpreted as a file with no name and
> type bashrc.
Fine. Then let's agree (meaning: all implementors) that, on a "UNIX"
file system
(parse-namestring ".zot") ==>
#S(PATHNAME NAME ".ZOT" ...)
and, since we are at it, let'a agree that on Windows
(parse-namestring "C:") ==>
now, is that a device or a host?
:)
Cheers
--
Marco
windows + filename beginning with . ???
If i have well understood your problem, it seems that it's from windows and
not CLisp. The Windows browser denies the creation of a file beginning with
a '.'
__________________________________________
Christophe Turle.
(format nil ···@~S.~S" 'cturle 'free 'fr)
From: Eduardo Muñoz
Subject: Re: trouble writing to files with names beginning with .
Date:
Message-ID: <ur81q598e.fsf@terra.es>
* "ctu" <······@nospam.com>
| windows + filename beginning with . ???
|
| If i have well understood your problem, it seems that it's from windows and
| not CLisp. The Windows browser denies the creation of a file beginning with
| a '.'
But Emacs does not:
C-x C-f C:\.foo
will create a "nameless" file.
After creation, you can copy, paste, delete the file just
like any other file.
--
Eduardo Mu�oz | (prog () 10 (print "Hello world!")
http://213.97.131.125/ | 20 (go 10))
"Marco Antoniotti" <·······@cs.nyu.edu> ha scritto nel messaggio ···················@cs.nyu.edu...
> Fine. Then let's agree (meaning: all implementors) that, on a "UNIX"
> file system
>
> (parse-namestring ".zot") ==>
> #S(PATHNAME NAME ".ZOT" ...)
>
> and, since we are at it, let'a agree that on Windows
>
> (parse-namestring "C:") ==>
> now, is that a device or a host?
Yes, it would be nice if there were substandards for these matters.
I am not holding my breath, though.
In the meantime, at the very least, OPEN should not barf if passed
a namestring valid in the host OS.
Ciao
P.
From: Carl Shapiro
Subject: Re: trouble writing to files with names beginning with .
Date:
Message-ID: <ouyzngc278h.fsf@panix3.panix.com>
Marco Antoniotti <·······@cs.nyu.edu> writes:
> and, since we are at it, let'a agree that on Windows
>
> (parse-namestring "C:") ==>
> now, is that a device or a host?
There is no reason to make a mountain out of a mole hill here. It is
a device. You can replate C: with COM1: or another other device name
in this context. The proper way to name hosts in Win32 is through the
UNC convention "\\server\share or device\directory\file.extension".
Hi Pierpaolo BERNARDI,
>> How about creating the pathname explicitly?
>
> How about reporting this as a bug, instead?
> Let's not encourage this weirdness.
It looks to be deliberate, but customisable:
<http://clisp.cons.org/impnotes/filenames.html#name-type-split>
Regards,
Adam
"Adam Warner" <······@consulting.net.nz> ha scritto nel messaggio ·································@consulting.net.nz...
> Hi Pierpaolo BERNARDI,
>
> >> How about creating the pathname explicitly?
> >
> > How about reporting this as a bug, instead?
> > Let's not encourage this weirdness.
>
> It looks to be deliberate, but customisable:
> <http://clisp.cons.org/impnotes/filenames.html#name-type-split>
OK. The bug then lies in the fact that the buggy setting is the default.
P.
From: Marco Antoniotti
Subject: Re: trouble writing to files with names beginning with .
Date:
Message-ID: <3F7DFE14.1010609@cs.nyu.edu>
Lowell wrote:
> I am using Clisp 2.30 on Windows and am habing trouble writing to files.
> It seems to me that I can't write files whose names begin with a period.
> The following code will work if filename doesn't begin with a . but will
> not work if filename does begin with one:
>
> (with-open-file (str filename :direction :output) (princ "foo"))
>
> sample error message:
>
> *** - no file name given: #P"/grads1/lkirsh/scripts/.bashrc"
>
> Is there a way to create files whose names begin with "." ? I would
> prefer to do so without having to deal with pathnames if it's possible.
Then you are asking for trouble.
You want to use pathnames to get this reliable and portably right
(make-pathname :name ".dotname")
It the surest way. Otherwise you have to deal with implementation
dependent stuff.
marco