axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Re: Cannot Rename The File Erlib To NRLIB


From: Camm Maguire
Subject: [Axiom-developer] Re: Cannot Rename The File Erlib To NRLIB
Date: 30 Aug 2006 11:21:26 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

"Page, Bill" <address@hidden> writes:

> Camm, 
> 
> On Wednesday, August 23, 2006 2:27 PM you wrote:
> > ... 
> > You need this in patches.lisp.pamphlet:
> > 
> >          (setq $current-directory (truename 
> > (user-homedir-pathname))) )
> >  goes to
> > 
> >          (setq $current-directory (namestring (truename 
> > (user-homedir-pathname)))))
> >
> 
> Thanks. I applied this patch to my local copy of the Axiom
> Silver build_improvements branch.
>  
> > ... 
> > OK, I've made delete-file remove directories, and provide an
> > errno explanation on failure.  In Version_2_6_8pre.
> > 
> > Lisp has a bit of a different idea on some of these things.
> > probe-file, delete-file, open-file, etc. are not supposed to work
> > on directories, it appears, in keeping with some olden days in
> > which directories were not accessible as files on the fs.  I'm
> > too busy now to try to provide another function, so I hope this
> > will do.
> > 
> > I though you had problems renaming, not deleting?  I have not
> > done anything here (yet).
> > 
> 
> You are right. So in addition to your change to
> 'gcl-2.6.8pre/o/unixfsys.c' in delete_file:
> 
>         if (unlink(filename) < 0 && rmdir(filename) < 0)
>                 FEerror("Cannot delete the file ~S: ~s.", 2,
>                   path, make_simple_string(strerror(errno)));
> 
> and I added the following to rename_file:
> 
> #ifdef HAVE_RENAME
>         /* Make sure we can rename */
>         if (unlink(newfilename) < 0) rmdir(newfilename);

OK, but shouldn't we follow the C semantics and cause an error unless
an explicit delete was issued before a rename?  

I don't know what lisp is supposed to do on collisions here - perhaps
you guys might check clisp or comp.lang.lisp:


20.2.7 rename-file                                                      
[Function]
----------------------------------------------------------------------------------

`rename-file'  filespec new-name =>  defaulted-new-name, old-truename,
new-truename

Arguments and Values::
......................

filespec--a pathname designator.

   new-name--a pathname designator other than a stream.

   defaulted-new-name--a pathname

   old-truename--a physical pathname.

   new-truename--a physical pathname.

Description::
.............

rename-file modifies the file system in such a way that the file
indicated by filespec is renamed to defaulted-new-name.

   It is an error to specify a filename containing a wild component,
for filespec to contain a nil component where the file system does not
permit a nil component, or for the result of defaulting missing
components of new-name from filespec to contain a nil component where
the file system does not permit a nil component.

   If new-name is a logical pathname, rename-file returns a logical
pathname as its primary value.

   rename-file returns three values if successful.  The primary value,
defaulted-new-name, is the resulting name which is composed of new-name
with any missing components filled in by performing a merge-pathnames
operation using filespec as the defaults.  The secondary value,
old-truename, is the truename of the file before it was renamed.  The
tertiary value, new-truename, is the truename of the file after it was
renamed.

   If the filespec designator is an open stream, then the stream itself
and the file associated with it are affected (if the file system
permits).

Examples::
..........

     ;; An example involving logical pathnames.
      (with-open-file (stream "sys:chemistry;lead.text"
                              :direction :output :if-exists :error)
        (princ "eureka" stream)
        (values (pathname stream) (truename stream)))
     =>  #P"SYS:CHEMISTRY;LEAD.TEXT.NEWEST", #P"Q:>sys>chem>lead.text.1"
      (rename-file "sys:chemistry;lead.text" "gold.text")
     =>  #P"SYS:CHEMISTRY;GOLD.TEXT.NEWEST",
        #P"Q:>sys>chem>lead.text.1",
        #P"Q:>sys>chem>gold.text.1"

Exceptional Situations::
........................

If the renaming operation is not successful, an error of type
file-error is signaled.

   An error of type file-error might be signaled if filespec is wild.

See Also::
..........

*Note truename:: , pathname, logical-pathname, *Note File System
Concepts::,

   *Note Pathnames as Filenames::



Take care,

>         if (rename(filename, newfilename) < 0)
>                 FEerror("Cannot rename the file ~S to ~S.",
>                         2, vs_base[0], vs_base[1]);
> #else
> ...
> 
> I am testing the build now.
> 
> Thanks.
> 
> Bill Page.
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]