caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Unix.stat problem
@ 2004-05-24  5:56 skaller
  2004-05-24  6:08 ` Yutaka OIWA
  0 siblings, 1 reply; 3+ messages in thread
From: skaller @ 2004-05-24  5:56 UTC (permalink / raw)
  To: caml-list

Unix.stat (or my brain:) isn't working correctly on my system:
CVS Ocaml, Linux, Redhat 9:
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

When I stat a symbolic link which is a directory,
it is returning S_DIR as the kind. This is wrong,
the name is a link, it should return S_LNK.

Consequently it is impossible to make a directory
tree (because I have a stupid directory containing
a link to itself, namely /usr/include/gnome-xml/libxml

However 'ls' has no problem, it knows it is a symbolic link:

4 -rw-r--r--    1 root     root          800 Jan 25  2003 HTMLtree.h
0 lrwxrwxrwx    1 root     root            1 Jan  9 20:06 libxml -> ./

Please tell me if you know a workaround,  if this really
is a bug (in which case I'll file a report in the bug tracker),
or if I'm just missing something ..

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] Unix.stat problem
  2004-05-24  5:56 [Caml-list] Unix.stat problem skaller
@ 2004-05-24  6:08 ` Yutaka OIWA
  2004-05-24  7:08   ` skaller
  0 siblings, 1 reply; 3+ messages in thread
From: Yutaka OIWA @ 2004-05-24  6:08 UTC (permalink / raw)
  To: caml-list

Hi John,

>> On 24 May 2004 15:56:05 +1000, skaller <skaller@users.sourceforge.net> said:

skaller> Unix.stat (or my brain:) isn't working correctly on my system:
skaller> CVS Ocaml, Linux, Redhat 9:
skaller> gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

From Linux man stat(2):

       stat stats the file pointed to by file_name and  fills  in
       buf.

       lstat  is  identical to stat, except in the case of a sym-
       bolic link, where the link itself is stat-ed, not the file
       that it refers to.

So what you want is probably 

        val lstat : string -> stats
        (** Same as {!Unix.stat}, but in case the file is a symbolic link,
           return the informations for the link itself. *)
        
this one...

-- 
Yutaka Oiwa              Yonezawa Lab., Dept. of Computer Science,
      Graduate School of Information Sci. & Tech., Univ. of Tokyo.
                    <oiwa@yl.is.s.u-tokyo.ac.jp>, <yutaka@oiwa.jp>
PGP fingerprint = C9 8D 5C B8 86 ED D8 07  EA 59 34 D8 F4 65 53 61

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] Unix.stat problem
  2004-05-24  6:08 ` Yutaka OIWA
@ 2004-05-24  7:08   ` skaller
  0 siblings, 0 replies; 3+ messages in thread
From: skaller @ 2004-05-24  7:08 UTC (permalink / raw)
  To: Yutaka OIWA; +Cc: caml-list

On Mon, 2004-05-24 at 16:08, Yutaka OIWA wrote:
> Hi John,
> 
> >> On 24 May 2004 15:56:05 +1000, skaller <skaller@users.sourceforge.net> said:
> 
> skaller> Unix.stat (or my brain:) isn't working correctly on my system:
> skaller> CVS Ocaml, Linux, Redhat 9:
> skaller> gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

> 
> So what you want is probably 
> 
>         val lstat : string -> stats

Arggg, my brain wasn't working. For some reason
I considered lstat and got the whole concept backwards.
Thanks!

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

end of thread, other threads:[~2004-05-24  7:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-24  5:56 [Caml-list] Unix.stat problem skaller
2004-05-24  6:08 ` Yutaka OIWA
2004-05-24  7:08   ` skaller

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 NNTP newsgroup(s).